Fumadocs Migration
Use this skill to migrate legacy docs from /Users/czhen/Documents/GitHub/AgoraIO/shengwang-doc-source into this docs-portal repo.
Hard Rules
- The target content standard is Markdown/MDX native first.
- Legacy JSX must not survive migrated content.
- Rendering components are implementation details; content syntax must be standard Markdown, MDX native, or directive/include syntax.
- Common MDX components must come from Fumadocs UI or repo-local shadcn/radix primitives. Do not invent custom tabs, code blocks, callouts, cards, or platform selectors when Fumadocs or shadcn already provides the primitive.
src/components/mdx.tsxis the common registry only: link normalization plus repo-approved shadcn/radix wrappers for Fumadocs/core outputs such as tabs, code blocks, generated code tabs, copy buttons, and standard links. Do not put page-specific overview widgets in this registry.- Human-authored editorial overview widgets must live outside the common registry, such as
src/components/docs-overview/mdx-components.tsx, and must be injected only for approved overview content paths. - Component styling belongs in Tailwind classes colocated with the component. Do not add selector-heavy component skins, widget variables, or page-specific card styles to
src/styles/app.css. - Global CSS custom properties are reserved for theme, shell layout, shadcn bridge tokens, and Fumadocs integration tokens. Do not add component-local variables for migrated MDX widgets.
- Shared content is allowed, but use Fumadocs include or a project-approved directive, not legacy
@sharedimports. - Platform/product variants should default to static files, folders, or navigation when the source IA is already split that way. When one page intentionally mixes shared content with repeated platform-specific sections, migrate to the repo's
PlatformInline/PlatformStructuredauthoring blocks instead of inventing custom runtime filters. - Independent product or platform navigation must be declared with
navScopeinmeta.json; do not hard-code scoped sidebars in docs-shell code. - When API reference versions differ by platform, place version folders under the platform folder, not under the product root.
- Use
(current)for current-version clean URLs when a versioned scope should omit the version segment. - Same-page variants should use:
Tabsor generatedCodeBlockTabsfor small language/example switches inside one conceptual section.PlatformInline/PlatformStructuredfor document-body platform variants that must preserve shared prose between repeated platform sections. Do not create ad hoc platform tab components in content.
- Do not add legacy compatibility plugins, old component maps, or Docusaurus runtime variable shims.
- Do not add relative JSON
$schemapaths to migratedmeta.jsonfiles. bun run types:checkis the minimum compile gate before claiming migrated content is complete.- For generated HTML API references, rebuild the legacy TOC as real folders plus
meta.json; do not flatten a nested navigation tree unless the user explicitly asks for a flat sidebar. - For generated HTML API references, treat all non-code inline HTML as MDX-unsafe until proven otherwise. Escape literal
<,>,{, and}outside code fences and preserve inline links/code spans during normalization. - Stable fragment IDs from legacy API references must survive migration. Prefer heading-bound IDs where possible and only use standalone anchors when compatibility requires them.
Workflow
Inspect current portal contracts:
package.json,source.config.ts,content/docs, and existingmeta.jsonpatterns.Run or update the audit script before migrating a new batch:
node .agents/skills/fumadocs-migration/scripts/audit-legacy-docs.mjs \ --source /Users/czhen/Documents/GitHub/AgoraIO/shengwang-doc-source \ --out docs/superpowers/reports/YYYY-MM-DD-fumadocs-migration-auditClassify each source file before editing: native prose, shared snippet, platform variant, API reference MDX, OpenAPI source, generated HTML API, landing page, or asset/link cleanup.
Rewrite in this priority order:
- Markdown native.
- Markdown/MDX directive syntax parsed by remark/rehype.
- Fumadocs MDX native features such as include.
- Newly approved runtime widgets only when static syntax cannot represent the content. Restrict these to allowlisted editorial overview pages unless the user explicitly approves a broader runtime component surface.
For generated HTML API references, extract and freeze the legacy
nav.toctree before writing files. Use that tree to decide target folders, folder index pages, and everymeta.json.Update or create
meta.jsonfrom legacy sidebar order. Do not migrate executable JS metadata.For independent or versioned navigation, update
meta.jsonwithnavScopeand keep version folder page order inside the version folder.Mark deferred generated API, unresolved OpenAPI lane work, and missing standards in the audit report.
Verify with
bun run types:check; addbun run docs:links,bun run test, orbun run buildwhen the migration touches links, code, routing, shell behavior, or generated API publication.If the repo build expects OpenAPI assets under
public/openapi/**, run the sync step before the final build so prerender can fetch/openapi/**.If the default shell runtime lacks the required Node/Bun version, use the approved workspace runtime and still complete the equivalent
fumadocs-mdx,tsc --noEmit, asset sync, and build checks whenever possible.
References
Load only the reference needed for the current case:
references/standards.md: target Fumadocs content-layer standards and verification gates.references/legacy-casebook.md: legacy syntax and component rewrite rules.references/openapi-lane.md: OpenAPI staging, endpoint generation, override, publication, and llms rules.references/report-schema.md: audit report JSON/Markdown schema and status taxonomy.