compound-knowledge
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCompound knowledge
知识沉淀
Capture a solved problem as searchable documentation so nobody solves it twice. Adapted from EveryInc's compound-engineering plugin (https://github.com/EveryInc/compound-engineering-plugin).
Problem to document: $ARGUMENTS
If that is empty, document the most recently solved problem in this conversation. If nothing was actually fixed and verified, stop and say so; do not document a guess.
Exactly ONE file gets written: the final solution doc. Subagents return text only.
将已解决的问题记录为可搜索的文档,避免任何人重复解决同一问题。改编自 EveryInc 的 compound-engineering plugin(https://github.com/EveryInc/compound-engineering-plugin)。
要记录的问题:$ARGUMENTS
如果为空,则记录当前对话中最近解决的一个问题。如果实际上没有修复并验证任何内容,请停止并说明;不要记录猜测。
只会写入一个文件:最终解决方案文档。 Subagent 仅返回文本。
Convention (per project)
项目约定
docs/solutions/Categories (subdirectories of ):
docs/solutions/build-errorstest-failuresruntime-errorsperformance-issuesdatabase-issuessecurity-issuesui-bugsintegration-issueslogic-errors
Filename:
Example:
docs/solutions/<category>/YYYY-MM-DD-<kebab-description>.mddocs/solutions/runtime-errors/2026-02-13-null-pointer-in-auth-middleware.mdFile format: references/solution-template.md.
项目根目录下的 是知识库。insist 的 learnings researcher 会在规划期间使用 grep 检索该目录,因此请严格保持下列路径、frontmatter 和 tags 格式。
docs/solutions/类别( 的子目录):
docs/solutions/build-errorstest-failuresruntime-errorsperformance-issuesdatabase-issuessecurity-issuesui-bugsintegration-issueslogic-errors
文件名:
示例:
docs/solutions/<category>/YYYY-MM-DD-<kebab-description>.mddocs/solutions/runtime-errors/2026-02-13-null-pointer-in-auth-middleware.md文件格式:references/solution-template.md。
Phase 1: parallel gathering (3 read-only subagents)
阶段 1:并行收集(3 个只读 subagent)
Spawn the three in one message so they run in parallel (Claude Code: Agent tool, general-purpose type). Give each the problem summary, the relevant conversation excerpts (error messages, commands, diffs) and the files touched; they have no conversation history. Each returns structured text and writes nothing. No subagent support in this harness: do the three analyses yourself, in order.
在一条消息中同时启动这三个 subagent,使其并行运行(Claude Code:Agent 工具,general-purpose 类型)。向每个 subagent 提供问题摘要、相关对话片段(错误消息、命令、diff)以及涉及的文件;它们没有对话历史。每个 subagent 返回结构化文本,不写入任何内容。此 harness 不支持 subagent:改为依次自行完成这三项分析。
1a. Context analyzer
1a. 上下文分析器
Extract from the conversation and codebase:
- Problem type: best-fitting category from the list above
- Affected area: files, modules, systems
- Severity: low / medium / high / critical
- How detected: test failure, user report, monitoring alert, etc.
- Impact: what was broken or degraded
从对话和代码库中提取:
- 问题类型:上述列表中最匹配的类别
- 受影响区域:文件、模块、系统
- 严重程度:low / medium / high / critical
- 检测方式:测试失败、用户报告、监控告警等
- 影响:出现了哪些故障或功能退化
1b. Solution extractor
1b. 解决方案提取器
Extract from the conversation and code changes:
- Root cause: why it happened (1-2 paragraphs)
- Code references: files and lines involved
- What fixed it: the actual changes (before/after snippets)
- Key insight: the non-obvious realization that led to the fix
从对话和代码变更中提取:
- 根因:问题发生的原因(1~2 个段落)
- 代码引用:涉及的文件和行号
- 修复内容:实际所做的变更(修改前/后的代码片段)
- 关键洞察:促成修复的非显而易见认识
1c. Prevention strategist
1c. 预防策略师
Determine from the problem and solution:
- Prevent recurrence: practices, checks, guards
- Tests to add: cases that would catch it next time
- Monitoring: alerts or checks that should exist
- Related patterns: similar problems that may exist elsewhere
根据问题和解决方案确定:
- 防止再次发生:实践、检查项和保护措施
- 需要添加的测试:下次能够捕获该问题的测试用例
- 监控:应设置的告警或检查
- 相关模式:代码库中可能存在的类似问题
Phase 2: assembly (you, sequential)
阶段 2:组装(由你顺序执行)
- Read references/solution-template.md.
- Take the category from the context analyzer. Ambiguous between two categories → ask the user.
- Grep for the key error string and symptom. A doc with the same root cause exists → update that file (refine sections, add to Related) instead of creating a duplicate.
docs/solutions/ - Otherwise name the file with today's date and create
YYYY-MM-DD-<kebab-description>.mdif missing.docs/solutions/<category>/ - Write the single file: every frontmatter field and every section filled from the subagent outputs. Tags carry the searchable keywords (error names, libraries, symptoms). unless the fix was verified by a test or reproduction in this session, then
status: draft.validated
This is the only file write in the skill.
- 阅读 references/solution-template.md。
- 采用上下文分析器给出的类别。如果在两个类别之间存在歧义,则询问用户。
- 使用 grep 在 中检索关键错误字符串和症状。如果已有根因相同的文档,则更新该文件(完善相关章节并将其添加到 Related),而不是创建重复文档。
docs/solutions/ - 否则,使用今天的日期将文件命名为 ,并在缺失时创建
YYYY-MM-DD-<kebab-description>.md。docs/solutions/<category>/ - 写入唯一的文件:根据 subagent 输出填写每个 frontmatter 字段和每个章节。Tags 应包含可搜索关键词(错误名称、库、症状)。除非本次会话已通过测试或复现验证修复,否则使用 ;验证通过则使用
status: draft。validated
这是该 skill 中唯一一次文件写入。
Phase 3: optional follow-up
阶段 3:可选的后续操作
After writing, offer one follow-up by category and proceed only if the user confirms:
- : check whether the fix needs broader application.
security-issues - : verify the improvement with a benchmark.
performance-issues - /
build-errors: run the test suite to confirm the fix holds.test-failures - Other categories: search the codebase for the same pattern elsewhere.
写入后,根据类别提供一项后续操作,并且仅在用户确认后执行:
- :检查该修复是否需要更广泛地应用。
security-issues - :使用 benchmark 验证改进效果。
performance-issues - /
build-errors:运行测试套件,确认修复仍然有效。test-failures - 其他类别:在代码库中搜索其他地方是否存在相同模式。
Rules
规则
- Subagents return TEXT only; they never write files.
- One file per solved problem, always in the template format.
- Ground every claim in the conversation or the code; mark anything unverified as such in the doc.
- No secrets, tokens or personal data in the doc: redact them from logs and snippets.
- Subagent 仅返回文本,绝不写入文件。
- 每个已解决问题只对应一个文件,并且始终使用模板格式。
- 每项结论都必须以对话或代码为依据;对于未经验证的内容,请在文档中明确标注。
- 文档中不得包含 secret、token 或个人数据:从日志和代码片段中将其脱敏。