Generate VitePress documentation sites for source code learning and analysis. Use when creating tutorials that explain how a codebase is implemented internally.
Generate VitePress documentation sites for source code learning and analysis.
This skill creates standalone VitePress tutorial sites that teach developers how a codebase works internally. Unlike user documentation that explains "how to use", these tutorials explain "how it's implemented".
/vitepress-tutorial [task-description]
Examples:
/vitepress-tutorial ๅธฎๆ่งฃๆ่ฟไธชไปๅบ็ๆถๆ/vitepress-tutorial explain the agent system in detailpackage.json with Mermaid plugin.vitepress/config.tspnpm-workspace.yaml (if inside another workspace)pnpm installALWAYS use AskUserQuestion to confirm output location AND content language before creating any files.
Use two questions in one AskUserQuestion call:
Question 1: "Where should I create the VitePress tutorial site?"
Options:
- "./docs" (project docs folder)
- "./tutorials/{project-name}" (dedicated tutorials folder)
- Custom path...
Question 2: "What language(s) should the tutorial content be written in? (Max 2)"
multiSelect: true
Options:
- "ไธญๆ (Chinese)" - Content in Chinese, code comments in English
- "English" - Content and code comments in English
- "ๆฅๆฌ่ช (Japanese)" - Content in Japanese, code comments in English
- "ํ๊ตญ์ด (Korean)" - Content in Korean, code comments in English
docs/ with no locale prefix. Set lang in config accordingly./ (default locale)/{locale-code}/ prefixlocales in .vitepress/config.ts with proper labels and nav/sidebar for each localezh-CN (Chinese), en-US (English), ja (Japanese), ko (Korean)When creating inside an existing pnpm workspace, ALWAYS create these files to make it independent:
pnpm-workspace.yaml (in tutorial root):
# Independent workspace - prevents inheriting parent config
packages: []
package.json (MUST include):
{
"name": "{tutorial-name}",
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vitepress dev docs",
"build": "vitepress build docs",
"preview": "vitepress preview docs"
},
"devDependencies": {
"mermaid": "^11.4.0",
"vitepress": "^1.6.3",
"vitepress-plugin-mermaid": "^2.0.17"
},
"pnpm": {
"onlyBuiltDependencies": ["esbuild"]
}
}
docs/.vitepress/config.ts (MUST use withMermaid wrapper):
import { defineConfig } from 'vitepress'
import { withMermaid } from 'vitepress-plugin-mermaid'
export default withMermaid(defineConfig({
// CRITICAL: Fix Mermaid's dayjs ESM compatibility issue
vite: {
optimizeDeps: {
include: ['mermaid', 'dayjs']
}
},
// ... rest of config
mermaid: {
theme: 'default'
}
}))
Why vite.optimizeDeps? Mermaid depends on dayjs which is a CommonJS module. Without this config, Vite dev server will throw "does not provide an export named 'default'" error.
After creating project files, ALWAYS run:
cd {output-path} && pnpm install
{output-path}/
โโโ package.json # With mermaid plugin
โโโ pnpm-workspace.yaml # If inside another workspace
โโโ README.md
โโโ docs/
โโโ .vitepress/
โ โโโ config.ts # With withMermaid wrapper
โโโ index.md # Homepage
โโโ introduction/
โ โโโ overview.md # Project overview
โ โโโ architecture.md # Architecture diagram
โโโ {modules}/ # One directory per module
โโโ index.md
โโโ {topics}.md
{output-path}/
โโโ package.json
โโโ pnpm-workspace.yaml
โโโ README.md
โโโ docs/
โโโ .vitepress/
โ โโโ config.ts # With locales config + withMermaid
โโโ index.md # Default locale homepage
โโโ introduction/ # Default locale content
โ โโโ overview.md
โ โโโ architecture.md
โโโ {modules}/
โ โโโ index.md
โ โโโ {topics}.md
โโโ {locale}/ # e.g. "en" or "zh"
โโโ index.md # Second locale homepage
โโโ introduction/
โ โโโ overview.md
โ โโโ architecture.md
โโโ {modules}/
โโโ index.md
โโโ {topics}.md
Source: path/to/file.go:123 annotations