Skip to content

Commit ec52f98

Browse files
committed
feat: add project-wiki skill for generating DeepWiki-style documentation
- SKILL.md: main skill definition with detection logic and workflow - new-project-plan.md: interactive workflow for new projects - existing-code-docs.md: full doc generation for existing code - sync-code-docs.md: incremental update workflow - templates.md: document templates
1 parent 351b39b commit ec52f98

File tree

6 files changed

+1134
-0
lines changed

6 files changed

+1134
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Auto Project Wiki Rule
2+
3+
When the user's task involves project documentation generation or new project initialization, automatically invoke the `/project-wiki` skill to assist.
4+
5+
## Trigger Conditions
6+
7+
Invoke the project-wiki skill when any of the following conditions are met:
8+
9+
1. **Generate Documentation**
10+
- User mentions "generate docs", "create documentation", "build wiki", "document the project"
11+
- Need to generate complete project documentation for existing code
12+
13+
2. **Update Documentation**
14+
- User mentions "update docs", "sync documentation", "refresh wiki", "update the documentation"
15+
- Code has changed and documentation needs to be synchronized
16+
17+
3. **New Project Setup**
18+
- User mentions "new project", "start from scratch", "plan project", "initialize project"
19+
- Need to plan a new project and generate initial documentation
20+
21+
## How to Use
22+
23+
When the above trigger conditions are detected, invoke the skill:
24+
25+
```
26+
/project-wiki
27+
```
28+
29+
The skill will automatically detect the project status and select the appropriate mode (new project planning, full generation, or sync/refresh) to execute.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
name: project-wiki
3+
description: 根据现有代码仓库,递归分析项目结构和代码内容,生成 DeepWiki 风格的完整项目文档。支持三种模式:新项目规划、完整生成、同步/刷新。
4+
arguments:
5+
- name: workspace
6+
description: 项目工作目录的绝对路径
7+
required: false
8+
---
9+
10+
# Project Wiki
11+
12+
根据现有代码仓库,递归分析,**尽可能细致地**理解其项目结构、代码结构、代码内容,帮助用户生成 DeepWiki 风格的完整项目文档。
13+
14+
## Detection Logic
15+
16+
自动检测运行模式,按以下顺序判断:
17+
18+
1. **检查 Git Submodules**
19+
- 检查 `.gitmodules` 文件是否存在
20+
- 如果有则执行 `git submodule update --init --recursive --depth 1`
21+
22+
2. **新项目规划模式**
23+
- 触发条件:项目为空(无源代码文件)
24+
- 触发关键词:"新项目"、"从零开始"、"规划项目"
25+
- 详见 [new-project-plan.md](./new-project-plan.md)
26+
27+
3. **同步/刷新模式**
28+
- 触发条件:存在 `{{workspace}}/.monkeycode/docs/ARCHITECTURE.md`
29+
- 触发关键词:"同步文档"、"更新文档"、"刷新wiki"
30+
- 详见 [sync-code-docs.md](./sync-code-docs.md)
31+
32+
4. **完整生成模式**(默认)
33+
- 触发条件:已有代码但不存在文档结构
34+
- 触发关键词:"生成文档"、"创建文档"、"构建wiki"
35+
- 详见 [existing-code-docs.md](./existing-code-docs.md)
36+
37+
## Workflow
38+
39+
```
40+
1. 检测运行模式
41+
├── 检查 .gitmodules → 拉取 submodules
42+
├── 项目为空? → 新项目规划模式
43+
├── 存在 ARCHITECTURE.md? → 同步模式
44+
└── 否则 → 完整生成模式
45+
46+
2. 执行对应工作流
47+
├── 新项目规划:交互式问答收集需求 → 生成文档
48+
├── 完整生成:分析仓库 → 创建文档结构 → 填充内容
49+
└── 同步/刷新:检测变更 → 增量更新
50+
51+
3. 提交文档
52+
├── git commit
53+
├── git push
54+
└── 向用户确认并收集反馈
55+
```
56+
57+
## Output Structure
58+
59+
生成的文档结构:
60+
61+
```
62+
{{workspace}}/.monkeycode/docs/
63+
├── INDEX.md # 文档索引
64+
├── ARCHITECTURE.md # 系统架构文档
65+
├── INTERFACES.md # 接口文档
66+
├── DEVELOPER_GUIDE.md # 开发者指南
67+
├── 专有概念/ # 核心概念页面
68+
│ ├── [Concept1].md
69+
│ └── [Concept2].md
70+
└── 模块/ # 模块 README
71+
├── [Module1].md
72+
└── [Module2].md
73+
```
74+
75+
## Constraints
76+
77+
**源代码只读**:
78+
- 可以分析仓库中的任何文件
79+
- **绝不**修改源代码文件
80+
- **只能**创建/更新文档文件(Markdown)
81+
- 默认文档位置: `{{workspace}}/.monkeycode/docs/`(如果存在现有约定则遵循)
82+
83+
**禁止臆造**:
84+
- 文档必须严格基于实际代码、配置和测试
85+
- 绝不编造代码中不存在的功能、API或行为
86+
- 无法确定时说"无法确定"而不是猜测
87+
88+
**禁止泄露密钥**:
89+
- 绝不在文档中包含 API 密钥、密码、令牌或凭证
90+
- 在示例中使用占位符如 `<API_KEY>`
91+
92+
## Templates
93+
94+
文档模板参考 [templates.md](./templates.md)
95+
96+
## Notes
97+
98+
- 除非执行「新项目规划」工作流,否则在不与用户交互的前提下完成任务
99+
- 如果 workspace 目录下存在多个子项目(类似 submodule),所有文档输出到 `{{workspace}}/.monkeycode/docs/` 而不是子项目目录
100+
- 完成后向用户确认是否满意,根据反馈迭代完善

0 commit comments

Comments
 (0)