You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up to #398 — we decided not to add runtime "load" for external sidebar JSON on the platform. Instead, this is better served as an optional agent skill that users can copy into their repo when they auto-generate API reference docs.
The skill closes the loop on: keeping hand-authored nav in docs.json while syncing generated API sections without the doc generator owning the full config file.
Problem
Teams that auto-generate API/reference documentation often have tooling that knows the page hierarchy and can express it as JSON. They still want to manually maintain docs.json for site title, top-level nav, and prose sections — but need generated nav to stay in sync on each regen without hand-editing the full file each time.
Expected outcome
After adopting the skill, a maintainer can:
Run their API doc generator (OpenAPI, Typedoc, custom tool, etc.) as they do today
Run the skill workflow (agent + script, or script alone in CI) to merge fresh nav into docs.json
Review the diff, commit, and push — site updates with correct sidebar, no platform changes required
Before: generator must rewrite docs.json, or maintainer hand-merges hundreds of nav entries. After: generator outputs a small nav JSON file; merge is deterministic and repeatable.
skills/sync-api-nav/
SKILL.md # Agent instructions + when to use
merge-sidebar.mjs # Deterministic merge script (Node, no deps)
example/
docs.json # Sample hand-authored config
api-sidebar.json # Sample generator output
docs.json.expected # Expected result after merge (for tests)
Users who need it copy the folder into their repo:
.agents/skills/sync-api-nav/
Once copied and pushed, the skill is discoverable via MCP as docs-page://skills/sync-api-nav on their hosted site (optional — the script also works standalone in CI).
Generate API docs — run your existing generator; confirm MDX pages land under docs/ and nav JSON is written (path configurable, default docs/api-sidebar.json).
Configure the merge target — in docs.json, keep a stable sidebar group the skill owns, e.g.:
{
"group": "API Reference",
"pages": []
}
Hand-authored groups (Welcome, Guides, etc.) sit above or below and are never touched.
Context
Follow-up to #398 — we decided not to add runtime
"load"for external sidebar JSON on the platform. Instead, this is better served as an optional agent skill that users can copy into their repo when they auto-generate API reference docs.The skill closes the loop on: keeping hand-authored nav in
docs.jsonwhile syncing generated API sections without the doc generator owning the full config file.Problem
Teams that auto-generate API/reference documentation often have tooling that knows the page hierarchy and can express it as JSON. They still want to manually maintain
docs.jsonfor site title, top-level nav, and prose sections — but need generated nav to stay in sync on each regen without hand-editing the full file each time.Expected outcome
After adopting the skill, a maintainer can:
docs.jsonBefore: generator must rewrite
docs.json, or maintainer hand-merges hundreds of nav entries.After: generator outputs a small nav JSON file; merge is deterministic and repeatable.
Skill layout
Publish in the docs.page repo under
skills/sync-api-nav/:Users who need it copy the folder into their repo:
Once copied and pushed, the skill is discoverable via MCP as
docs-page://skills/sync-api-navon their hosted site (optional — the script also works standalone in CI).How it works
Typical workflow
Step-by-step (what SKILL.md should instruct)
Generate API docs — run your existing generator; confirm MDX pages land under
docs/and nav JSON is written (path configurable, defaultdocs/api-sidebar.json).Configure the merge target — in
docs.json, keep a stable sidebar group the skill owns, e.g.:{ "group": "API Reference", "pages": [] }Hand-authored groups (
Welcome,Guides, etc.) sit above or below and are never touched.Run the merge — invoke the script:
node .agents/skills/sync-api-nav/merge-sidebar.mjs \ --config docs.json \ --input docs/api-sidebar.json \ --group "API Reference"Or ask an agent with this skill loaded to run the same command after generation.
Review the diff — check only the target group's
pagesarray changed; titles, hrefs, and nested groups match generator output.Validate — run
npx @docs.page/cli check(and preview locally if needed).Commit and push — include updated
docs.jsonand any new/changed MDX pages from the generator.What
merge-sidebar.mjsshould dodocs.jsonand generator nav JSONgrouptitle or a configurable marker)pageswith generated entriesdocs.jsonsidebar entries)docs/(warn or--strictflag)What
SKILL.mdshould containdocs.json, generator that outputs nav JSONInput / output contract
Generator input (
api-sidebar.json)Minimum shape (from #398):
{ "pages": [ { "title": "Foo", "href": "/api/foo" }, { "title": "Bar", "href": "/api/bar" }, { "group": "Baz", "pages": [ { "title": "Baz overview", "href": "/api/baz" } ] } ] }Entries use the same sidebar item shape as
docs.json(title,href,group,pages,tab, etc.).Merge result (
docs.json)Hand-authored top of sidebar preserved; generated section injected:
{ "name": "Example Project", "sidebar": [ { "pages": [ { "title": "Welcome", "href": "/" }, { "title": "Getting Started", "href": "/getting-started" }, { "group": "API Reference", "pages": [ { "title": "Foo", "href": "/api/foo" }, { "title": "Bar", "href": "/api/bar" } ] } ] } ] }What to check (acceptance criteria)
Skill quality
SKILL.mdhas frontmatter (name,description) and runs without docs.page-specific secretsexample/pass a simple test (node merge-sidebar.mjs→ matchesdocs.json.expected)Merge correctness
--dry-runflag prints diff without writing (nice to have)Integration
npx @docs.page/cli checkpasses after mergeDocs
/ai-agents/agent-skillsor/features/agent-skills)Why a skill (not a platform feature)
docs.jsonexplicit at render time — no extra GitHub fetches or cache invalidationOut of scope (for this skill)
"load": "..."indocs.json(Support for Generated Navigation #398 platform approach)Related