| name | write-to-docusaurus |
| description | Writes Markdown articles to a Docusaurus project with i18n support. Automatically creates both Chinese and English versions. Use when asked to add documentation, create MDX files, or organize content in a Docusaurus site with Chinese/English localization. |
Write to Docusaurus
Write Markdown/MDX articles to a Docusaurus project with i18n support. Automatically creates both Chinese (default) and English versions.
Known Project Defaults
When the user does not provide a different target, prefer this known Docusaurus project:
- Project root:
E:\all-project\summary
- Default locale:
zh-Hans
- English docs path:
i18n/en/docusaurus-plugin-content-docs/current/
- AI article category:
docs/ai-bigdata/AI/
- AI category label:
๐ค AI & LLM
For this project, AI/LLM/agent/vibe-coding/news-analysis content should usually go under:
- Chinese:
docs/ai-bigdata/AI/
- English:
i18n/en/docusaurus-plugin-content-docs/current/ai-bigdata/AI/
When to Use
- Adding new documentation articles to a Docusaurus site
- Creating MDX files with proper frontmatter
- Organizing content in bilingual (Chinese/English) Docusaurus projects
- User asks to "write article", "add docs", "create documentation"
Project Structure
This skill targets Docusaurus projects with this i18n layout:
project/
โโโ docs/ # Default locale (Chinese) content
โ โโโ category/
โ โ โโโ subcategory/
โ โ โ โโโ article.mdx
โ โ โโโ _category_.json
โ โโโ intro.mdx
โโโ i18n/
โ โโโ en/ # English translations
โ โ โโโ docusaurus-plugin-content-docs/
โ โ โโโ current/ # Mirror of docs/ structure
โ โ โโโ category/
โ โโโ zh-Hans/ # Chinese (if default is English)
โโโ docusaurus.config.ts
Key rules:
- Default locale content goes in
docs/
- Translations go in
i18n/{locale}/docusaurus-plugin-content-docs/current/
- Directory structure mirrors between
docs/ and i18n/*/current/
_category_.json files define sidebar organization
Instructions
Step 1: Determine Target Location
-
Analyze article content to determine category:
| Content Keywords | Category | Subcategory |
|---|
| Docker, Kubernetes, CI/CD, Jenkins, Ansible | devops | - |
| React, Vue, CSS, HTML, JavaScript, TypeScript | Frontend | - |
| AI, LLM, GPT, Machine Learning, Deep Learning | ai-bigdata | AI |
| Hadoop, Spark, Flink, HBase | ai-bigdata | BigData |
| Git, Docker basics, IDE, Development tools | tools | Development |
| Chrome, VS Code plugins, Non-dev tools | tools | NonDevelopment |
| Network, OS, Database fundamentals | background | - |
| Other topics | misc | - |
-
Identify the category from article content:
- Read article content and match keywords to category table
- If content matches multiple categories, choose the most specific one
- If uncertain, ask user which category to use
-
Check if category/subcategory exists:
- If yes โ use existing path
- If no โ ask user whether to create new category or use existing one
-
Prefer project-specific defaults when known:
- For
E:\all-project\summary, AI-related analysis articles should default to ai-bigdata/AI
- Reuse existing category structure instead of inventing a nearby new path unless the user asks for it
Step 2: Generate Frontmatter
Required frontmatter fields:
---
id: article-slug
title: "Article Title"
sidebar_label: "Short Title"
sidebar_position: 1
description: "Brief desc"
tags:
- tag1
- tag2
last_update:
date: 'YYYY-MM-DD'
author: username
---
Frontmatter safety rules:
- Always quote
title, sidebar_label, and description in YAML frontmatter.
- This is mandatory when values contain
:, emoji, non-ASCII punctuation, or long natural-language phrases.
- Prefer double quotes for consistency.
ID conventions:
- Lowercase letters, numbers, hyphens only
- Match filename without extension
- Example:
my-article for my-article.mdx
Step 3: Write the File
- Ensure
.mdx extension (supports JSX components)
- Place in correct directory based on language
- Create parent directories if needed
- Update
_category_.json if creating new category
Step 3.5: Apply MDX Safety Rules (MANDATORY)
Before writing body content, enforce these MDX-specific rules:
- Never use angle-bracket autolinks like
<https://example.com> in MDX content.
- Use Markdown links instead:
[https://example.com](https://example.com) or [label](https://example.com)
- Avoid raw HTML unless necessary.
- Prefer normal Markdown syntax over embedded HTML tags.
- Treat anything inside
<...> as potentially dangerous in MDX.
- MDX may parse it as JSX and fail compilation.
- When including source links, always use Markdown link syntax.
- If copying text from articles, clean up characters that may confuse MDX/JSX parsing.
- Especially stray
<, >, {, or JSX-like fragments.
- For news, analysis, or summary articles, include explicit original-source links in the document body.
- Do not only mention outlet names; include concrete URLs.
- When summarizing external articles, base conclusions on inspected source content, not just digest headlines.
- For internal anchor links, prefer explicit heading IDs when headings contain emoji, Chinese text, punctuation, or mixed-language text.
- Example:
## ๐ ๆ
้ๆ้ค {#ๆ
้ๆ้ค}
- Then link with
[ๆ
้ๆ้ค](#ๆ
้ๆ้ค)
- If a document links to its own section anchors, stabilize those anchors explicitly instead of relying on auto-generated slugs.
Step 3.6: Add Source Hygiene for Analysis Articles
For AI news, product analysis, startup analysis, benchmark writeups, or ecosystem commentary:
- Include an Original Sources / ๅๆ้พๆฅ section near the end of the article.
- Link every major source with a full Markdown link.
- Prefer primary sources over aggregators whenever possible:
- company blog / official docs / original HN thread / benchmark page / GitHub repo
- If a claim comes from discussion rather than the official page, say so explicitly.
- Do not present unverified benchmark claims as settled facts.
Step 4: Create Bilingual Content (MANDATORY)
Default behavior: ALWAYS create both Chinese and English versions.
- Write Chinese version first to
docs/{category}/
- Write English translation to
i18n/en/docusaurus-plugin-content-docs/current/{category}/
- Keep same
id in both versions
- Translate
title, sidebar_label, description to English
- Keep
tags consistent (or translate if needed)
- Keep
sidebar_position identical in both versions
Exception: Only skip English if user explicitly says "ๅชๅไธญๆ" or "Chinese only".
Examples
Adding Chinese Article
User: "Add an article about React hooks to Frontend category"
Target: docs/Frontend/react-hooks.mdx
---
id: react-hooks
title: React Hooks ่ฏฆ่งฃ
sidebar_label: React Hooks
sidebar_position: 5
description: React Hooks ไฝฟ็จๆๅๅๆไฝณๅฎ่ทต
tags:
- react
- hooks
- frontend
last_update:
date: '2026-03-21'
author: halcyon666
---
Adding English Translation
Target: i18n/en/docusaurus-plugin-content-docs/current/Frontend/react-hooks.mdx
---
id: react-hooks
title: React Hooks Guide
sidebar_label: React Hooks
sidebar_position: 5
description: React Hooks usage guide and best practices
tags:
- react
- hooks
- frontend
last_update:
date: '2026-03-21'
author: halcyon666
---
Common Pitfalls
| Issue | Solution |
|---|
| Wrong directory for language | Check docusaurus.config.ts for defaultLocale |
Missing _category_.json | Create it with label, position, link fields |
| ID mismatch between languages | Use identical id in all translations |
| Sidebar position conflict | Check existing files, use next available number |
Using .md instead of .mdx | Use .mdx for JSX component support |
YAML frontmatter breaks on : in title | Quote title, sidebar_label, and description |
| Self-links to headings break | Add explicit heading IDs like {#anchor-name} |
| Emoji/Chinese headings generate unstable anchor slugs | Do not rely on auto-generated heading slugs when linking internally |
Validation
After writing, verify:
Required post-write check
After creating or editing docs, validate the target project before finishing:
- Read
docusaurus.config.* first to confirm locale and docs structure.
- Run a local validation command in the target project:
- Prefer
pnpm build
- If build is too heavy for the task, at least run
pnpm start and confirm MDX compilation succeeds
- If the newly written doc causes a compile error, fix it before reporting completion.
- Mention any remaining warnings separately from hard errors.