agentleFS
LucasCooperBeyLucasCooperBey/claude-skills/skills/compound-engineering/SKILL.md

compound-engineering

Skill1 starsChanged 5 months agoMITView on GitHub

Connected analyze-plan-execute-learn-repeat cycle with persistent memory. The human-in-the-loop version of Ralph for improving existing projects.

We split this skill into the rules it gives an agent

11 rules. 0 are common, 9 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 9

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After shipping v1 and entering optimization mode

    line 12
  2. Distinctive:

    When you have error logs, user feedback, or analytics to act on

    line 13
  3. Distinctive:

    When you want each fix to inform the next one

    line 14
  4. Distinctive:

    Test failures (CI/CD, local test runs)

    line 44
  5. Distinctive:

    Document in analysis template

    line 67
  6. Very specific:

    If no clear priority emerges: Don't force it. Report "no high-impact issues found" and recommend running techdebt scan or asking the user …

    line 69
  7. Distinctive:

    Goal-driven: Every task in the plan gets success criteria

    line 95
  8. Distinctive:

    Commit after each task

    line 106
  9. Distinctive:

    If execution fails: Don't retry the same approach more than twice.

    line 108
  10. Very specific:

    After execution, append to project LEARNINGS.md:

    line 114
  11. Distinctive:

    If user approves → loop back to Phase 1 with the next priority.

    line 163

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Compound Engineering

A self-improving development loop that compounds knowledge across sessions.

When to Use

  • Improving an existing project iteratively
  • After shipping v1 and entering optimization mode
  • When you have error logs, user feedback, or analytics to act on
  • When you want each fix to inform the next one
  • For sustained improvement over multiple sessions

When NOT to Use (Use Ralph Instead)

  • Building from scratch with clear specs → Ralph
  • Need autonomous overnight builds → Ralph
  • Working in sandbox/VM → Ralph

Quick Start

/compound                    # Full loop: analyze → plan → execute → learn → compound
/compound analyze            # Just run analysis phase
/compound plan               # Plan from existing analysis (requires prior analysis)
/compound execute            # Execute existing plan (requires prior plan)
/compound learn              # Run learning phase (requires prior execution)
/compound report             # Generate cycle report

The 5-Phase Loop

ANALYZE → PLAN → EXECUTE → LEARN → COMPOUND → (repeat)

Phase 1: ANALYZE — What needs fixing most?

Inputs to consider:

  • Error logs (Sentry, console, server logs)
  • User feedback (support tickets, reviews, direct messages)
  • Analytics (PostHog, usage metrics)
  • Test failures (CI/CD, local test runs)
  • Performance data (load times, API response times)
  • Previous learning log (LEARNINGS.md)
  • Tech debt backlog

Pre-Computed Summary Stats

Gather stats directly — run test suite, check for type errors, scan logs:

# Run tests and capture counts
bun test 2>&1 | tail -5
# Check TypeScript errors (if applicable)
bunx tsc --noEmit 2>&1 | tail -5
# Recent errors in logs (if available)
tail -50 /var/log/app.log 2>/dev/null || echo "No log file found"

Process:

  1. Generate .compound-stats (once)
  2. Gather available signals (error rates, user complaints, test flakes)
  3. Score each issue by impact: severity x frequency x user-facing
  4. Pick the single highest-impact improvement
  5. Document in analysis template

If no clear priority emerges: Don't force it. Report "no high-impact issues found" and recommend running techdebt scan or asking the user for specific pain points. A cycle with no action is better than a cycle that fixes nothing important.

Output: ~/.claude/artifacts/analysis/YYYY-MM-DD-compound/analysis.md

## Analysis: [Date]

### Signal Review
- Errors: [summary of error patterns]
- Feedback: [summary of user complaints]
- Tests: [flaky or failing tests]
- Performance: [bottlenecks identified]

### Priority: [The #1 Thing]
**Impact score:** [severity] x [frequency] x [user-facing] = [total]
**Why this first:** [justification]
**Scope:** [estimated size: small/medium/large]

Phase 2: PLAN — How do we fix it?

  1. If non-trivial: Invoke deep-recon first (has this been solved before?)
  2. Always: Invoke writing-plans with:
    • Analysis output as context
    • Research brief (if recon was run)
    • Previous learnings (from LEARNINGS.md)
  3. Goal-driven: Every task in the plan gets success criteria

Output: Implementation plan (standard writing-plans output)

Phase 3: EXECUTE — Build it

  1. Choose executor:
    • executing-plans — default for sequential, well-scoped plans (≤5 tasks)
    • subagent-driven-development — for plans with 3+ independent tasks that can parallelize
  2. Quality gates between tasks (tests, types, lint)
  3. Goal-driven execution: loop until success criteria met
  4. Commit after each task

If execution fails: Don't retry the same approach more than twice. Escalate: check if the plan was wrong (return to Phase 2), or if the analysis missed something (return to Phase 1). Document what failed in the learning log either way.

Output: Working code with passing tests

Phase 4: LEARN — What did we discover?

After execution, append to project LEARNINGS.md:

## [Date] — [What was improved]

### What worked
- [thing that went well]

### What didn't
- [thing that was harder than expected]

### Patterns discovered
- [new pattern worth remembering]

### Avoid next time
- [anti-pattern encountered]

### Time spent
- Analysis: [X min]
- Planning: [X min]
- Execution: [X min]
- Total: [X min]

Also update project CLAUDE.md if a new project-specific pattern emerged.

Phase 5: COMPOUND — Set up the next cycle

Generate a cycle report:

## Compound Cycle Report — [Date]

### What improved
- [specific metric or behavior that got better]

### Verification
- [command output proving improvement]

### Next priority
Based on remaining signals:
1. [Next highest-priority issue]
2. [Runner-up]
3. [Third option]

### Recommendation
[Which to tackle next and why]

If user approves → loop back to Phase 1 with the next priority.

Persistent Files

FileLocationPurpose
LEARNINGS.mdProject rootPersistent learning log across all cycles
analysis.md~/.claude/artifacts/analysis/Current cycle analysis
compound-report.md~/.claude/artifacts/reports/Cycle completion reports

Comparison with Ralph

AspectCompoundRalph
ContextPersistent learning logFresh per iteration
HumanIn the loop (approves each phase)AFK (autonomous)
ScopeIncremental improvementFull build from spec
SafetyNormal dev environmentSandbox required
MemoryLearns across sessionsNo cross-session memory
Use whenImproving existing codeBuilding from scratch

Success Criteria

A compound cycle is complete when:

  • One measurable improvement was shipped
  • All tests pass
  • Learning log was updated with insights
  • Next priority was identified and documented
  • Cycle report saved to artifacts

Model Routing

  • Analysis phase: opus (prioritization requires judgment)
  • Planning phase: opus (architectural decisions)
  • Execution phase: sonnet (implementing well-defined tasks)
  • Learning phase: sonnet (documenting what happened)
  • Report synthesis: opus (connecting improvement to metrics)

Integration Points

SkillRole
deep-reconResearch phase when problem is non-trivial
writing-plansCreates implementation plan in Phase 2
executing-plansRuns plan in Phase 3
subagent-driven-developmentAlternative executor for Phase 3
verification-before-completionEnsures claims have evidence
test-driven-developmentExecution follows TDD

Related Context

  • agent-guardrails.md - Time budgets, retry limits
  • output-markers.md - Standard output format
  • validation-oracles.md - Baseline validation

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.