Skip to content

Commit ee74184

Browse files
authored
[codex] publish agent skills discovery index (#139)
* add agent skills discovery index * address agent skills review comments
1 parent 9a109ab commit ee74184

4 files changed

Lines changed: 171 additions & 0 deletions

File tree

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
static/.well-known/agent-skills/** text eol=lf
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"$schema": "https://schemas.agentskills.io/discovery/0.2.0/schema.json",
3+
"skills": [
4+
{
5+
"name": "quran-foundation-api-docs",
6+
"type": "skill-md",
7+
"description": "Use Quran Foundation docs and tutorials to choose the correct API family, authentication flow, endpoint, font rendering approach, request-access prerequisite, and official references for content, search, OAuth2/OIDC, user-related, and Quran Reflect integrations.",
8+
"url": "/.well-known/agent-skills/quran-foundation-api-docs/SKILL.md",
9+
"digest": "sha256:df258de3417829586f3ccbd6176558df239d89240396719ceba7c2f5388d9253"
10+
}
11+
]
12+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
name: quran-foundation-api-docs
3+
description: Use Quran Foundation docs and tutorials to choose the correct API family, authentication flow, endpoint, font rendering approach, request-access prerequisite, and official references for content, search, OAuth2/OIDC, user-related, and Quran Reflect integrations.
4+
---
5+
6+
# Quran Foundation API Docs
7+
8+
## Use When
9+
10+
- The task involves Quran Foundation APIs, api-docs.quran.foundation, Quran.com integrations, or quranreflect.com integrations.
11+
- The user needs official endpoint selection, request or response details, auth guidance, scopes, quickstarts, or migration help.
12+
- The user needs font rendering or Mushaf page-layout guidance.
13+
- The user needs OAuth2 or OIDC setup guidance across web or mobile platforms.
14+
- The user needs onboarding details such as client provisioning or Request Access.
15+
- The task involves Quran Reflect or quranreflect.com features backed by Quran Foundation APIs.
16+
- The user wants links to official documentation or OpenAPI specifications.
17+
18+
## Do Not Use When
19+
20+
- The task is unrelated to Quran Foundation APIs.
21+
- The user needs live production data, account-specific secrets, or environment access that is not present in the docs.
22+
23+
## Route The Request First
24+
25+
1. Identify the correct API family.
26+
- Content APIs v4: Quran text, translations, tafsir, audio, recitations, verses, chapters, pages, juz, hizb, ruku, manzil, and related content.
27+
- Search APIs v1: Quran search queries and search-related integration.
28+
- OAuth2 APIs v1 and OIDC docs: authentication, authorization, tokens, discovery, and login flows.
29+
- User-related APIs v1: bookmarks, collections, notes, profiles, reading sessions, rooms, posts, and related user features.
30+
- Font and page-layout tutorials: script rendering, Mushaf layouts, and page-based display guidance.
31+
- Quran Reflect integrations: posts, comments, feeds, likes, saves, room/page/community features, and related scopes.
32+
2. Prefer stable production docs by default.
33+
3. Only use pre-live user-related docs when the user explicitly asks for upcoming or unreleased behavior.
34+
35+
## Canonical Sources
36+
37+
- Docs home: `https://api-docs.quran.foundation/`
38+
- Content OpenAPI: `https://api-docs.quran.foundation/openAPI/content/v4.json`
39+
- Search OpenAPI: `https://api-docs.quran.foundation/openAPI/search/v1.json`
40+
- OAuth2 OpenAPI: `https://api-docs.quran.foundation/openAPI/oauth2-apis/v1.json`
41+
- User-related OpenAPI (production): `https://api-docs.quran.foundation/openAPI/user-related-apis/v1.json`
42+
- User-related OpenAPI (pre-live): `https://api-docs.quran.foundation/openAPI/user-related-apis/pre-live/v1.json`
43+
- User APIs OIDC quickstart: `https://api-docs.quran.foundation/docs/tutorials/oidc/user-apis-quickstart/`
44+
- OAuth2 getting started: `https://api-docs.quran.foundation/docs/tutorials/oidc/getting-started-with-oauth2/`
45+
- OpenID Connect tutorial: `https://api-docs.quran.foundation/docs/tutorials/oidc/openid-connect/`
46+
- OIDC client setup: `https://api-docs.quran.foundation/docs/tutorials/oidc/client-setup/`
47+
- OAuth2 web integration example: `https://api-docs.quran.foundation/docs/tutorials/oidc/example-integration/`
48+
- Mobile apps overview: `https://api-docs.quran.foundation/docs/tutorials/oidc/mobile-apps/`
49+
- Android mobile OIDC guide: `https://api-docs.quran.foundation/docs/tutorials/oidc/mobile-apps/android/`
50+
- iOS mobile OIDC guide: `https://api-docs.quran.foundation/docs/tutorials/oidc/mobile-apps/iOS/`
51+
- React Native OIDC guide: `https://api-docs.quran.foundation/docs/tutorials/oidc/mobile-apps/react-native/`
52+
- Content API quickstart: `https://api-docs.quran.foundation/docs/quickstart/`
53+
- Font rendering tutorial: `https://api-docs.quran.foundation/docs/tutorials/fonts/font-rendering/`
54+
- Page layout tutorial: `https://api-docs.quran.foundation/docs/tutorials/fonts/page-layout/`
55+
- Request access: `https://api-docs.quran.foundation/request-access/`
56+
- FAQ: `https://api-docs.quran.foundation/docs/tutorials/faq/`
57+
- API catalog: `https://api-docs.quran.foundation/.well-known/api-catalog`
58+
59+
## Working Rules
60+
61+
- Cite official Quran Foundation docs or OpenAPI specs when giving implementation guidance.
62+
- Prefer the most specific doc page for the endpoint in question, not just the docs home page.
63+
- Do not invent endpoints, scopes, parameters, headers, or response fields. Confirm them from the docs or OpenAPI.
64+
- Distinguish documentation URLs from API base URLs.
65+
- For auth questions, call out whether the answer belongs to OAuth2/OIDC or to an application API.
66+
- For setup questions, mention if Request Access and registered redirect URIs are prerequisites.
67+
- For Quran font questions, choose between Unicode text rendering and page-based glyph rendering based on the user's display requirements.
68+
- For Quran Reflect-related questions, check post, comment, feed, room, and scope docs before answering.
69+
- If multiple endpoints could fit, explain the best match and mention the alternative only if it materially changes implementation.
70+
- If the user asks for sample code, keep it aligned with documented auth and base URL expectations.
71+
72+
## Fast Routing Hints
73+
74+
- "Get verses, translations, tafsir, chapters, audio, or recitations" -> Content APIs v4
75+
- "Search the Quran" -> Search APIs v1
76+
- "Login, tokens, discovery, issuer metadata, OAuth2, OIDC" -> OAuth2 APIs v1 plus OIDC docs
77+
- "Bookmarks, collections, notes, reading sessions, profile, rooms, posts" -> User-related APIs v1
78+
- "Web login flow, PKCE, callback, mobile auth, redirect URIs" -> OIDC tutorial pages plus OAuth2 APIs
79+
- "Fonts, glyph codes, Mushaf pages, script rendering, Tajweed display" -> Font rendering and page-layout tutorials plus relevant content endpoints
80+
- "Quran Reflect feed, post, comment, like, save, room, or community behavior" -> User-related posts and rooms docs, and content feed/read docs where applicable
81+
- "Upcoming user API behavior" -> Pre-live user-related docs, and clearly label them as pre-live
82+
83+
## Expected Output
84+
85+
- Name the API family first.
86+
- Link the exact doc page or OpenAPI spec used.
87+
- State any auth requirement or prerequisite clearly.
88+
- If relevant, mention whether the guidance is production or pre-live.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
const test = require('node:test');
2+
const assert = require('node:assert/strict');
3+
const crypto = require('node:crypto');
4+
const fs = require('node:fs');
5+
const path = require('node:path');
6+
7+
const indexPath = path.join(
8+
__dirname,
9+
'..',
10+
'static',
11+
'.well-known',
12+
'agent-skills',
13+
'index.json',
14+
);
15+
const index = JSON.parse(fs.readFileSync(indexPath, 'utf8'));
16+
17+
test('publishes an Agent Skills discovery index with the v0.2.0 schema', () => {
18+
assert.equal(
19+
index.$schema,
20+
'https://schemas.agentskills.io/discovery/0.2.0/schema.json',
21+
);
22+
assert.ok(Array.isArray(index.skills));
23+
assert.ok(index.skills.length > 0);
24+
});
25+
26+
test('validates required RFC v0.2.0 skill entry fields', () => {
27+
for (const skill of index.skills) {
28+
assert.equal(typeof skill.name, 'string');
29+
assert.match(skill.name, /^(?!-)(?!.*--)[a-z0-9-]{1,64}(?<!-)$/);
30+
31+
assert.ok(['skill-md', 'archive'].includes(skill.type));
32+
33+
assert.equal(typeof skill.description, 'string');
34+
assert.ok(skill.description.length > 0);
35+
assert.ok(skill.description.length <= 1024);
36+
37+
assert.equal(typeof skill.url, 'string');
38+
assert.ok(skill.url.length > 0);
39+
40+
assert.equal(typeof skill.digest, 'string');
41+
assert.match(skill.digest, /^sha256:[0-9a-f]{64}$/);
42+
}
43+
});
44+
45+
test('matches each published skill-md digest to the raw SKILL.md bytes', () => {
46+
for (const skill of index.skills) {
47+
if (skill.type !== 'skill-md') {
48+
continue;
49+
}
50+
51+
assert.match(
52+
skill.url,
53+
/^\/\.well-known\/agent-skills\/[a-z0-9-]+\/SKILL\.md$/,
54+
);
55+
56+
const localSkillPath = path.join(
57+
__dirname,
58+
'..',
59+
'static',
60+
...skill.url.replace(/^\//, '').split('/'),
61+
);
62+
const rawBytes = fs.readFileSync(localSkillPath);
63+
const digest = `sha256:${crypto
64+
.createHash('sha256')
65+
.update(rawBytes)
66+
.digest('hex')}`;
67+
68+
assert.equal(skill.digest, digest);
69+
}
70+
});

0 commit comments

Comments
 (0)