compound
Capture solved problems as searchable solution docs. Use after fixing bugs, when "that worked", or after successful /phx:review or /phx:investigate.
Install
npx skills add https://github.com/oliver-kriska/claude-elixir-phoenix/tree/main/plugins/elixir-phoenix/skills/compound
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install oliver-kriska-claude-elixir-phoenix@llmmart
git clone https://github.com/oliver-kriska/claude-elixir-phoenix.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole oliver-kriska/claude-elixir-phoenix collection as a plugin from our marketplace. Git is the plain clone.
Skill manifest
Compound — Capture Solutions as Knowledge
After fixing a problem, capture the solution as searchable institutional documentation.
Usage
/phx:compound Fixed N+1 query in user listing
/phx:compound Resolved LiveView timeout in dashboard
/phx:compound # Auto-detects from recent session context
Philosophy
Each unit of engineering work should make subsequent units easier — not harder.
Workflow
Step 1: Detect Context
- If
$ARGUMENTSprovided, use as description - If no args, check scratchpad DEAD-END/DECISION entries,
git diff,.claude/plans/{slug}/progress.mdfor recent completions - If unclear, ask: "What problem did you just solve?"
Only document non-trivial problems that required investigation.
Step 2: Search Existing Solutions
Create .claude/solutions/ directory if it doesn't exist (run mkdir -p .claude/solutions).
Then search .claude/solutions/ for relevant keywords using Grep.
If found: Create new (different root cause), Update existing (same root cause, new symptom), or Skip.
Step 3: Gather Details and Create Solution
Extract from session context: module, symptoms, investigation steps, root cause, solution code, and prevention advice.
Validate frontmatter against ${CLAUDE_PLUGIN_ROOT}/skills/compound-docs/references/schema.md,
then create file using ${CLAUDE_PLUGIN_ROOT}/skills/compound-docs/references/resolution-template.md.
Write-blocked fallback: if writing to .claude/solutions/ is denied
by permissions, do NOT silently drop the solution. Output the full
solution doc inline (fenced markdown the user can paste), then suggest
/phx:permissions to allow .claude/solutions/ writes for next time.
Step 4: Decision Menu
- Continue (default)
- Promote to Iron Law check — Add to iron-law-judge
- Update skill reference — Add to relevant skill
- Update CLAUDE.md — Add prevention rule
Auto-Trigger Phrases
When user says "that worked", "it's fixed", "problem solved",
"the fix was" — suggest /phx:compound.
Supply-chain finding auto-feed (Phase 3)
When /phx:deps-audit produces a BLOCK-severity finding that the
user investigates and confirms is a real malicious pattern (not a
false positive), suggest:
Caught a high-severity finding in
<pkg>@<version>. Run/phx:compoundto capture this for future audits?
If accepted, the resulting solution doc goes to
.claude/solutions/supply-chain/<pkg>-<cve_or_pattern>.md and
includes the exact rule-id + snippet + diff window that triggered
the finding. This compounds the audit corpus: future runs of
/phx:deps-audit grep solutions/supply-chain/ for snippet
matches and pre-elevate severity on known-bad patterns.
Always prompt; never auto-write. Solution docs are durable and shape future trust calls — the user reviews before committing.
Iron Laws
- YAML frontmatter validates or STOP
- Symptoms must be specific — not "it broke"
- Root cause is WHY, not WHAT
- One problem per file
- NEVER document a fix before verifying it works — run
mix compile && mix testfirst; unverified solutions poison the knowledge base
Integration with Workflow
/phx:review → Complete → /phx:compound ← YOU ARE HERE
│
.claude/solutions/{category}/{fix}.md
│
/phx:investigate and /phx:plan search here
References
${CLAUDE_SKILL_DIR}/references/compound-workflow.md— Detailed step-by-step- See also:
compound-docsskill for schema and templates
Files (claude-elixir-phoenix)
-
references
-
compound-workflow.md 3.3 KB
# Compound Workflow — Detailed Steps ## The Compounding Effect ``` Cycle 1: Fix bug → Document solution Cycle 2: Hit similar bug → Find solution in docs → Fix faster Cycle 3: Agent finds solution → Prevents bug before it ships ``` Each documented solution reduces future debugging time. After 10-20 solutions, agents can proactively catch known issues. ## Detailed Workflow ### Phase 1: Context Detection #### From Arguments ``` /phx:compound Fixed N+1 query in UserListLive — was missing preload on posts ``` Extract: module=UserListLive, symptom=N+1, root_cause=missing preload #### From Session Context Check these sources in order: 1. **Scratchpad DEAD-END and DECISION entries**: ```bash grep -A 5 "DEAD-END\|DECISION" .claude/plans/*/scratchpad.md 2>/dev/null | tail -20 ``` 2. **Recent git changes**: ```bash git log --oneline -5 git diff HEAD~1 --stat ``` 3. **Progress file completions**: ```bash ls -t .claude/plans/*/progress.md 2>/dev/null | head -1 ``` #### Trivial Fix Filter Skip documentation for: - Typo fixes (single character changes) - Import/alias additions - Config value changes - Formatting-only changes - Changes to fewer than 3 lines with no investigation ### Phase 2: Duplicate Detection Search existing solutions before creating new: ```bash grep -rl "NotLoaded\|timeout\|N+1" .claude/solutions/ 2>/dev/null grep -rl "module: \"Accounts\"" .claude/solutions/ 2>/dev/null ``` If match found, read the file and compare: - **Same root cause + same module**: Update existing (add new symptom) - **Same root cause + different module**: Create new with cross-reference - **Different root cause**: Create new (different problem) ### Phase 3: Information Gathering ```yaml module: "Accounts" date: "2025-12-01" problem_type: runtime_error component: ecto_query symptoms: - "Ecto.Association.NotLoaded on user.posts" root_cause: "missing preload on :posts association" severity: medium tags: [preload, association, n-plus-one] ``` Gathering strategy: 1. Check session context first (scratchpad, git diff, progress) 2. Fill what you can automatically 3. Ask user ONLY for missing critical fields ### Phase 4: Schema Validation Validate frontmatter against `compound-docs/references/schema.md`. Use suggested values when they fit; create descriptive labels when they don't. Only `severity` is a strict enum. ### Phase 5: File Creation Create in `.claude/solutions/{category}/` using the template from `compound-docs/references/resolution-template.md`. Filename: `{sanitized-symptom}-{module}-{YYYYMMDD}.md` ### Phase 6: Cross-Referencing After creating the solution file: 1. Search for related solutions by tags 2. Add `related_solutions` to new file if matches found 3. Update related files to reference new solution ### Phase 7: Promotion Check If the solution matches any of these, suggest promotion: - **severity: critical** — Suggest adding to Iron Law checks - **Iron Law violation** — Suggest updating iron-law-judge - **Recurring pattern** (3+ similar) — Suggest adding to skill reference ## Integration with Other Skills - `/phx:learn-from-fix` captures quick patterns in `common-mistakes.md` - `/phx:compound` captures detailed solutions with full context - `/phx:investigate` searches `.claude/solutions/` before investigating - `/phx:plan` consults for known risks in planned areas
-
-
SKILL.md 3.8 KB
--- name: compound description: Capture solved problems as searchable solution docs. Use after fixing bugs, when "that worked", or after successful /phx:review or /phx:investigate. effort: low argument-hint: "[description of what was fixed]" --- # Compound — Capture Solutions as Knowledge After fixing a problem, capture the solution as searchable institutional documentation. ## Usage ``` /phx:compound Fixed N+1 query in user listing /phx:compound Resolved LiveView timeout in dashboard /phx:compound # Auto-detects from recent session context ``` ## Philosophy > Each unit of engineering work should make subsequent units > easier — not harder. ## Workflow ### Step 1: Detect Context 1. If `$ARGUMENTS` provided, use as description 2. If no args, check scratchpad DEAD-END/DECISION entries, `git diff`, `.claude/plans/{slug}/progress.md` for recent completions 3. If unclear, ask: "What problem did you just solve?" **Only document non-trivial problems** that required investigation. ### Step 2: Search Existing Solutions Create `.claude/solutions/` directory if it doesn't exist (run `mkdir -p .claude/solutions`). Then search `.claude/solutions/` for relevant keywords using Grep. If found: **Create new** (different root cause), **Update existing** (same root cause, new symptom), or **Skip**. ### Step 3: Gather Details and Create Solution Extract from session context: module, symptoms, investigation steps, root cause, solution code, and prevention advice. Validate frontmatter against `${CLAUDE_PLUGIN_ROOT}/skills/compound-docs/references/schema.md`, then create file using `${CLAUDE_PLUGIN_ROOT}/skills/compound-docs/references/resolution-template.md`. **Write-blocked fallback**: if writing to `.claude/solutions/` is denied by permissions, do NOT silently drop the solution. Output the full solution doc inline (fenced markdown the user can paste), then suggest `/phx:permissions` to allow `.claude/solutions/` writes for next time. ### Step 4: Decision Menu 1. **Continue** (default) 2. **Promote to Iron Law check** — Add to iron-law-judge 3. **Update skill reference** — Add to relevant skill 4. **Update CLAUDE.md** — Add prevention rule ## Auto-Trigger Phrases When user says "that worked", "it's fixed", "problem solved", "the fix was" — suggest `/phx:compound`. ### Supply-chain finding auto-feed (Phase 3) When `/phx:deps-audit` produces a BLOCK-severity finding that the user investigates and confirms is a real malicious pattern (not a false positive), suggest: > Caught a high-severity finding in `<pkg>@<version>`. Run > `/phx:compound` to capture this for future audits? If accepted, the resulting solution doc goes to `.claude/solutions/supply-chain/<pkg>-<cve_or_pattern>.md` and includes the exact rule-id + snippet + diff window that triggered the finding. This compounds the audit corpus: future runs of `/phx:deps-audit` grep `solutions/supply-chain/` for snippet matches and pre-elevate severity on known-bad patterns. **Always prompt; never auto-write.** Solution docs are durable and shape future trust calls — the user reviews before committing. ## Iron Laws 1. **YAML frontmatter validates or STOP** 2. **Symptoms must be specific** — not "it broke" 3. **Root cause is WHY, not WHAT** 4. **One problem per file** 5. **NEVER document a fix before verifying it works** — run `mix compile && mix test` first; unverified solutions poison the knowledge base ## Integration with Workflow ```text /phx:review → Complete → /phx:compound ← YOU ARE HERE │ .claude/solutions/{category}/{fix}.md │ /phx:investigate and /phx:plan search here ``` ## References - `${CLAUDE_SKILL_DIR}/references/compound-workflow.md` — Detailed step-by-step - See also: `compound-docs` skill for schema and templates
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.