compound-docs by everyinc/compound-engineering-plugin
npx skills add https://github.com/everyinc/compound-engineering-plugin --skill compound-docs目的: 自动记录已解决的问题,以构建可搜索的机构知识库,并按类别(经过枚举验证的问题类型)进行组织。
此技能在问题确认后立即捕获解决方案,创建结构化文档,作为未来会话的可搜索知识库。
组织方式: 单文件架构 - 每个问题记录为一个 Markdown 文件,存放在其症状类别目录中(例如 docs/solutions/performance-issues/n-plus-one-briefs.md)。文件使用 YAML 前置元数据进行元数据管理和可搜索性。
<critical_sequence name="documentation-capture" enforce_order="strict">
在以下短语后自动触发:
或手动: /doc-fix 命令
仅限非平凡问题:
跳过文档记录的情况:
从对话历史中提取:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
必需信息:
环境详情:
阻塞要求: 如果缺少关键上下文(模块名称、确切错误、阶段或解决步骤),请询问用户并等待回复,然后再继续执行步骤 3:
I need a few details to document this properly:
1. Which module had this issue? [ModuleName]
2. What was the exact error message or symptom?
3. What stage were you in? (0-6 or post-implementation)
[Continue after user provides details]
搜索 docs/solutions/ 查找类似问题:
# Search by error message keywords
grep -r "exact error phrase" docs/solutions/
# Search by symptom category
ls docs/solutions/[category]/
如果找到类似问题:
则呈现决策选项:
Found similar issue: docs/solutions/[path]
What's next?
1. Create new doc with cross-reference (recommended)
2. Update existing doc (only if same root cause)
3. Other
Choose (1-3): _
等待用户响应,然后执行所选操作。
否则(未找到类似问题):
直接继续执行步骤 4(无需用户交互)。
格式:[sanitized-symptom]-[module]-[YYYYMMDD].md
清理规则:
示例:
missing-include-BriefSystem-20251110.mdparameter-not-saving-state-EmailProcessing-20251110.mdwebview-crash-on-resize-Assistant-20251110.md关键: 所有文档都需要经过验证的 YAML 前置元数据,并进行枚举验证。
<validation_gate name="yaml-schema" blocking="true">
根据模式验证: 加载 schema.yaml 并根据 yaml-schema.md 中定义的枚举值对问题进行分类。确保所有必填字段都存在,并且值完全匹配允许的值。
验证失败则阻塞:
❌ YAML validation failed
Errors:
- problem_type: must be one of schema enums, got "compilation_error"
- severity: must be one of [critical, high, medium, low], got "invalid"
- symptoms: must be array with 1-5 items, got string
Please provide corrected values.
关卡强制执行: 在 YAML 前置元数据通过 schema.yaml 中定义的所有验证规则之前,不要继续执行步骤 6(创建文档)。
</validation_gate>
根据 problem_type 确定类别: 使用 yaml-schema.md(第 49-61 行)中定义的类别映射。
创建文档文件:
PROBLEM_TYPE="[from validated YAML]"
CATEGORY="[mapped from problem_type]"
FILENAME="[generated-filename].md"
DOC_PATH="docs/solutions/${CATEGORY}/${FILENAME}"
# Create directory if needed
mkdir -p "docs/solutions/${CATEGORY}"
# Write documentation using template from assets/resolution-template.md
# (Content populated with Step 2 context and validated YAML frontmatter)
结果:
创建文档: 使用步骤 2 中收集的上下文和步骤 5 中已验证的 YAML 前置元数据,填充 assets/resolution-template.md 中的结构。
如果在步骤 3 中找到类似问题:
更新现有文档:
# Add Related Issues link to similar doc
echo "- See also: [$FILENAME]($REAL_FILE)" >> [similar-doc.md]
更新新文档: 已包含来自步骤 6 的交叉引用。
如果适用,更新模式:
如果这代表一个常见模式(3 个以上类似问题):
# Add to docs/solutions/patterns/common-solutions.md
cat >> docs/solutions/patterns/common-solutions.md << 'EOF'
## [Pattern Name]
**Common symptom:** [Description]
**Root cause:** [Technical explanation]
**Solution pattern:** [General approach]
**Examples:**
- [Link to doc 1]
- [Link to doc 2]
- [Link to doc 3]
EOF
关键模式检测(可选主动建议):
如果此问题有自动指示器表明它可能是关键问题:
critical然后在决策菜单(步骤 8)中添加注释:
💡 This might be worth adding to Required Reading (Option 2)
但切勿自动提升。用户通过决策菜单(选项 2)决定。
关键模式添加模板:
当用户选择选项 2(添加到必读)时,使用 assets/critical-pattern-template.md 中的模板来构建模式条目。根据 docs/solutions/patterns/critical-patterns.md 中现有模式的数量进行顺序编号。
</critical_sequence>
<decision_gate name="post-documentation" wait_for_user="true">
成功记录文档后,呈现选项并等待用户响应:
✓ Solution documented
File created:
- docs/solutions/[category]/[filename].md
What's next?
1. Continue workflow (recommended)
2. Add to Required Reading - Promote to critical patterns (critical-patterns.md)
3. Link related issues - Connect to similar problems
4. Add to existing skill - Add to a learning skill (e.g., hotwire-native)
5. Create new skill - Extract into new learning skill
6. View documentation - See what was captured
7. Other
处理响应:
选项 1:继续工作流
选项 2:添加到必读 ⭐ 关键模式的主要路径
用户在以下情况下选择此项:
操作:
docs/solutions/patterns/critical-patterns.md选项 3:链接相关问题
选项 4:添加到现有技能
当记录的解决方案与现有学习技能相关时,用户选择此项:
操作:
示例:对于 Hotwire Native Tailwind 变体解决方案:
hotwire-native/references/resources.md 的 "Project-Specific Resources" 下hotwire-native/references/examples.md,并链接到解决方案文档选项 5:创建新技能
当解决方案代表一个新的学习领域的开始时,用户选择此项:
操作:
python3 .claude/skills/skill-creator/scripts/init_skill.py [skill-name]选项 6:查看文档
选项 7:其他
</decision_gate>
<integration_protocol>
由以下调用:
调用:
交接期望: 文档记录所需的所有上下文应在调用前存在于对话历史中。
</integration_protocol>
<success_criteria>
当所有以下条件都为真时,文档记录成功:
</success_criteria>
缺少上下文:
YAML 验证失败:
类似问题模糊不清:
模块不在模块文档中:
必须执行:
mkdir -p)禁止执行:
好的文档包含:
避免:
用户: "That worked! The N+1 query is fixed."
技能激活:
检测确认: "That worked!" 触发自动调用
收集上下文:
includes(:emails) 进行预加载检查现有: 未找到类似问题
生成文件名: n-plus-one-brief-generation-BriefSystem-20251110.md
验证 YAML:
module: Brief System
date: 2025-11-10
problem_type: performance_issue
component: rails_model
symptoms:
- "N+1 query when loading email threads"
- "Brief generation taking >5 seconds"
root_cause: missing_include
severity: high
tags: [n-plus-one, eager-loading, performance]
✅ 有效
6. 创建文档:
* docs/solutions/performance-issues/n-plus-one-brief-generation-BriefSystem-20251110.md
7. 交叉引用: 不需要(无类似问题)
输出:
✓ Solution documented
File created:
- docs/solutions/performance-issues/n-plus-one-brief-generation-BriefSystem-20251110.md
What's next?
1. Continue workflow (recommended)
2. Add to Required Reading - Promote to critical patterns (critical-patterns.md)
3. Link related issues - Connect to similar problems
4. Add to existing skill - Add to a learning skill (e.g., hotwire-native)
5. Create new skill - Extract into new learning skill
6. View documentation - See what was captured
7. Other
不在第 7 阶段范围内,但有可能:
每周安装量
1.4K
仓库
GitHub 星标
10.9K
首次出现
Jan 20, 2026
安全审计
安装于
opencode1.2K
codex1.2K
gemini-cli1.2K
github-copilot1.2K
amp1.1K
kimi-cli1.1K
Purpose: Automatically document solved problems to build searchable institutional knowledge with category-based organization (enum-validated problem types).
This skill captures problem solutions immediately after confirmation, creating structured documentation that serves as a searchable knowledge base for future sessions.
Organization: Single-file architecture - each problem documented as one markdown file in its symptom category directory (e.g., docs/solutions/performance-issues/n-plus-one-briefs.md). Files use YAML frontmatter for metadata and searchability.
<critical_sequence name="documentation-capture" enforce_order="strict">
Auto-invoke after phrases:
OR manual: /doc-fix command
Non-trivial problems only:
Skip documentation for:
Extract from conversation history:
Required information:
Environment details:
BLOCKING REQUIREMENT: If critical context is missing (module name, exact error, stage, or resolution steps), ask user and WAIT for response before proceeding to Step 3:
I need a few details to document this properly:
1. Which module had this issue? [ModuleName]
2. What was the exact error message or symptom?
3. What stage were you in? (0-6 or post-implementation)
[Continue after user provides details]
Search docs/solutions/ for similar issues:
# Search by error message keywords
grep -r "exact error phrase" docs/solutions/
# Search by symptom category
ls docs/solutions/[category]/
IF similar issue found:
THEN present decision options:
Found similar issue: docs/solutions/[path]
What's next?
1. Create new doc with cross-reference (recommended)
2. Update existing doc (only if same root cause)
3. Other
Choose (1-3): _
WAIT for user response, then execute chosen action.
ELSE (no similar issue found):
Proceed directly to Step 4 (no user interaction needed).
Format: [sanitized-symptom]-[module]-[YYYYMMDD].md
Sanitization rules:
Examples:
missing-include-BriefSystem-20251110.mdparameter-not-saving-state-EmailProcessing-20251110.mdwebview-crash-on-resize-Assistant-20251110.mdCRITICAL: All docs require validated YAML frontmatter with enum validation.
<validation_gate name="yaml-schema" blocking="true">
Validate against schema: Load schema.yaml and classify the problem against the enum values defined in yaml-schema.md. Ensure all required fields are present and match allowed values exactly.
BLOCK if validation fails:
❌ YAML validation failed
Errors:
- problem_type: must be one of schema enums, got "compilation_error"
- severity: must be one of [critical, high, medium, low], got "invalid"
- symptoms: must be array with 1-5 items, got string
Please provide corrected values.
GATE ENFORCEMENT: Do NOT proceed to Step 6 (Create Documentation) until YAML frontmatter passes all validation rules defined in schema.yaml.
</validation_gate>
Determine category from problem_type: Use the category mapping defined in yaml-schema.md (lines 49-61).
Create documentation file:
PROBLEM_TYPE="[from validated YAML]"
CATEGORY="[mapped from problem_type]"
FILENAME="[generated-filename].md"
DOC_PATH="docs/solutions/${CATEGORY}/${FILENAME}"
# Create directory if needed
mkdir -p "docs/solutions/${CATEGORY}"
# Write documentation using template from assets/resolution-template.md
# (Content populated with Step 2 context and validated YAML frontmatter)
Result:
Create documentation: Populate the structure from assets/resolution-template.md with context gathered in Step 2 and validated YAML frontmatter from Step 5.
If similar issues found in Step 3:
Update existing doc:
# Add Related Issues link to similar doc
echo "- See also: [$FILENAME]($REAL_FILE)" >> [similar-doc.md]
Update new doc: Already includes cross-reference from Step 6.
Update patterns if applicable:
If this represents a common pattern (3+ similar issues):
# Add to docs/solutions/patterns/common-solutions.md
cat >> docs/solutions/patterns/common-solutions.md << 'EOF'
## [Pattern Name]
**Common symptom:** [Description]
**Root cause:** [Technical explanation]
**Solution pattern:** [General approach]
**Examples:**
- [Link to doc 1]
- [Link to doc 2]
- [Link to doc 3]
EOF
Critical Pattern Detection (Optional Proactive Suggestion):
If this issue has automatic indicators suggesting it might be critical:
critical in YAMLThen in the decision menu (Step 8), add a note:
💡 This might be worth adding to Required Reading (Option 2)
But NEVER auto-promote. User decides via decision menu (Option 2).
Template for critical pattern addition:
When user selects Option 2 (Add to Required Reading), use the template from assets/critical-pattern-template.md to structure the pattern entry. Number it sequentially based on existing patterns in docs/solutions/patterns/critical-patterns.md.
</critical_sequence>
<decision_gate name="post-documentation" wait_for_user="true">
After successful documentation, present options and WAIT for user response:
✓ Solution documented
File created:
- docs/solutions/[category]/[filename].md
What's next?
1. Continue workflow (recommended)
2. Add to Required Reading - Promote to critical patterns (critical-patterns.md)
3. Link related issues - Connect to similar problems
4. Add to existing skill - Add to a learning skill (e.g., hotwire-native)
5. Create new skill - Extract into new learning skill
6. View documentation - See what was captured
7. Other
Handle responses:
Option 1: Continue workflow
Option 2: Add to Required Reading ⭐ PRIMARY PATH FOR CRITICAL PATTERNS
User selects this when:
Action:
docs/solutions/patterns/critical-patterns.mdOption 3: Link related issues
Option 4: Add to existing skill
User selects this when the documented solution relates to an existing learning skill:
Action:
Example: For Hotwire Native Tailwind variants solution:
hotwire-native/references/resources.md under "Project-Specific Resources"hotwire-native/references/examples.md with link to solution docOption 5: Create new skill
User selects this when the solution represents the start of a new learning domain:
Action:
python3 .claude/skills/skill-creator/scripts/init_skill.py [skill-name]Option 6: View documentation
Option 7: Other
</decision_gate>
<integration_protocol>
Invoked by:
Invokes:
Handoff expectations: All context needed for documentation should be present in conversation history before invocation.
</integration_protocol>
<success_criteria>
Documentation is successful when ALL of the following are true:
</success_criteria>
Missing context:
YAML validation failure:
Similar issue ambiguity:
Module not in modules documentation:
MUST do:
mkdir -p)MUST NOT do:
Good documentation has:
Avoid:
User: "That worked! The N+1 query is fixed."
Skill activates:
Detect confirmation: "That worked!" triggers auto-invoke
Gather context:
includes(:emails) on Brief modelCheck existing: No similar issue found
Generate filename: n-plus-one-brief-generation-BriefSystem-20251110.md
Validate YAML:
module: Brief System
date: 2025-11-10
problem_type: performance_issue
component: rails_model
symptoms:
- "N+1 query when loading email threads"
- "Brief generation taking >5 seconds"
root_cause: missing_include
severity: high
tags: [n-plus-one, eager-loading, performance]
✅ Valid
6. Create documentation:
* docs/solutions/performance-issues/n-plus-one-brief-generation-BriefSystem-20251110.md
7. Cross-reference: None needed (no similar issues)
Output:
✓ Solution documented
File created:
- docs/solutions/performance-issues/n-plus-one-brief-generation-BriefSystem-20251110.md
What's next?
1. Continue workflow (recommended)
2. Add to Required Reading - Promote to critical patterns (critical-patterns.md)
3. Link related issues - Connect to similar problems
4. Add to existing skill - Add to a learning skill (e.g., hotwire-native)
5. Create new skill - Extract into new learning skill
6. View documentation - See what was captured
7. Other
Not in Phase 7 scope, but potential:
Weekly Installs
1.4K
Repository
GitHub Stars
10.9K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode1.2K
codex1.2K
gemini-cli1.2K
github-copilot1.2K
amp1.1K
kimi-cli1.1K
99,500 周安装