create-docs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate Docs
创建文档
Generate a complete, production-ready documentation site for any project.
为任意项目生成完整的、可用于生产环境的文档站点。
Workflow
工作流程
- Analyze - Detect package manager, monorepo structure, read context
- Initialize - Create docs directory with correct setup
- Generate - Write documentation pages using templates
- Configure - Set up AI integration (MCP, llms.txt)
- Finalize - Provide next steps with correct commands
- 分析 - 检测包管理器、单仓结构、读取上下文
- 初始化 - 创建带有正确配置的docs目录
- 生成 - 使用模板编写文档页面
- 配置 - 设置AI集成(MCP、llms.txt)
- 收尾 - 提供带有正确命令的后续步骤
Package Manager Reference
包管理器参考
Detect from lock files, default to npm if none found:
| Lock File | PM | Install | Run | Add |
|---|---|---|---|---|
| pnpm | | | |
| npm | | | |
| yarn | | | |
| bun | | | |
Use as placeholder in commands below.
[pm]从锁文件检测,若未检测到则默认使用npm:
| 锁文件 | 包管理器 | 安装命令 | 运行命令 | 添加依赖命令 |
|---|---|---|---|---|
| pnpm | | | |
| npm | | | |
| yarn | | | |
| bun | | | |
使用作为下方命令中的占位符。
[pm]Step 1: Analyze Project
步骤1:分析项目
Detect Project Structure
检测项目结构
Check for:
├── pnpm-workspace.yaml → pnpm monorepo
├── turbo.json → Turborepo monorepo
├── lerna.json → Lerna monorepo
├── nx.json → Nx monorepo
├── apps/ → Apps directory (monorepo)
├── packages/ → Packages directory (monorepo)
├── docs/ → Existing docs (avoid overwriting)
├── README.md → Main documentation source
└── src/ or lib/ → Source code location检查以下内容:
├── pnpm-workspace.yaml → pnpm单仓
├── turbo.json → Turborepo单仓
├── lerna.json → Lerna单仓
├── nx.json → Nx单仓
├── apps/ → 应用目录(单仓)
├── packages/ → 包目录(单仓)
├── docs/ → 已存在的文档(避免覆盖)
├── README.md → 主文档源
└── src/ 或 lib/ → 源码位置Determine Docs Location
确定文档位置
| Project Type | Target Directory | Workspace Entry |
|---|---|---|
| Standard project | | N/A |
Monorepo with | | |
Monorepo with | | |
Existing | Ask user or | — |
| 项目类型 | 目标目录 | 工作区入口 |
|---|---|---|
| 标准项目 | | N/A |
带有 | | |
带有 | | |
已存在 | 询问用户或使用 | — |
Read Context Files
读取上下文文件
| File | Extract |
|---|---|
| Project name, description, features, usage examples |
| Name, description, dependencies, repository URL |
| Exported functions, composables for API docs |
| 文件 | 提取内容 |
|---|---|
| 项目名称、描述、特性、使用示例 |
| 名称、描述、依赖、仓库URL |
| 导出的函数、组合式函数(用于API文档) |
Detect i18n Requirement
检测国际化需求
Check if project needs multi-language docs:
| Indicator | Action |
|---|---|
| Use i18n template |
| Use i18n template |
| Multiple language README files | Use i18n template |
| User explicitly mentions multiple languages | Use i18n template |
| None of the above | Use default template |
检查项目是否需要多语言文档:
| 标识 | 操作 |
|---|---|
依赖中包含 | 使用国际化模板 |
存在 | 使用国际化模板 |
| 存在多语言README文件 | 使用国际化模板 |
| 用户明确提及多语言 | 使用国际化模板 |
| 以上均不满足 | 使用默认模板 |
Step 2: Initialize Docs
步骤2:初始化文档
Create Directory Structure
创建目录结构
Default template:
[docs-location]/
├── app/ # Optional: for customization
│ ├── app.config.ts
│ ├── components/
│ ├── layouts/
│ └── pages/
├── content/
│ ├── index.md
│ └── 1.getting-started/
│ ├── .navigation.yml
│ └── 1.introduction.md
├── public/
│ └── favicon.ico
├── package.json
└── .gitignorei18n template (if multi-language detected):
[docs-location]/
├── app/
│ └── app.config.ts
├── content/
│ ├── en/
│ │ ├── index.md
│ │ └── 1.getting-started/
│ │ ├── .navigation.yml
│ │ └── 1.introduction.md
│ └── fr/ # Or other detected languages
│ ├── index.md
│ └── 1.getting-started/
│ ├── .navigation.yml
│ └── 1.introduction.md
├── nuxt.config.ts # Required for i18n config
├── public/
│ └── favicon.ico
├── package.json
└── .gitignore默认模板:
[docs-location]/
├── app/ # 可选:用于自定义
│ ├── app.config.ts
│ ├── components/
│ ├── layouts/
│ └── pages/
├── content/
│ ├── index.md
│ └── 1.getting-started/
│ ├── .navigation.yml
│ └── 1.introduction.md
├── public/
│ └── favicon.ico
├── package.json
└── .gitignore国际化模板(若检测到多语言需求):
[docs-location]/
├── app/
│ └── app.config.ts
├── content/
│ ├── en/
│ │ ├── index.md
│ │ └── 1.getting-started/
│ │ ├── .navigation.yml
│ │ └── 1.introduction.md
│ └── fr/ # 或其他检测到的语言
│ ├── index.md
│ └── 1.getting-started/
│ ├── .navigation.yml
│ └── 1.introduction.md
├── nuxt.config.ts # 国际化配置必需
├── public/
│ └── favicon.ico
├── package.json
└── .gitignoreCreate package.json
创建package.json
Default:
json
{
"name": "[project-name]-docs",
"private": true,
"scripts": {
"dev": "nuxt dev --extends docus",
"build": "nuxt build --extends docus",
"generate": "nuxt generate --extends docus",
"preview": "nuxt preview --extends docus"
},
"dependencies": {
"docus": "latest",
"better-sqlite3": "^12.5.0",
"nuxt": "^4.2.2"
}
}i18n (add ):
@nuxtjs/i18njson
{
"name": "[project-name]-docs",
"private": true,
"scripts": {
"dev": "nuxt dev --extends docus",
"build": "nuxt build --extends docus",
"generate": "nuxt generate --extends docus",
"preview": "nuxt preview --extends docus"
},
"dependencies": {
"@nuxtjs/i18n": "^10.2.1",
"docus": "latest",
"better-sqlite3": "^12.5.0",
"nuxt": "^4.2.2"
}
}默认:
json
{
"name": "[project-name]-docs",
"private": true,
"scripts": {
"dev": "nuxt dev --extends docus",
"build": "nuxt build --extends docus",
"generate": "nuxt generate --extends docus",
"preview": "nuxt preview --extends docus"
},
"dependencies": {
"docus": "latest",
"better-sqlite3": "^12.5.0",
"nuxt": "^4.2.2"
}
}国际化版本(添加):
@nuxtjs/i18njson
{
"name": "[project-name]-docs",
"private": true,
"scripts": {
"dev": "nuxt dev --extends docus",
"build": "nuxt build --extends docus",
"generate": "nuxt generate --extends docus",
"preview": "nuxt preview --extends docus"
},
"dependencies": {
"@nuxtjs/i18n": "^10.2.1",
"docus": "latest",
"better-sqlite3": "^12.5.0",
"nuxt": "^4.2.2"
}
}Create nuxt.config.ts (i18n only)
创建nuxt.config.ts(仅国际化版本需要)
ts
export default defineNuxtConfig({
modules: ['@nuxtjs/i18n'],
i18n: {
locales: [
{ code: 'en', language: 'en-US', name: 'English' },
{ code: 'fr', language: 'fr-FR', name: 'Français' }
],
defaultLocale: 'en'
}
})ts
export default defineNuxtConfig({
modules: ['@nuxtjs/i18n'],
i18n: {
locales: [
{ code: 'en', language: 'en-US', name: 'English' },
{ code: 'fr', language: 'fr-FR', name: 'Français' }
],
defaultLocale: 'en'
}
})Create .gitignore
创建.gitignore
node_modules
.nuxt
.output
.data
distnode_modules
.nuxt
.output
.data
distUpdate Monorepo Configuration (if applicable)
更新单仓配置(若适用)
pnpm Monorepo
pnpm单仓
- Add docs to workspace and configure (required for better-sqlite3):
onlyBuiltDependencies
yaml
packages:
- 'apps/*'
- 'docs'
onlyBuiltDependencies:
- better-sqlite3- Add dev script to root package.json:
json
{
"scripts": {
"docs:dev": "pnpm run --filter [docs-package-name] dev"
}
}Or with directory path:
json
{
"scripts": {
"docs:dev": "cd docs && pnpm dev"
}
}- 将文档添加到工作区并配置(better-sqlite3必需):
onlyBuiltDependencies
yaml
packages:
- 'apps/*'
- 'docs'
onlyBuiltDependencies:
- better-sqlite3- 为根package.json添加开发脚本:
json
{
"scripts": {
"docs:dev": "pnpm run --filter [docs-package-name] dev"
}
}或使用目录路径:
json
{
"scripts": {
"docs:dev": "cd docs && pnpm dev"
}
}npm/yarn Monorepo
npm/yarn单仓
json
{
"workspaces": ["apps/*", "docs"],
"scripts": {
"docs:dev": "npm run dev --workspace=docs"
}
}json
{
"workspaces": ["apps/*", "docs"],
"scripts": {
"docs:dev": "npm run dev --workspace=docs"
}
}Step 3: Generate Documentation
步骤3:生成文档
Use templates from references/templates.md.
CRITICAL: MDC Component Naming
All Nuxt UI components in MDC must use the prefix:
u-| Correct | Wrong |
|---|---|
| |
| |
| |
| |
| |
Without the prefix, Vue will fail to resolve the components.
u-使用references/templates.md中的模板。
关键:MDC组件命名规则
MDC中的所有Nuxt UI组件必须使用前缀:
u-| 正确写法 | 错误写法 |
|---|---|
| |
| |
| |
| |
| |
如果不使用前缀,Vue将无法解析组件。
u-Documentation Structure
文档结构
content/
├── index.md # Landing page
├── 1.getting-started/
│ ├── .navigation.yml
│ ├── 1.introduction.md
│ └── 2.installation.md
├── 2.guide/
│ ├── .navigation.yml
│ ├── 1.configuration.md
│ ├── 2.authentication.md
│ └── 3.deployment.md
└── 3.api/ # If applicable
├── .navigation.yml
└── 1.reference.mdcontent/
├── index.md # 首页
├── 1.getting-started/
│ ├── .navigation.yml
│ ├── 1.introduction.md
│ └── 2.installation.md
├── 2.guide/
│ ├── .navigation.yml
│ ├── 1.configuration.md
│ ├── 2.authentication.md
│ └── 3.deployment.md
└── 3.api/ # 若适用
├── .navigation.yml
└── 1.reference.mdGenerate Pages
生成页面
- Landing page () - Hero + features grid
index.md - Introduction - What & why, use cases
- Installation - Prerequisites, install commands
- Guide pages - Feature documentation with action-based H2 headings
For writing style, see references/writing-guide.md.
For MDC components, see references/mdc-components.md.
- 首页()- 英雄区 + 特性网格
index.md - 介绍 - 是什么/为什么、使用场景
- 安装 - 前置要求、安装命令
- 指南页面 - 特性文档,使用基于动作的H2标题
写作风格请参考references/writing-guide.md。
MDC组件请参考references/mdc-components.md。
Step 4: Configure AI Integration
步骤4:配置AI集成
Docus automatically includes MCP server () and llms.txt generation. No configuration needed.
/mcpDo NOT add AI Integration sections to the landing page. These features work automatically.
Optionally mention in the introduction page:
markdown
::note
This documentation includes AI integration with MCP server and automatic `llms.txt` generation.
::Docus自动包含MCP服务器()和llms.txt生成功能,无需额外配置。
/mcp请勿在首页添加AI集成相关章节。 这些功能会自动生效。
可选择在介绍页面中提及:
markdown
::note
本文档包含与MCP服务器的AI集成以及自动生成`llms.txt`功能。
::Optional: app.config.ts
可选:app.config.ts
ts
export default defineAppConfig({
docus: {
name: '[Project Name]',
description: '[Project description]',
url: 'https://[docs-url]',
socials: {
github: '[org]/[repo]'
}
}
})ts
export default defineAppConfig({
docus: {
name: '[Project Name]',
description: '[Project description]',
url: 'https://[docs-url]',
socials: {
github: '[org]/[repo]'
}
}
})Optional: Theme Customization
可选:主题自定义
If the project has a design system or brand colors, customize the docs theme.
如果项目有设计系统或品牌色,可自定义文档主题。
Custom CSS
自定义CSS
Create :
app/assets/css/main.csscss
@import "tailwindcss";
@import "@nuxt/ui";
@theme static {
/* Custom font */
--font-sans: 'Inter', sans-serif;
/* Custom container width */
--ui-container: 90rem;
/* Custom primary color (use project brand color) */
--color-primary-50: oklch(0.97 0.02 250);
--color-primary-500: oklch(0.55 0.2 250);
--color-primary-900: oklch(0.25 0.1 250);
}创建:
app/assets/css/main.csscss
@import "tailwindcss";
@import "@nuxt/ui";
@theme static {
/* 自定义字体 */
--font-sans: 'Inter', sans-serif;
/* 自定义容器宽度 */
--ui-container: 90rem;
/* 自定义主色调(使用项目品牌色) */
--color-primary-50: oklch(0.97 0.02 250);
--color-primary-500: oklch(0.55 0.2 250);
--color-primary-900: oklch(0.25 0.1 250);
}Extended app.config.ts
扩展app.config.ts
ts
export default defineAppConfig({
docus: {
name: '[Project Name]',
description: '[Project description]',
url: 'https://[docs-url]',
socials: {
github: '[org]/[repo]',
x: '@[handle]'
}
},
// Customize UI components
ui: {
colors: {
primary: 'emerald',
neutral: 'zinc',
},
pageHero: {
slots: {
title: 'font-semibold sm:text-6xl'
}
}
}
})ts
export default defineAppConfig({
docus: {
name: '[Project Name]',
description: '[Project description]',
url: 'https://[docs-url]',
socials: {
github: '[org]/[repo]',
x: '@[handle]'
}
},
// 自定义UI组件
ui: {
colors: {
primary: 'emerald',
neutral: 'zinc',
},
pageHero: {
slots: {
title: 'font-semibold sm:text-6xl'
}
}
}
})Step 5: Finalize
步骤5:收尾
Provide instructions using detected package manager.
使用检测到的包管理器提供操作说明。
Standard Project
标准项目
Documentation created in [docs-location]
To start:
cd [docs-location]
[pm] install
[pm] run dev
Available at http://localhost:3000文档已创建在[docs-location]
启动方式:
cd [docs-location]
[pm] install
[pm] run dev
访问地址:http://localhost:3000Monorepo
单仓项目
Documentation created in [docs-location]
To start from root:
[pm] install
[pm] run docs:dev
Or from docs directory:
cd [docs-location]
[pm] run dev
Available at http://localhost:3000文档已创建在[docs-location]
从根目录启动:
[pm] install
[pm] run docs:dev
或从文档目录启动:
cd [docs-location]
[pm] run dev
访问地址:http://localhost:3000Features Included
包含的特性
- Full-text search
- Dark mode
- MCP server for AI tools (/mcp)
- LLM integration (/llms.txt)
- SEO optimized
- 全文搜索
- 深色模式
- 用于AI工具的MCP服务器(/mcp)
- LLM集成(/llms.txt)
- SEO优化
Next Steps
后续步骤
- Review generated content
- Add more guides in
content/2.guide/ - Customize theme in
app.config.ts - Deploy to Vercel/Netlify/Cloudflare
- 审核生成的内容
- 在中添加更多指南
content/2.guide/ - 在中自定义主题
app.config.ts - 部署到Vercel/Netlify/Cloudflare
Suggest Follow-ups
建议的后续优化
After documentation is created, suggest enhancements:
Your documentation is ready!
Would you like me to:
- **Customize the UI** - Match your brand colors and style
- **Enhance the landing page** - Add feature cards, code previews, visuals
- **Add i18n support** - Multi-language documentation
- **Set up deployment** - Deploy to Vercel, Netlify, or Cloudflare
Let me know what you'd like to improve!文档创建完成后,可建议以下增强项:
您的文档已准备就绪!
是否需要我帮您:
- **自定义UI** - 匹配您的品牌色和风格
- **优化首页** - 添加特性卡片、代码预览、视觉元素
- **添加国际化支持** - 多语言文档
- **配置部署** - 部署到Vercel、Netlify或Cloudflare
请告知您想要优化的内容!Deployment
部署
| Platform | Command | Output |
|---|---|---|
| Vercel | | Auto-detected |
| Netlify | | |
| Cloudflare Pages | | |
| GitHub Pages | | |
| 平台 | 命令 | 输出目录 |
|---|---|---|
| Vercel | | 自动检测 |
| Netlify | | |
| Cloudflare Pages | | |
| GitHub Pages | | |
Example: auth-utils
示例:auth-utils
Detected: pnpm monorepo, package in packages/
Generated structure:
docs/
├── content/
│ ├── index.md
│ ├── 1.getting-started/
│ │ ├── .navigation.yml
│ │ ├── 1.introduction.md
│ │ └── 2.installation.md
│ ├── 2.guide/
│ │ ├── .navigation.yml
│ │ ├── 1.authentication.md
│ │ ├── 2.oauth-providers.md
│ │ └── 3.sessions.md
│ └── 3.api/
│ ├── .navigation.yml
│ └── 1.composables.md
├── public/
│ └── favicon.ico
├── package.json
└── .gitignoreInside (action-based H2 headings):
authentication.mdmarkdown
undefined检测结果: pnpm单仓,包位于packages/目录
生成的结构:
docs/
├── content/
│ ├── index.md
│ ├── 1.getting-started/
│ │ ├── .navigation.yml
│ │ ├── 1.introduction.md
│ │ └── 2.installation.md
│ ├── 2.guide/
│ │ ├── .navigation.yml
│ │ ├── 1.authentication.md
│ │ ├── 2.oauth-providers.md
│ │ └── 3.sessions.md
│ └── 3.api/
│ ├── .navigation.yml
│ └── 1.composables.md
├── public/
│ └── favicon.ico
├── package.json
└── .gitignoreauthentication.mdmarkdown
undefinedAdd basic authentication
添加基础认证
Protect your routes
保护您的路由
Handle login redirects
处理登录重定向
Customize the session
自定义会话
undefinedundefined