$npx -y skills add rstackjs/agent-skills --skill rspress-docs-generatorGenerate or maintain Rspress documentation for a project. Use whenever the user wants to create a new Rspress v2 docs site, add docs for user-facing feature work or PRs, maintain a dedicated Rspress docs project in a monorepo, or prevent stale Rspress v1 scaffolds/version drift b
| 1 | # Rspress Docs Generator |
| 2 | |
| 3 | Create and maintain Rspress documentation as part of normal project work. Prefer source-backed docs over generic prose: read the code, tests, examples, package metadata, and existing README before writing. |
| 4 | |
| 5 | ## Use Cases |
| 6 | |
| 7 | - Create a new Rspress v2 documentation site for a project that has no docs site yet. |
| 8 | - Update an existing Rspress v2 docs site for a user-facing feature, API change, CLI change, or PR. |
| 9 | - Detect Rspress v1 version markers before documentation work and hand migration to the dedicated `rspress-v2-upgrade` skill. |
| 10 | - Integrate Rspress documentation into an Rslib package or workspace while preserving the repository's package manager and scripts. |
| 11 | |
| 12 | ## Workflow |
| 13 | |
| 14 | 1. **Inspect the project** |
| 15 | - Locate package files, source entry points, examples, tests, changelogs, and README files. |
| 16 | - Search for Rspress config files: `rspress.config.ts`, `.js`, `.mjs`, or `.cjs`. |
| 17 | - Inspect dependencies for Rspress version markers: `@rspress/core` version, legacy `rspress` package or `rspress/*` imports, and `@rspress/plugin-*`. |
| 18 | - Detect the package manager and workspace setup from lock files (`pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`, `bun.lock`, `bun.lockb`) and `pnpm-workspace.yaml`. |
| 19 | - If a config exists, resolve the docs root from its `root` option. When `root` is absent, inspect package scripts, CI commands, and documented commands for Rspress CLI positional roots such as `rspress dev site`, `rspress build site`, or `rspress preview site`; use that argument before falling back to Rspress's default `docs/` directory relative to the config file's project cwd. If no config exists, check common roots such as `docs/`, `doc/`, `website/`, and `site/`. |
| 20 | |
| 21 | 2. **Choose the correct path** |
| 22 | - If no Rspress docs site exists, follow [Create New Docs](references/create-new-docs.md). |
| 23 | - If a Rspress docs site exists but appears to be v1, follow [Rspress Version Guard](references/rspress-version-guard.md) before editing docs. |
| 24 | - If a Rspress v2 docs site exists, follow [Maintain Docs For PRs](references/maintain-docs-for-prs.md). |
| 25 | |
| 26 | 3. **Validate before finishing** |
| 27 | - Run the docs build from the Rspress project directory or through the repo's root script. |
| 28 | - The build must pass as the primary success criterion. |
| 29 | - Fix broken links, missing navigation entries, invalid frontmatter, and failed MDX imports before reporting completion. |
| 30 | |
| 31 | ## Code Examples |
| 32 | |
| 33 | Use the repository's package manager when creating or validating docs: |
| 34 | |
| 35 | ```bash |
| 36 | # Create a new Rspress docs site with the detected package manager. |
| 37 | # Replace pnpm with npm, yarn, or bun when that is the repo package manager. |
| 38 | pnpm create rspress@latest |
| 39 | |
| 40 | # Validate from the docs project after replacing starter content. |
| 41 | pnpm run build |
| 42 | ``` |
| 43 | |
| 44 | When maintaining docs for a PR, inspect the changed source first, then update the matching docs page and navigation: |
| 45 | |
| 46 | ```text |
| 47 | src/formatBytes.ts -> website/docs/api/formatBytes.mdx -> website/docs/api/_meta.json |
| 48 | ``` |
| 49 | |
| 50 | ## Reference |
| 51 | |
| 52 | - [Documentation structure conventions](references/doc-structure-conventions.md) — how `_nav.json` and `_meta.json` work, with concrete examples for Guide/API sites, grouped sections, and i18n layouts. |
| 53 | - [Create New Docs](references/create-new-docs.md) — scaffold a Rspress v2 docs site from an undocumented project. |
| 54 | - [Maintain Docs For PRs](references/maintain-docs-for-prs.md) — update an existing Rspress v2 docs site for feature work. |
| 55 | - [Rspress Version Guard](references/rspress-version-guard.md) — detect v1 sites, avoid stale v1 scaffolds, and hand full migration to `rspress-v2-upgrade`. |