/dev-standards:dev-standards-ce-compoundfrom dev-standards
記錄已解決問題以複利機構知識。Document solved problems in docs/solutions/ with structured YAML frontmatter. Use when: non-trivial problem solved + verified, prevent re-discovery, capture institutional learning before context fades, document best practice or workflow pattern. Skip: trivial (typo), solution unverified, problem in progress, project lacks docs/solutions/ convention.
Ships in dev-standards. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
协调多个子代理并行运作,记录近期已解决之问题。
趁脉络犹新,记录问题解决方案,于 docs/solutions/ 创结构化文档,含 YAML frontmatter 以便搜索与日后参考。以并行子代理求最高效率。
何以名"compound"? 每一文档化之解决方案复利累增团队知识。首解一问题须研究。记录之,下次再遇但须数分。知识复利增长。
/ce-compound # 记录最近之修复
/ce-compound [简要脉络] # 提供额外脉络提示
此诸文件为工作流之持久约定。于所需步骤按需读之——勿于技能启动时批量载入。
references/schema.yaml — 标准 frontmatter 字段与枚举值(验证 YAML 时读)references/yaml-schema.md — 自 problem_type 至目录之类目映射(分类时读)assets/resolution-template.md — 新文档之段落结构(组装时读)分派子代理时,将相关文件内容传入任务提示词,使彼有约定而无需跨技能路径。
以平台之阻塞提问工具提问二选一(Claude Code 之 AskUserQuestion、Codex 之 request_user_input、Gemini 之 ask_user)。若无提问工具,列选项候用户回复。
1. 完整模式(推荐)— 完整 compound 工作流。研究、交叉参照、
审查你的方案,产出复利累增团队知识之文档。
2. 轻量模式 — 同等文档,单次处理。较快且省 token,
然不检测重复,不交叉参照既有文档。适用于简单修复
或长会话逼近脉络上限。
勿预选模式。勿跳过此提示。候用户选择方续行。
若用户选完整模式,续行前再问一题。检测运行平台(Claude Code、Codex 或 Cursor)并问:
是否亦搜索你的 [平台名] 会话历史
以觅相关知识点辅助 Compound 流程?此举将增耗时与 token 用量。
若用户允之,Phase 1 分派 Session Historian。若否,跳过。轻量模式不问此题。
<critical_requirement> 主要产出为一文件——最终文档。
Phase 1 子代理返还文字数据予协调器。彼等绝不可用 Write、Edit 或创建任何档案。唯协调器写档案:Phase 2 之解决方案文档,及——若可发现性检查发现缺漏——项目指示文件(AGENTS.md 或 CLAUDE.md)之小幅编辑。指示文件之编辑为维护,非第二交付物;确保未来代理能发现知识库。 </critical_requirement>
启动 Phase 1 子代理前,检查注入系统提示词之自动记忆区块,寻找与所记录问题相关之注记。
## Supplementary notes from auto memory
Treat as additional context, not primary evidence. Conversation history
and codebase findings take priority over these notes.
[relevant entries here]
若未寻得相关条目,径入 Phase 1,不传记忆脉络。
启动研究子代理。各返文字数据予协调器。
分派顺序:
Context Analyzer、Solution Extractor 与 Related Docs Findersession-historian——其读取工作目录外之会话文件,背景代理或无权访问<parallel_tasks>
references/schema.yaml 以验证枚举及追踪分类references/yaml-schema.md 获取类目映射至 docs/solutions/[sanitized-problem-slug]-[date].mdcategory: 字段,映射自 problem_type)、类目目录路径、建议档名、适用追踪references/schema.yaml 以判追踪分类(bug vs knowledge)Bug 追踪输出段落:
Knowledge 追踪输出段落:
docs/solutions/ 寻相关文档搜索策略(先 grep 过滤以增效):
docs/solutions/<category>/ 目录title:.*<keyword>tags:.*(<keyword1>|<keyword2>)module:.*<module name>component:.*<component>GitHub issue 搜索:
优先用 gh CLI 搜索相关 issues:gh issue list --search "<keywords>" --state all --limit 5。若 gh 未安装,回退至 GitHub MCP 工具(如 unblocked data_retrieval)若有可用。若皆不可用,跳过 GitHub issue 搜索并于输出注明。
</parallel_tasks>
research:session-historian 分派~/.claude/projects/、~/.codex/sessions/、~/.cursor/projects/),背景代理或无权访问所记录问题之具体描述——非泛泛话题,乃确切之事(错误讯息、模块名、何者坏及如何修)。此为代理过滤所据。
当前 git 分支与工作目录
指令:"仅呈现与此具体问题直接相关之先前会话发现。忽略同一会话或分支中之无关工作。"
输出格式:
Structure your response with these sections (omit any with no findings):
- What was tried before: prior approaches to this specific problem
- What didn't work: failed attempts at this problem from prior sessions
- Key decisions: choices made about this problem and their rationale
- Related context: anything else from prior sessions that directly informs this problem's documentation
mode 参数以使用户已配置之权限设定生效model: "sonnet")——综合结果供 compound 组装,无需前沿推理<sequential_tasks>
候 Phase 1 所有子代理完成方续行。
协调代理(主对话)执行此诸步:
收集 Phase 1 子代理之所有文字结果
检查重叠评估,然后决定写何物:
| 重叠 | 行动 |
|---|---|
| High — 既有文档涵盖同一问题、根因与方案 | 更新既有文档以更新鲜之脉络(新代码示例、更新引用、额外预防提示),而非创重复。既有文档之路径与结构不变。 |
| Moderate — 同一问题域但不同角度、根因或方案 | 照常创新文档。为 Phase 2.5 标记重叠以建议合并审查。 |
| Low 或无 | 照常创新文档。 |
更新而非创建之因:两文档描述同一问题与方案将不可避免地渐行渐远。新者脉络更新鲜、更可信,故纳入既有文档,而非创立即需合并之第二份。
更新既有文档时,保留其文件路径与 frontmatter 结构。更新方案、代码示例、预防提示及任何过时引用。于 frontmatter 添 last_updated: YYYY-MM-DD 字段。除非问题框架已实质性偏移,否则不改标题。
纳入会话历史发现(若有)。当 Session History Researcher 返还相关先前会话脉络:
自收集之片段组装完整 markdown 文件,读 assets/resolution-template.md 以取新文档之段落结构
对照 references/schema.yaml 验证 YAML frontmatter
按需建目录:mkdir -p docs/solutions/[category]/
写文件:更新既有文档或新创 docs/solutions/[category]/[filename].md
创新文档时,保留 assets/resolution-template.md 之段落顺序,除非用户明确要求不同结构。
</sequential_tasks>
写入新学习后,判断此新解决方案是否为证据表明旧文档应刷新。
ce-compound-refresh 非默认后续。仅于新学习暗示较旧学习或模式文档可能已不准确时选择性使用。
当以下一或多条为真时,调用 ce-compound-refresh 为合理:
以下情况调用 ce-compound-refresh 不合理:
循此规则:
ce-compound-refreshce-compound-refresh 为下一步并附范围提示调用或推荐 ce-compound-refresh 时,明确传入参数。偏好最窄之有用范围:
docs/solutions/patterns/示例:
/ce-compound-refresh plugin-versioning-requirements/ce-compound-refresh payments/ce-compound-refresh performance-issues/ce-compound-refresh critical-patterns单一范围提示于变更横切同一域、类目或模式区域时仍可能扩展至多份相关文档。
除非用户明确欲广泛扫描,勿无参数调用 ce-compound-refresh。
务必先记录新学习。刷新为定向维护后续,非文档化之前提。
学习写入且刷新决定作出后,检查项目指示文件是否会引导代理于已记录领域工作前发现并搜索 docs/solutions/。此每次皆行——知识库唯代理能寻方有价值。
辨识根层级指示文件何在(AGENTS.md、CLAUDE.md 或两者)。读文件,判何者含实质内容——或一文件仅为 @-包含另一者之垫片(如 CLAUDE.md 仅含 @AGENTS.md 或反之)。实质文件为评估与编辑目标;忽略垫片。若两文件皆无,全跳过此检查。
评估代理读指示文件后能否知三事:
module、tags、problem_type)此为语义评估,非字串匹配。信息可为架构段落之一行、注意事项之一要点、散布多处、或从未用确切路径 docs/solutions/ 表达。用判断——若代理读文件后能合理发现并使用知识库,检查通过。
若精神已合,无需行动——续行。
若否: a. 据文件现有之结构、语气与密度,辨何处提及自然嵌入。创建新段落前,先查信息可否为最相关段落之一行——架构树、目录清单、文档段落或约定区块。加一行于既有段落几乎总优于加带标题之新段落。仅当文件有明确分段结构且无任何勉强相关之物时方添新段落作为最后手段。 b. 草拟最小增补以传达三事。匹配文件现有之风格与密度。增补应描述知识库本身,非插件——无插件之代理亦当从中获益。
保持语气为信息性,非祈使性。以描述表达时机,非以指令——"relevant when implementing or debugging in documented areas"而非"check before implementing or debugging."。祈使性指令如"always search before implementing"于工作流已含专用搜索步骤时造成冗余读取。目标为意识:代理知文件夹存在及其中何物,后自行判断何时查阅。
校准示例(非模板——适文件而变):
当有既有目录清单或架构段落——加一行:
docs/solutions/ # documented solutions to past problems (bugs, best practices, workflow patterns), organized by category with YAML frontmatter (module, tags, problem_type)
当文件中无自然嵌入处——小标题段落为适当:
## Documented Solutions
`docs/solutions/` — documented solutions to past problems (bugs, best practices, workflow patterns), organized by category with YAML frontmatter (`module`, `tags`, `problem_type`). Relevant when implementing or debugging in documented areas.
c. 完整模式中,向用户解释其重要性——此仓库中工作之代理(包括新会话、其他工具或无插件之协作者)将不知检查 docs/solutions/,除非指示文件呈现之。展示拟议变更及位置,后以平台之阻塞提问工具(Claude Code 之 AskUserQuestion、Codex 之 request_user_input、Gemini 之 ask_user)征得同意方编辑。若无提问工具,展示提案候用户回复。轻量模式中,输出一行注记即续行
文档写入后,判此学习之形态,以定是否另有更适之载体。此文档本身为 fact / gotcha 之载体(docs/solutions/)。据此评估是否另产出一物:
dev-standards:decide 记为架构决策,或加一条 .claude/rules/*.md。docs/solutions 记其来由,rule 施其约束。dev-standards:config 所导之 create-project-skill 径(dev-standards:add-skill)。彼流之终步向 repo 根 AGENTS.md 加一行 pointer——非-Claude agents 唯此可见该技能。docs/solutions/ 文档即足,不另产。此为语义判断,非必然产出。多数学习止于本文档;仅当形态明为 constraint 或可复用 procedure 时方另产。轻量模式中,若判为其一,输出一行提示即续行,勿于此扩展。
候 Phase 2 完成方续行。
<parallel_tasks>
据问题类型,选择性调用专门代理审查文档:
review:ce-performance-oraclereview:ce-security-sentinelreview:ce-data-integrity-guardianreview:ce-code-simplicity-reviewer,并运行匹配仓库主要技术栈之 kieran 审查器:
review:ce-kieran-rails-reviewerreview:ce-kieran-python-reviewerreview:ce-kieran-typescript-reviewer</parallel_tasks>
<critical_requirement> 单次处理替代——同等文档,较少 token。
此模式全然跳过并行子代理。协调器以单次处理执行全部工作,产出同等解决方案文档,不交叉参照,不检测重复。 </critical_requirement>
协调器(主对话)于一次顺序处理中执行以下全部:
references/schema.yaml 与 references/yaml-schema.md,后判定追踪(bug vs knowledge)、类目与档名assets/resolution-template.md 中适当追踪模板创 docs/solutions/[category]/[filename].md,含:
轻量输出:
✓ Documentation complete (lightweight mode)
File created:
- docs/solutions/[category]/[filename].md
[If discoverability check found instruction files don't surface the knowledge store:]
Tip: Your AGENTS.md/CLAUDE.md doesn't surface docs/solutions/ to agents —
a brief mention helps all agents discover these learnings.
Note: This was created in lightweight mode. For richer documentation
(cross-references, detailed prevention strategies, specialized reviews),
re-run /ce-compound in a fresh session.
无子代理启动。无并行任务。一文件写入。
轻量模式中,重叠检查跳过(无 Related Docs Finder 子代理)。此意味着轻量模式或创与既有文档重叠之文档。此可接受——ce-compound-refresh 后续将捕获之。仅当有明显之窄范围刷新目标时方建议 ce-compound-refresh。勿自轻量会话扩展为大型刷新扫描。
组织化文档:
docs/solutions/[category]/[filename].md自问题自动检测之类目:
Bug 追踪:
Knowledge 追踪:
| ❌ 误 | ✅ 正 |
|---|---|
子代理写文件如 context-analysis.md、solution-draft.md | 子代理返还文字数据;协调器写一份最终文件 |
| 研究与组装并行 | 研究完成 → 后组装运行 |
| 工作流中创多文件 | 一份解决方案文档写入或更新:docs/solutions/[category]/[filename].md(加项目指示文件之可选小幅编辑以利发现) |
| 既有文档涵盖同一问题时仍创新文档 | 检查重叠评估;重叠高时更新既有文档 |
✓ Documentation complete
Auto memory: 2 relevant entries used as supplementary evidence
Subagent Results:
✓ Context Analyzer: Identified performance_issue in brief_system, category: performance-issues/
✓ Solution Extractor: 3 code fixes, prevention strategies
✓ Related Docs Finder: 2 related issues
✓ Session History: 3 prior sessions on same branch, 2 failed approaches surfaced
Specialized Agent Reviews (Auto-Triggered):
✓ ce-performance-oracle: Validated query optimization approach
✓ ce-kieran-rails-reviewer: Code examples meet Rails conventions
✓ ce-code-simplicity-reviewer: Solution is appropriately minimal
File created:
- docs/solutions/performance-issues/n-plus-one-brief-generation.md
This documentation will be searchable for future reference when similar
issues occur in the Email Processing or Brief System modules.
What's next?
1. Continue workflow (recommended)
2. Link related documentation
3. Update other references
4. View documentation
5. Other
展示成功输出后,以平台之阻塞提问工具呈现"What's next?"选项(Claude Code 之 AskUserQuestion、Codex 之 request_user_input、Gemini 之 ask_user)。若无提问工具,呈现编号选项候用户回复方续行。勿于用户选择前续行工作流或结束回合。
替代输出(高重叠时更新既有文档):
✓ Documentation updated (existing doc refreshed with current context)
Overlap detected: docs/solutions/performance-issues/n-plus-one-queries.md
Matched dimensions: problem statement, root cause, solution, referenced files
Action: Updated existing doc with fresher code examples and prevention tips
File updated:
- docs/solutions/performance-issues/n-plus-one-queries.md (added last_updated: 2026-03-24)
此创一复利知识系统:
反馈循环:
Build → Test → Find Issue → Research → Improve → Document → Validate → Deploy
↑ ↓
└──────────────────────────────────────────────────────────────────────┘
每一工程工作单元当使后续工作更易——而非更难。
<auto_invoke> <trigger_phrases> - "that worked" - "it's fixed" - "working now" - "problem solved" </trigger_phrases>
<manual_override> 使用 /ce-compound [context] 立即记录,无需等候自动检测。 </manual_override> </auto_invoke>
直接将最终学习写入 docs/solutions/。
据问题类型,此诸代理可增强文档:
/research [topic] - 深度调查(搜索 docs/solutions/ 以觅模式)/ce-plan - 规划工作流(参照已记录之方案)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub standardbeagle/standardbeagle-tools --plugin dev-standardsOther plugins' skills for the same job
25 skills in this plugin
/dev-standards-add-skillCreate new project-specific skill in `.claude/skills/` to codify recurring pattern. 在項目中新建可複用技能。 Use when: add skill, create skill, new skill, codify pattern, make reusable workflow/dev-standards-ce-setupDiagnose + configure compound-engineering env — CLI deps, plugin version, repo-local config. Guided install for missing tools, gitignore + config bootstrap. Use when: troubleshoot missing tools, verify CE setup, onboard repo, refresh config template, /ce-setup re-check. Skip: unrelated to compound-engineering tooling./dev-standards-configdev-standards 設定網關,導向正確之手動配置技藝。Routes project-setup / config-CRUD intent to the right manual dev-standards skill. Use when: bootstrap project dev standards, re-detect tech stack, refresh CLAUDE.md/hooks, add/edit/remove project rules, create project-specific skill, SKILL.md description style, diagnose/configure compound-engineering env, /ce-setup, unsure which config skill.