After the development cycle is complete, extract the patterns, pitfalls, and key decisions from this development effort, and precipitate them into reusable structured knowledge.
Language Rules
- Support questions in Chinese and English
- Unified Chinese replies
- Generate documents in Chinese
Positioning
devdocs-sync:同步文档状态、追溯矩阵 → 文档层面的完成
devdocs-compound:提取经验、沉淀模式 → 知识层面的复利
Complementary Relationship: devdocs-sync ensures "this time it was done right," while this Skill ensures "next time it can also be done right."
Trigger Conditions
- After devdocs-sync is complete (recommended)
- After a round of development iteration ends
- The user proactively requests extraction of lessons learned
- A pattern or pitfall worth recording is discovered
Run Mode
/devdocs-compound → 完整流程(提取 + 写入 + 更新)
/devdocs-compound --extract-only → 仅提取,不写入文件(预览模式)
/devdocs-compound --check → 系统学习检查(仅评估是否有未沉淀的经验)
Workflow
1. 回顾本次开发
├── 读取 verify-report.md(若存在)
├── 读取 04-dev-tasks*.md 了解完成的任务
├── 读取 git log 了解提交历史
└── 回顾对话中的关键决策点
│
▼
2. 提取候选模式
├── 有效的解决方案(正面模式)
├── 踩过的坑和修复方式(陷阱)
├── 关键技术决策及其理由(决策记录)
└── 可复用的代码模式或架构模式
│
▼
3. 去重检查
├── 扫描 docs/devdocs/patterns/ 已有模式
└── 跳过已存在的相似模式,或标记为"更新"
│
▼
4. 与用户确认
├── 展示提取的候选模式列表
└── 用户选择:写入 / 跳过 / 修改
│
▼
5. 写入模式文档
├── 新模式 → 创建 docs/devdocs/patterns/<pattern-name>.md
└── 已有模式更新 → 编辑现有文件
│
▼
6. 建议运行 `/agent-memory` 更新 AGENTS.md(可选)
├── 项目特定知识更新
└── 仅当模式具有项目级影响时
│
▼
7. 系统学习检查
├── 本次遇到的问题是否已沉淀为规则/模板/检查器?
├── 若没有,原因是什么?
└── 输出检查结论
Pattern Extraction Guide
What Is Worth Extracting
| Type | Signal | Example |
|---|---|---|
| Positive Pattern | Solved a recurring problem | "Use the Strategy pattern to decouple payment channels" |
| Pitfall | Was fixed after hitting the pitfall, and may be encountered again | "SQLite requires WAL mode for concurrent writes" |
| Decision | Has clear trade-offs, and the rationale is not obvious | "Choose SSR over SPA because of SEO requirements" |
| Workflow | A more efficient development process was discovered | "Writing integration tests first and then splitting them into unit tests is more efficient" |
What Is Not Worth Extracting
- Project-specific and non-reusable details
- Obvious best practices (such as "write tests")
- Temporary workarounds (unless marked as temporary)
- Rules already covered in AGENTS.md or SKILL.md
Pattern Document Structure
Each pattern document follows a unified structure, see templates/pattern.md。
File Naming:docs/devdocs/patterns/<kebab-case-pattern-name>.md
Systematic Learning Check
Each time /devdocs-compound is executed, the following check questions must be answered:
Checklist
-
Rule Check: Has the problem encountered this time already been precipitated as a rule (constraint/check item)?
- If yes → record in which SKILL.md or AGENTS.md
- If no → should it be precipitated? Reason?
-
Template Check: Should the solution from this time be updated into a template?
- If yes → mark the target template file
- If no → reason?
-
Checker Check: Can the verification logic from this time be automated into a check step?
- If yes → mark the constraints section of the target Skill
- If no → reason?
Check Output Format
## 系统学习检查
| 维度 | 已沉淀? | 目标位置 | 备注 |
|------|---------|----------|------|
| 规则 | ✅/❌ | <文件路径> | <说明> |
| 模板 | ✅/❌ | <文件路径> | <说明> |
| 检查器 | ✅/❌ | <文件路径> | <说明> |
**未沉淀原因**:<若有未沉淀项,说明原因>
Output Files
- Pattern document:
docs/devdocs/patterns/<pattern-name>.md - Systematic learning check conclusion: output to the conversation (do not generate a separate file)
Constraints
Extraction Constraints
- Must review verify-report and task documents
- Must confirm with the user before writing(
--extract-onlypreview only) - Must check existing patterns to avoid duplication
- pattern documents follow the template structure
- file names use kebab-case
Quality Constraints
- The pattern must include "Problem Background" and "Solution Approach"(both are required)
- Must include "Applicable Conditions" and "Prohibited Conditions"(to prevent misuse)
- The pattern description is specific and actionable, avoiding vague generalities
- Associated Skill/template fields help the Agent discover and reuse it
Systematic Learning Constraints
- A systematic learning check must be completed on every execution
- The check conclusion must address three dimensions (rules/templates/checkers)
- Any item not captured must have its reason explained
Security Constraints
- Do not modify code files
- Do not modify existing DevDocs documents(only create/update patterns/)
- Do not directly modify AGENTS.md; when an update is needed, suggest the user run
/agent-memory
Skill Collaboration
| Scenario | Collaborating Skill | Description |
|---|---|---|
| Prerequisite | /devdocs-sync |
Execute compound after sync is complete |
| Prerequisite | /devdocs-verify |
Read the verification report to extract improvement patterns |
| Prerequisite | /devdocs-dev-workflow |
Recommended for execution at the end of the workflow (default in batch mode) |
| Knowledge Update | /agent-memory |
Can be used together during large-scale knowledge updates |
Sub-Agent Summary Format
When this Skill runs as a sub-Agent, return the following structured summary:
skill: devdocs-compound
patterns_extracted: 2
patterns_updated: 1
patterns_skipped: 0 # 已存在的相似模式
system_learning:
rules_gap: false
template_gap: true
checker_gap: false
status: completed
output_files:
- docs/devdocs/patterns/strategy-payment-channels.md
- docs/devdocs/patterns/sqlite-wal-concurrency.md
Next Steps
| Result | Suggested Next Step |
|---|---|
| New patterns extracted | Refer to them in the next related development docs/devdocs/patterns/ |
| Rule gap found | Update the constraints section of the corresponding SKILL.md |
| Template gap found | Update the corresponding templates/ file |
| No new knowledge | Normal, not every iteration has new patterns |