After a development cycle is completed, extract the patterns, pitfalls, and key decisions from this development and consolidate them into reusable structured knowledge.
Quick Start
One Sentence: Extract patterns and lessons learned from a completed development cycle.
Most Common Usage: /compound(full extraction)
Not suitable? Sync docs→/sync, project handover→/onboard
Language Rules
- Supports questions in Chinese and English
- Respond uniformly in Chinese
- Generate documentation in Chinese
Positioning
sync:同步文档状态、追溯矩阵 → 文档层面的完成
compound:提取经验、沉淀模式 → 知识层面的复利
Complementary Relationship: sync ensures "this time it was done right", while this Skill ensures "next time it can also be done right".
Trigger Conditions
- After sync is completed (recommended)
- After a round of development iteration ends
- The user proactively requests extraction of lessons learned
- A pattern or pitfall worth recording is discovered
Operating Modes
/compound → 完整流程(提取 + 写入 + 更新)
/compound --extract-only → 仅提取,不写入文件(预览模式)
/compound --check → 系统学习检查(仅评估是否有未沉淀的经验)
Workflow
1. 回顾本次开发
├── 读取 verify-report.md(若存在)
├── 读取 04-dev-tasks*.md 了解完成的任务
├── 读取 git log 了解提交历史
└── 回顾对话中的关键决策点
│
▼
2. 提取候选模式
├── 有效的解决方案(正面模式)
├── 踩过的坑和修复方式(陷阱)
├── 关键技术决策及其理由(决策记录)
├── 可复用的代码模式或架构模式
└── 验证盲区(verify 未捕捉但后续发现的问题)
│
▼
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 | Involves clear trade-offs, and the rationale is non-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" |
| Verification Blind Spot | Defects not detected by verify but exposed later | "verify --impl did not detect cross-module side effects" |
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
Verification Blind Spot Extraction
Each time /compound is executed, additionally check the effectiveness of the verification process—forming a verify → use → discover omissions → compound consolidation → verify improvement closed loop.
Blind Spot Signals
| Signal | Example |
|---|---|
| verify --impl passes but Bugs are found later | AC-003 is marked as satisfied but the actual boundary conditions are not covered |
| verify --docs passes but the implementation deviates | The design document aligns but the actual implementation took a different path |
| Code quality issues not detected by adversarial verification | Implicit dependency coupling, cross-module side effects |
| readiness passes but insufficient task definition is discovered during development | File paths are specific but key intermediate steps are missing |
Blind Spot Output
When a validation blind spot is discovered, append it to docs/devdocs/patterns/verify-blindspots.md:
## [日期] 盲区描述
- **维度**: --impl / --docs / --readiness / 对抗式验证
- **遗漏内容**: 具体描述 verify 未检出的问题
- **根因**: 为什么当前检查规则无法检出
- **建议检查项**: 未来 verify 应新增的检查逻辑
- **来源**: 本次开发中如何发现的(Bug 报告/上线后反馈/code review)
This file is read at verify startup and supplemented as additional check items. Forms a continuous improvement evaluator tuning loop (reference: evaluation prompts require multiple rounds of iterative tuning).
Systematic Learning Check
Each time /compound is executed, the following check questions must be answered:
Checklist
-
Rule Check: Has the problem encountered this time been codified into a rule (constraint/check item)?
- If yes → Record which SKILL.md or AGENTS.md it is in
- If no → Should it be codified? Reason?
-
Template Check: Should the solution from this time be updated into some template?
- If yes → Mark the target template file
- If no → Reason?
-
Checker Check: Can the validation logic from this time be automated into check steps?
- If yes → Mark the constraint section of the target Skill
- If no → Reason?
-
Validation Blind Spot Check: Was any problem discovered this time that verify failed to detect?
- If yes → Append to
docs/devdocs/patterns/verify-blindspots.md - If no → Record "no new blind spots found"
- If yes → Append to
Check Output Format
## 系统学习检查
| 维度 | 已沉淀? | 目标位置 | 备注 |
|------|---------|----------|------|
| 规则 | ✅/❌ | <文件路径> | <说明> |
| 模板 | ✅/❌ | <文件路径> | <说明> |
| 检查器 | ✅/❌ | <文件路径> | <说明> |
| 验证盲区 | ✅/❌ | docs/devdocs/patterns/verify-blindspots.md | <说明> |
**未沉淀原因**:<若有未沉淀项,说明原因>
Output Files
- Pattern document:
docs/devdocs/patterns/<pattern-name>.md - Systematic learning check conclusion: output to the conversation (no separate file generated)
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
- File names use kebab-case
Quality Constraints
- A pattern must contain "problem background" and "solution approach"(both are indispensable)
- Must contain "applicable conditions" and "prohibited conditions"(to prevent misuse)
- The pattern description must be specific and actionable——if you cannot write something that "can be implemented when applied to another project", it is a summary, not a pattern
- The associated Skill/template field helps the Agent discover and reuse it
Systematic Learning Constraints
- The systematic learning check must be completed on every execution
- The check conclusion must answer four dimensions (rules/templates/checkers/validation blind spots)
- For items not codified, the reason must be stated
- When a validation blind spot is discovered, it must be appended to
docs/devdocs/patterns/verify-blindspots.md
Safety Constraints
- Do not modify code files
- Do not modify existing keel 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 | /sync |
Execute compound after sync is complete |
| Prerequisite | /verify |
Read the validation report to extract improvement patterns |
| Prerequisite | /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: compound
status: success | partial
summary:
headline: "提取 2 个新模式,1 个模板缺口"
details:
patterns_extracted: 2
patterns_updated: 1
patterns_skipped: 0
system_learning:
rules_gap: false
template_gap: true
checker_gap: false
verify_blindspots: 0
blockers: []
output_files:
- docs/devdocs/patterns/strategy-payment-channels.md
- docs/devdocs/patterns/sqlite-wal-concurrency.md
# - docs/devdocs/patterns/verify-blindspots.md # 当 verify_blindspots > 0 时包含
new_ids: {}
next_recommended:
skill: onboard
args: "--update"
Next Steps
| Result | Suggested Next Steps |
|---|---|
| Extracted a new pattern | Refer to it in the next related development docs/devdocs/patterns/ |
| Discovered a rule gap | Update the constraints section of the corresponding SKILL.md |
| Discovered a template gap | Update the corresponding file in templates/ |
| No new knowledge | Normal; not every iteration has a new pattern |