$npx -y skills add rstackjs/agent-skills --skill rspress-description-generatorGenerate and maintain description frontmatter for Rspress documentation files (.md/.mdx). Use when a user wants to add SEO descriptions, improve search engine snippets, generate llms.txt metadata, prepare docs for AI summarization, or batch-update frontmatter across an Rspress do
| 1 | # Rspress Description Generator |
| 2 | |
| 3 | The `description` field in Rspress frontmatter generates `<meta name="description" content="...">` tags, which are used for search engine snippets, social media previews, and AI-oriented formats like llms.txt. |
| 4 | |
| 5 | ## Step 1 — Locate the docs root |
| 6 | |
| 7 | 1. Find the Rspress config file. Search for `rspress.config.ts`, `.js`, `.mjs`, or `.cjs`. It may be at the project root or inside a subdirectory like `website/`. |
| 8 | 2. Read the config and extract the `root` option. |
| 9 | - The value might be a plain string (`root: 'docs'`) or a JS expression (`root: path.join(__dirname, 'docs')`). In either case, determine the resolved directory path. |
| 10 | - If `root` is set, resolve it relative to the config file's directory. |
| 11 | - If `root` is not set, default to `docs` relative to the config file's directory. |
| 12 | 3. Confirm the directory exists. If neither `docs` nor the configured root exists, check for `doc` as a fallback. |
| 13 | |
| 14 | ## Step 2 — Detect i18n structure |
| 15 | |
| 16 | Rspress i18n projects place language subdirectories (e.g., `en/`, `zh/`) directly under the docs root: |
| 17 | |
| 18 | ``` |
| 19 | docs/ |
| 20 | ├── en/ |
| 21 | │ ├── guide/ |
| 22 | │ └── index.md |
| 23 | └── zh/ |
| 24 | ├── guide/ |
| 25 | └── index.md |
| 26 | ``` |
| 27 | |
| 28 | Check if the docs root contains language subdirectories (two-letter codes like `en`, `zh`, `ja`, `ko`, etc.). If so, process each language directory separately — the description language should match the content language. |
| 29 | |
| 30 | If there are no language subdirectories, treat the entire docs root as a single-language site. |
| 31 | |
| 32 | ## Step 3 — Scan and process files |
| 33 | |
| 34 | Glob for `**/*.md` and `**/*.mdx` under the docs root. Exclude: |
| 35 | |
| 36 | - `node_modules`, build output (`doc_build`, `.rspress`, `dist`) |
| 37 | - `_meta.json` / `_nav.json` (sidebar/nav config files, not doc pages) |
| 38 | - `**/shared/**` directories (reusable snippets included via `@import`, not standalone pages) |
| 39 | |
| 40 | For each file: |
| 41 | |
| 42 | 1. **Read the file.** |
| 43 | 2. **Check for existing `description` in frontmatter.** If it exists and is non-empty, skip. |
| 44 | 3. **Check `pageType` in frontmatter.** For `home` pages, derive the description from the `hero.text` / `hero.tagline` fields or the features list, not from body content. |
| 45 | 4. **Generate a description** following the writing guidelines below. |
| 46 | 5. **Insert `description` into frontmatter:** |
| 47 | - If the file has frontmatter with a `title` field, insert `description` on the line after `title`. |
| 48 | - If the file has frontmatter without `title`, insert `description` as the first field. |
| 49 | - If the file has no frontmatter block, add one: |
| 50 | |
| 51 | ```yaml |
| 52 | --- |
| 53 | description: Your generated description here |
| 54 | --- |
| 55 | ``` |
| 56 | |
| 57 | ### YAML formatting |
| 58 | |
| 59 | Most descriptions can be bare YAML strings: |
| 60 | |
| 61 | ```yaml |
| 62 | description: Step-by-step guide to setting up your first Rspress site |
| 63 | ``` |
| 64 | |
| 65 | If the description contains colons, quotes, or other special YAML characters, wrap in double quotes: |
| 66 | |
| 67 | ```yaml |
| 68 | description: 'API reference for Rspress configuration: plugins, themes, and build options' |
| 69 | ``` |
| 70 | |
| 71 | ## Step 4 — Batch processing |
| 72 | |
| 73 | For sites with many files, use parallel agent calls to process independent files simultaneously. Group by directory (e.g., all files in `guide/`, then all in `api/`) to maintain focus and consistency within each section. |
| 74 | |
| 75 | After processing all files, do a quick scan to ensure no files were missed — re-glob and check for any remaining files without `description`. |
| 76 | |
| 77 | ## Description Writing Guidelines |
| 78 | |
| 79 | The description serves three audiences: search engines (Google snippet), AI systems (llms.txt, summarization), and humans (scanning search results). A good description helps all three. |
| 80 | |
| 81 | ### Rules |
| 82 | |
| 83 | - **Length**: 50–160 characters. Under 50 is too vague for search engines; over 160 gets truncated in snippets. |
| 84 | - **Language**: Match the document content. Chinese docs get Chinese descriptions, English docs get English descriptions. |
| 85 | - **Be direct**: State what the page covers. Avoid starting with "This document", "This page", "Learn about" — jump straight to the substance. |
| 86 | - **Be specific**: Mention concrete technologies, APIs, or concepts the page covers. "Configure Rspress plugins for search, analytics, and internationalization" beats "How to use plugins." |
| 87 | - **No markdown**: Plain text only, no formatting syntax. |
| 88 | |
| 89 | ### Examples |
| 90 | |
| 91 | **Good:** |
| 92 | |
| 93 | | Content | Description | |
| 94 | | -------------------------- | ---------------------------------------------------------------------------- | |
| 95 | | Plugin development guide | Create custom Rspress plugins using the Node.js plugin API and runtime hooks | |
| 96 | | MDX |