compound-docs
Capture solved problems as categorized documentation with YAML frontmatter for fast lookup
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-17
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[Skill 名] compound-docs
compound-docs Skill
目的: 解決済みの問題を自動的に文書化し、カテゴリベースの組織(列挙型で検証された問題タイプ)で検索可能な組織的知識を構築します。
概要
このスキルは、問題解決が確認された直後にその解決策をキャプチャし、将来のセッションで検索可能なナレッジベースとして機能する構造化されたドキュメントを作成します。
組織: 単一ファイルアーキテクチャ - 各問題は、その症状カテゴリのディレクトリに1つのMarkdownファイルとして文書化されます(例: docs/solutions/performance-issues/n-plus-one-briefs.md)。ファイルは、メタデータと検索可能性のためにYAMLフロントマターを使用します。
<critical_sequence name="documentation-capture" enforce_order="strict">
7ステッププロセス
<step number="1" required="true">
ステップ1: 確認の検出
以下のフレーズの後に自動起動:
- "that worked"
- "it's fixed"
- "working now"
- "problem solved"
- "that did it"
または手動: /doc-fix コマンド
非自明な問題のみ:
- 複数の調査試行が必要だった場合
- 時間のかかる厄介なデバッグだった場合
- 自明ではない解決策だった場合
- 将来のセッションに役立つ場合
以下の場合は文書化をスキップ:
- 単純なタイプミス
- 明らかな構文エラー
- 即座に修正された些細な修正 </step>
<step number="2" required="true" depends_on="1">
ステップ2: コンテキストの収集
会話履歴から抽出:
必須情報:
- モジュール名: 問題が発生したCORAモジュール
- 症状: 観察されたエラー/動作(正確なエラーメッセージ)
- 調査試行: 何が機能せず、その理由
- 根本原因: 実際の技術的な問題の説明
- 解決策: 何が問題を解決したか(コード/設定の変更)
- 予防: 将来どのように回避するか
環境詳細:
- Railsバージョン
- ステージ(0-6または実装後)
- OSバージョン
- ファイル/行参照
ブロッキング要件: 重要なコンテキスト(モジュール名、正確なエラー、ステージ、または解決手順)が欠落している場合は、ユーザーに尋ね、応答を待ってからステップ3に進みます。
この問題を適切に文書化するために、いくつかの詳細が必要です。
1. この問題が発生したモジュールは何ですか? [ModuleName]
2. 正確なエラーメッセージまたは症状は何でしたか?
3. どのステージでしたか? (0-6または実装後)
[ユーザーが詳細を提供した後、続行]
</step>
<step number="3" required="false" depends_on="2">
ステップ3: 既存ドキュメントの確認
docs/solutions/ で類似の問題を検索:
# エラーメッセージのキーワードで検索
grep -r "exact error phrase" docs/solutions/
# 症状カテゴリで検索
ls docs/solutions/[category]/
類似の問題が見つかった場合:
次に、決定オプションを提示します。
類似の問題が見つかりました: docs/solutions/[path]
次は何をしますか?
1. 相互参照付きの新しいドキュメントを作成する(推奨)
2. 既存のドキュメントを更新する(同じ根本原因の場合のみ)
3. その他
選択してください (1-3): _
ユーザーの応答を待ち、選択されたアクションを実行します。
それ以外の場合(類似の問題が見つからない場合):
直接ステップ4に進みます(ユーザーとのやり取りは不要です)。 </step>
<step number="4" required="true" depends_on="2">
ステップ4: ファイル名の生成
形式: [sanitized-symptom]-[module]-[YYYYMMDD].md
サニタイズルール:
- 小文字
- スペースをハイフンに置換
- ハイフン以外の特殊文字を削除
- 適切な長さ(80文字未満)に切り詰める
例:
missing-include-BriefSystem-20251110.mdparameter-not-saving-state-EmailProcessing-20251110.mdwebview-crash-on-resize-Assistant-20251110.md</step>
<step number="5" required="true" depends_on="4" blocking="true">
ステップ5: YAMLスキーマの検証
重要: すべてのドキュメントには、列挙型検証付きの検証済みYAMLフロントマターが必要です。
<validation_gate name="yaml-schema" blocking="true">
スキーマに対する検証:
schema.yaml をロードし、yaml-schema.md で定義されている列挙値に対して問題を分類します。すべての必須フィールドが存在し、許可された値と正確に一致することを確認します。
検証が失敗した場合、ブロックします:
❌ YAML検証に失敗しました
エラー:
- problem_type: スキーマの列挙型のいずれかである必要があります。 "compilation_error" が指定されました
- severity: [critical, moderate, minor] のいずれかである必要があります。 "high" が指定されました
- symptoms: 1〜5個の項目を持つ配列である必要があります。文字列が指定されました
修正された値を提供してください。
ゲートの強制: schema.yaml で定義されているすべての検証ルールにYAMLフロントマターが合格するまで、ステップ6(ドキュメントの作成)に進まないでください。
</validation_gate> </step>
<step number="6" required="true" depends_on="5">
ステップ6: ドキュメントの作成
problem_type からカテゴリを決定: yaml-schema.md(49-61行目)で定義されているカテゴリマッピングを使用します。
ドキュメントファイルの作成:
PROBLEM_TYPE="[検証済みYAMLから]"
CATEGORY="[problem_typeからマッピング]"
FILENAME="[生成されたファイル名].md"
DOC_PATH="docs/solutions/${CATEGORY}/${FILENAME}"
# 必要に応じてディレクトリを作成
mkdir -p "docs/solutions/${CATEGORY}"
# assets/resolution-template.md のテンプレートを使用してドキュメントを書き込む
# (ステップ2のコンテキストと検証済みYAMLフロントマターでコンテンツを埋める)
結果:
- カテゴリディレクトリ内の単一ファイル
- 列挙型検証により一貫した分類を保証
ドキュメントの作成: assets/resolution-template.md の構造に、ステップ2で収集したコンテキストとステップ5で検証されたYAMLフロントマターを埋め込みます。
</step>
<step number="7" required="false" depends_on="6">
ステップ7: 相互参照とクリティカルパターンの検出
ステップ3で類似の問題が見つかった場合:
既存のドキュメントを更新:
# 類似のドキュメントへの関連問題リンクを追加
echo "- See also: [$FILENAME]($REAL_FILE)" >> [similar-doc.md]
新しいドキュメントを更新: ステップ6からすでに相互参照が含まれています。
該当する場合、パターンを更新:
これが一般的なパターン(3つ以上の類似の問題)を表す場合:
# docs/solutions/patterns/common-solutions.md に追加
cat >> docs/solutions/patterns/common-solutions.md << 'EOF'
## [パターン名]
**一般的な症状:** [説明]
**根本原因:** [技術的な説明]
**解決策パターン:** [一般的なアプローチ]
**例:**
- [ドキュメント1へのリンク]
- [ドキュメント2へのリンク]
- [ドキュメント3へのリンク]
E 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
compound-docs Skill
Purpose: Automatically document solved problems to build searchable institutional knowledge with category-based organization (enum-validated problem types).
Overview
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">
7-Step Process
<step number="1" required="true">
Step 1: Detect Confirmation
Auto-invoke after phrases:
- "that worked"
- "it's fixed"
- "working now"
- "problem solved"
- "that did it"
OR manual: /doc-fix command
Non-trivial problems only:
- Multiple investigation attempts needed
- Tricky debugging that took time
- Non-obvious solution
- Future sessions would benefit
Skip documentation for:
- Simple typos
- Obvious syntax errors
- Trivial fixes immediately corrected </step>
<step number="2" required="true" depends_on="1">
Step 2: Gather Context
Extract from conversation history:
Required information:
- Module name: Which CORA module had the problem
- Symptom: Observable error/behavior (exact error messages)
- Investigation attempts: What didn't work and why
- Root cause: Technical explanation of actual problem
- Solution: What fixed it (code/config changes)
- Prevention: How to avoid in future
Environment details:
- Rails version
- Stage (0-6 or post-implementation)
- OS version
- File/line references
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]
</step>
<step number="3" required="false" depends_on="2">
Step 3: Check Existing Docs
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). </step>
<step number="4" required="true" depends_on="2">
Step 4: Generate Filename
Format: [sanitized-symptom]-[module]-[YYYYMMDD].md
Sanitization rules:
- Lowercase
- Replace spaces with hyphens
- Remove special characters except hyphens
- Truncate to reasonable length (< 80 chars)
Examples:
missing-include-BriefSystem-20251110.mdparameter-not-saving-state-EmailProcessing-20251110.mdwebview-crash-on-resize-Assistant-20251110.md</step>
<step number="5" required="true" depends_on="4" blocking="true">
Step 5: Validate YAML Schema
CRITICAL: 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, moderate, minor], got "high"
- 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> </step>
<step number="6" required="true" depends_on="5">
Step 6: Create Documentation
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:
- Single file in category directory
- Enum validation ensures consistent categorization
Create documentation: Populate the structure from assets/resolution-template.md with context gathered in Step 2 and validated YAML frontmatter from Step 5.
</step>
<step number="7" required="false" depends_on="6">
Step 7: Cross-Reference & Critical Pattern Detection
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:
- Severity:
criticalin YAML - Affects multiple modules OR foundational stage (Stage 2 or 3)
- Non-obvious solution
Then 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/cora-critical-patterns.md.
</step>
</critical_sequence>
<decision_gate name="post-documentation" wait_for_user="true">
Decision Menu After Capture
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 (cora-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
- Return to calling skill/workflow
- Documentation is complete
Option 2: Add to Required Reading ⭐ PRIMARY PATH FOR CRITICAL PATTERNS
User selects this when:
- System made this mistake multiple times across different modules
- Solution is non-obvious but must be followed every time
- Foundational requirement (Rails, Rails API, threading, etc.)
Action:
- Extract pattern from the documentation
- Format as ❌ WRONG vs ✅ CORRECT with code examples
- Add to
docs/solutions/patterns/cora-critical-patterns.md - Add cross-reference back to this doc
- Confirm: "✓ Added to Required Reading. All subagents will see this pattern before code generation."
Option 3: Link related issues
- Prompt: "Which doc to link? (provide filename or describe)"
- Search docs/solutions/ for the doc
- Add cross-reference to both docs
- Confirm: "✓ Cross-reference added"
Option 4: Add to existing skill
User selects this when the documented solution relates to an existing learning skill:
Action:
- Prompt: "Which skill? (hotwire-native, etc.)"
- Determine which reference file to update (resources.md, patterns.md, or examples.md)
- Add link and brief description to appropriate section
- Confirm: "✓ Added to [skill-name] skill in [file]"
Example: For Hotwire Native Tailwind variants solution:
- Add to
hotwire-native/references/resources.mdunder "CORA-Specific Resources" - Add to
hotwire-native/references/examples.mdwith link to solution doc
Option 5: Create new skill
User selects this when the solution represents the start of a new learning domain:
Action:
- Prompt: "What should the new skill be called? (e.g., stripe-billing, email-processing)"
- Run
python3 .claude/skills/skill-creator/scripts/init_skill.py [skill-name] - Create initial reference files with this solution as first example
- Confirm: "✓ Created new [skill-name] skill with this solution as first example"
Option 6: View documentation
- Display the created documentation
- Present decision menu again
Option 7: Other
- Ask what they'd like to do
</decision_gate>
<integration_protocol>
Integration Points
Invoked by:
- /compound command (primary interface)
- Manual invocation in conversation after solution confirmed
- Can be triggered by detecting confirmation phrases like "that worked", "it's fixed", etc.
Invokes:
- None (terminal skill - does not delegate to other skills)
Handoff expectations: All context needed for documentation should be present in conversation history before invocation.
</integration_protocol>
<success_criteria>
Success Criteria
Documentation is successful when ALL of the following are true:
- ✅ YAML frontmatter validated (all required fields, correct formats)
- ✅ File created in docs/solutions/[category]/[filename].md
- ✅ Enum values match schema.yaml exactly
- ✅ Code examples included in solution section
- ✅ Cross-references added if related issues found
- ✅ User presented with decision menu and action confirmed
</success_criteria>
Error Handling
Missing context:
- Ask user for missing details
- Don't proceed until critical info provided
YAML validation failure:
- Show specific errors
- Present retry with corrected values
- BLOCK until valid
Similar issue ambiguity:
- Present multiple matches
- Let user choose: new doc, update existing, or link as duplicate
Module not in CORA-MODULES.md:
- Warn but don't block
- Proceed with documentation
- Suggest: "Add [Module] to CORA-MODULES.md if not there"
Execution Guidelines
MUST do:
- Validate YAML frontmatter (BLOCK if invalid per Step 5 validation gate)
- Extract exact error messages from conversation
- Include code examples in solution section
- Create directories before writing files (
mkdir -p) - Ask user and WAIT if critical context missing
MUST NOT do:
- Skip YAML validation (validation gate is blocking)
- Use vague descriptions (not searchable)
- Omit code examples or cross-references
Quality Guidelines
Good documentation has:
- ✅ Exact error messages (copy-paste from output)
- ✅ Specific file:line references
- ✅ Observable symptoms (what you saw, not interpretations)
- ✅ Failed attempts documented (helps avoid wrong paths)
- ✅ Technical explanation (not just "what" but "why")
- ✅ Code examples (before/after if applicable)
- ✅ Prevention guidance (how to catch early)
- ✅ Cross-references (related issues)
Avoid:
- ❌ Vague descriptions ("something was wrong")
- ❌ Missing technical details ("fixed the code")
- ❌ No context (which version? which file?)
- ❌ Just code dumps (explain why it works)
- ❌ No prevention guidance
- ❌ No cross-references
Example Scenario
User: "That worked! The N+1 query is fixed."
Skill activates:
- Detect confirmation: "That worked!" triggers auto-invoke
- Gather context:
- Module: Brief System
- Symptom: Brief generation taking >5 seconds, N+1 query when loading email threads
- Failed attempts: Added pagination (didn't help), checked background job performance
- Solution: Added eager loading with
includes(:emails)on Brief model - Root cause: Missing eager loading causing separate database query per email thread
- Check 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
- Create documentation:
docs/solutions/performance-issues/n-plus-one-brief-generation-BriefSystem-20251110.md
- 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 (cora-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
Future Enhancements
Not in Phase 7 scope, but potential:
- Search by date range
- Filter by severity
- Tag-based search interface
- Metrics (most common issues, resolution time)
- Export to shareable format (community knowledge sharing)
- Import community solutions