lean-spec
A Claude Code plugin that turns AI-assisted development into a disciplined lifecycle the model can't skip its way around.
What is lean-spec?
lean-spec gives your AI coding agent a rulebook it has to follow.
Instead of asking Claude to "build a feature" and hoping it plans, tests, and reviews along the way, lean-spec runs every feature through a fixed lifecycle:
init → plan → spec → implement → review → close
└ once ┘ └────── repeat per feature ──────┘
Each phase has one owner (a specific model + effort level), produces one mandatory artifact (a validated markdown file), and passes through one gate before the next phase can start. The rules aren't polite suggestions in a prompt — they're enforced by the harness: a state machine, file-write guards, and validation hooks that block the model when it tries to cut a corner.
The result: a repeatable, auditable trail for every change, where git log and the features/ folder tell the whole story.
Why it exists
AI agents are fast but undisciplined. Left to a single prompt, they'll skip the plan, write code before tests, mark their own work "done," and leave you reconstructing what happened. Prompt instructions like "always write tests first" fail the moment the model forgets — and a skipped step is a gate that never ran.
lean-spec makes discipline structural instead of aspirational:
- The model can't bypass the process — phase transitions live in a state CLI and are guarded by hooks, not in prose the model can ignore.
- The right model does each job — cheap models code, stronger models spec and review, all configurable per phase.
- Every step leaves evidence — a spec, TDD run output, a review verdict — committed as you go.
- Reviews actually gate — a feature can't close unless a reviewer (a different model than the coder) approves it.
How it works
Three layers with strictly separated jobs — this is the load-bearing idea:
skills/ DESCRIBE thin prompts that dispatch agents · zero gate logic
hooks/ ENFORCE block workflow.json edits · gate artifacts · drive auto mode
bin/lean-spec MUTATE the only thing allowed to write workflow.json
A skill instruction the model ignores can never corrupt state, because state and gates don't live in skills. Skills just describe work and hand it to an agent; hooks enforce the rules; the CLI is the single source of truth for where each feature is in its lifecycle.
The lifecycle, with its gates:
/lean-spec:spec architect writes spec.md ────────┐
│ (Scope · ACs · Guardrails) │ validated
▼ │ at every
/lean-spec:implement coder writes code + tests │ SubagentStop
│ RED → GREEN, evidence in notes.md │ AND at the
▼ │ phase gate
/lean-spec:review reviewer writes review.md ────────┤
│ verdict: APPROVE│NEEDS_FIXES│BLOCKED
│ │
│ NEEDS_FIXES ──► /lean-spec:fix ──► back to review
▼
/lean-spec:close refuses unless verdict == APPROVE
Features