$npx -y skills add parcadei/Continuous-Claude-v3 --skill compound-learningsTransform session learnings into permanent capabilities (skills, rules, agents). Use when asked to "improve setup", "learn from sessions", "compound learnings", or "what patterns should become skills".
| 1 | # Compound Learnings |
| 2 | |
| 3 | Transform ephemeral session learnings into permanent, compounding capabilities. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - "What should I learn from recent sessions?" |
| 8 | - "Improve my setup based on recent work" |
| 9 | - "Turn learnings into skills/rules" |
| 10 | - "What patterns should become permanent?" |
| 11 | - "Compound my learnings" |
| 12 | |
| 13 | ## Process |
| 14 | |
| 15 | ### Step 1: Gather Learnings |
| 16 | |
| 17 | ```bash |
| 18 | # List learnings (most recent first) |
| 19 | ls -t $CLAUDE_PROJECT_DIR/.claude/cache/learnings/*.md | head -20 |
| 20 | |
| 21 | # Count total |
| 22 | ls $CLAUDE_PROJECT_DIR/.claude/cache/learnings/*.md | wc -l |
| 23 | ``` |
| 24 | |
| 25 | Read the most recent 5-10 files (or specify a date range). |
| 26 | |
| 27 | ### Step 2: Extract Patterns (Structured) |
| 28 | |
| 29 | For each learnings file, extract entries from these specific sections: |
| 30 | |
| 31 | | Section Header | What to Extract | |
| 32 | |----------------|-----------------| |
| 33 | | `## Patterns` or `Reusable techniques` | Direct candidates for rules | |
| 34 | | `**Takeaway:**` or `**Actionable takeaway:**` | Decision heuristics | |
| 35 | | `## What Worked` | Success patterns | |
| 36 | | `## What Failed` | Anti-patterns (invert to rules) | |
| 37 | | `## Key Decisions` | Design principles | |
| 38 | |
| 39 | Build a frequency table as you go: |
| 40 | |
| 41 | ```markdown |
| 42 | | Pattern | Sessions | Category | |
| 43 | |---------|----------|----------| |
| 44 | | "Check artifacts before editing" | abc, def, ghi | debugging | |
| 45 | | "Pass IDs explicitly" | abc, def, ghi, jkl | reliability | |
| 46 | ``` |
| 47 | |
| 48 | ### Step 2b: Consolidate Similar Patterns |
| 49 | |
| 50 | Before counting, merge patterns that express the same principle: |
| 51 | |
| 52 | **Example consolidation:** |
| 53 | - "Artifact-first debugging" |
| 54 | - "Verify hook output by inspecting files" |
| 55 | - "Filesystem-first debugging" |
| 56 | → All express: **"Observe outputs before editing code"** |
| 57 | |
| 58 | Use the most general formulation. Update the frequency table. |
| 59 | |
| 60 | ### Step 3: Detect Meta-Patterns |
| 61 | |
| 62 | **Critical step:** Look at what the learnings cluster around. |
| 63 | |
| 64 | If >50% of patterns relate to one topic (e.g., "hooks", "tracing", "async"): |
| 65 | → That topic may need a **dedicated skill** rather than multiple rules |
| 66 | → One skill compounds better than five rules |
| 67 | |
| 68 | Ask yourself: *"Is there a skill that would make all these rules unnecessary?"* |
| 69 | |
| 70 | ### Step 4: Categorize (Decision Tree) |
| 71 | |
| 72 | For each pattern, determine artifact type: |
| 73 | |
| 74 | ``` |
| 75 | Is it a sequence of commands/steps? |
| 76 | → YES → SKILL (executable > declarative) |
| 77 | → NO ↓ |
| 78 | |
| 79 | Should it run automatically on an event (SessionEnd, PostToolUse, etc.)? |
| 80 | → YES → HOOK (automatic > manual) |
| 81 | → NO ↓ |
| 82 | |
| 83 | Is it "when X, do Y" or "never do X"? |
| 84 | → YES → RULE |
| 85 | → NO ↓ |
| 86 | |
| 87 | Does it enhance an existing agent workflow? |
| 88 | → YES → AGENT UPDATE |
| 89 | → NO → Skip (not worth capturing) |
| 90 | ``` |
| 91 | |
| 92 | **Artifact Type Examples:** |
| 93 | |
| 94 | | Pattern | Type | Why | |
| 95 | |---------|------|-----| |
| 96 | | "Run linting before commit" | Hook (PreToolUse) | Automatic gate | |
| 97 | | "Extract learnings on session end" | Hook (SessionEnd) | Automatic trigger | |
| 98 | | "Debug hooks step by step" | Skill | Manual sequence | |
| 99 | | "Always pass IDs explicitly" | Rule | Heuristic | |
| 100 | |
| 101 | ### Step 5: Apply Signal Thresholds |
| 102 | |
| 103 | | Occurrences | Action | |
| 104 | |-------------|--------| |
| 105 | | 1 | Note but skip (unless critical failure) | |
| 106 | | 2 | Consider - present to user | |
| 107 | | 3+ | Strong signal - recommend creation | |
| 108 | | 4+ | Definitely create | |
| 109 | |
| 110 | ### Step 6: Propose Artifacts |
| 111 | |
| 112 | Present each proposal in this format: |
| 113 | |
| 114 | ```markdown |
| 115 | --- |
| 116 | |
| 117 | ## Pattern: [Generalized Name] |
| 118 | |
| 119 | **Signal:** [N] sessions ([list session IDs]) |
| 120 | |
| 121 | **Category:** [debugging / reliability / workflow / etc.] |
| 122 | |
| 123 | **Artifact Type:** Rule / Skill / Agent Update |
| 124 | |
| 125 | **Rationale:** [Why this artifact type, why worth creating] |
| 126 | |
| 127 | **Draft Content:** |
| 128 | \`\`\`markdown |
| 129 | [Actual content that would be written to file] |
| 130 | \`\`\` |
| 131 | |
| 132 | **File:** `.claude/rules/[name].md` or `.claude/skills/[name]/SKILL.md` |
| 133 | |
| 134 | --- |
| 135 | ``` |
| 136 | |
| 137 | Use `AskUserQuestion` to get approval for each artifact (or batch approval). |
| 138 | |
| 139 | ### Step 7: Create Approved Artifacts |
| 140 | |
| 141 | #### For Rules: |
| 142 | ```bash |
| 143 | # Write to rules directory |
| 144 | cat > $CLAUDE_PROJECT_DIR/.claude/rules/<name>.md << 'EOF' |
| 145 | # Rule Name |
| 146 | |
| 147 | [Context: why this rule exists, based on N sessions] |
| 148 | |
| 149 | ## Pattern |
| 150 | [The reusable principle] |
| 151 | |
| 152 | ## DO |
| 153 | - [Concrete action] |
| 154 | |
| 155 | ## DON'T |
| 156 | - [Anti-pattern] |
| 157 | |
| 158 | ## Source Sessions |
| 159 | - [session-id-1]: [what happened] |
| 160 | - [session-id-2]: [what happened] |
| 161 | EOF |
| 162 | ``` |
| 163 | |
| 164 | #### For Skills: |
| 165 | Create `.claude/skills/<name>/SKILL.md` with: |
| 166 | - Frontmatter (name, description, allowed-tools) |
| 167 | - When to Use |
| 168 | - Step-by-step instructions (executable) |
| 169 | - Examples from the learnings |
| 170 | |
| 171 | Add triggers to `skill-rules.json` if appropriate. |
| 172 | |
| 173 | #### For Hooks: |
| 174 | Create shell wrapper + TypeScript handler: |
| 175 | |
| 176 | ```bash |
| 177 | # Shell wrapper |
| 178 | cat > $CLAUDE_PROJECT_DIR/.claude/hooks/<name>.sh << 'EOF' |
| 179 | #!/bin/bash |
| 180 | set -e |
| 181 | cd "$CLAUDE_PROJECT_DIR/.claude/hooks" |
| 182 | cat | node dist/<name>.mjs |
| 183 | EOF |
| 184 | chmod +x $CLAUDE_PROJECT_DIR/.claude/hooks/<name>.sh |
| 185 | ``` |
| 186 | |
| 187 | Then create `src/<name>.ts`, build with esbuild, a |