Execute a specification document through planned waves of parallel and sequential changes, updating the spec and committing after each wave. Use when the user says "execute this spec", "implement this plan", "run the spec", or when given a specs/*.md file to implement.
When handed a specification document (a specs/*.md file), execute it methodically in waves. Each wave produces working code, an updated spec, and a commit. The goal is a clean git history where each commit represents a coherent unit of progress against the spec.
Use this pattern when you need to:
specs/*.md plan end-to-end in structured waves.READ SPEC
↓
PLAN WAVES (which tasks are parallel vs sequential?)
↓
┌─── WAVE N ──────────────────────────────────────┐
│ 1. Execute tasks (sub-agents for ALL tasks) │
│ 2. Verify (type-check, tests if applicable) │
│ 3. Update spec (check off items, add notes) │
│ 4. Commit (code changes + spec updates) │
└──────────────────────────────────────────────────┘
↓
REPEAT until spec is complete
↓
FINAL REVIEW (update spec status, add review section)
Before touching any code:
If the spec has unresolved Open Questions that block implementation, surface them immediately. Don't guess on architectural decisions.
Break the spec's implementation plan into execution waves. A wave is a set of changes that can be made together without breaking anything.
Every task runs in a sub-agent regardless. The question is only whether sub-agents run concurrently or one-at-a-time.
| Condition | Ordering |
|---|---|
| Tasks touch different files/modules | Parallel |
| Task B imports from Task A's output | Sequential (A before B) |
| Tasks modify the same file | Sequential (avoid conflicts) |
| Tasks are in different spec phases | Sequential (phase order) |
| Tasks within a phase are independent | Parallel |
Before executing, write out your wave plan:
Wave 1: [Foundation — types and interfaces]
- Task 1.1 (parallel with 1.2)
- Task 1.2 (parallel with 1.1)
Wave 2: [Core logic — depends on Wave 1 types]
- Task 2.1 (sequential — modifies shared module)
- Task 2.2 (after 2.1 — uses its exports)
Wave 3: [Integration — consumers of Wave 2]
- Task 3.1 (parallel with 3.2)
- Task 3.2 (parallel with 3.1)
Present this plan to the user before executing. Get a thumbs up.
For each wave:
Every task gets its own sub-agent. This is non-negotiable. Sub-agents exist to scope context — each one sees only what it needs for its task, which produces better results than a single agent juggling everything. Parallelism is a bonus, not the reason for sub-agents.
After all tasks in a wave complete:
bun run tsc --noEmit # type-check
bun test # if tests exist for changed code
If verification fails, fix issues before proceeding. Don't carry broken state into the next wave.
Check off completed items in the spec's Implementation Plan:
- [x] **1.1** Add IconDefinition type ← was [ ], now [x]
- [x] **1.2** Add CoverDefinition type
- [ ] **2.1** Update factory functions ← not yet
If implementation deviated from the spec (it often does), add a note:
- [x] **1.1** Add IconDefinition type
> **Note**: Used discriminated union instead of enum as originally planned.
> Rationale: better type narrowing in consumers.
If you discovered something during implementation, add it to the spec's Research Findings or Edge Cases section.
Each commit includes BOTH the code changes AND the spec updates. This means every commit in the history shows what was planned and what was actually done.
Follow git and incremental-commits skill conventions:
feat(scope): wave description — what this wave accomplishes
- Completed spec items 1.1, 1.2
- [Any notable deviations or discoveries]
Stage specific files — never git add . or git add -A.
After all waves complete:
## Review
**Completed**: [Date]
**Branch**: [branch-name]
### Summary
[2-3 sentences on what was built and how it differs from the original plan]
### Deviations from Spec
- [What changed and why]
### Follow-up Work
- [Anything discovered during implementation that should be a future spec]
Every task — parallel or sequential — runs in a sub-agent. The primary agent orchestrates: it plans waves, launches sub-agents, verifies results, updates the spec, and commits. It does not implement code directly.
When spinning up sub-agents, each agent needs:
Keep sub-agent prompts focused. A sub-agent that knows too much will try to do too much.
| Situation | Response |
|---|---|
| Type-check fails after a wave | Fix before committing. Don't carry broken state. |
| Sub-agent made changes outside its scope | Revert the out-of-scope changes. Keep only what was asked for. |
| Spec item is ambiguous mid-implementation | Stop. Ask the user. Add clarification to the spec. |
| Discovery invalidates a later spec phase | Update the spec's plan. Inform the user. Re-plan remaining waves. |
| Tests fail | Fix the tests or the code. Update spec if the test failure reveals a spec gap. |
"Let me just start implementing..."
No. Read the spec. Plan waves. Get approval. Then execute.
Wave 1: Implement everything in the spec
If a wave touches more than 5-8 files, it's too big. Break it down.
Code diverges from spec but spec is never updated
The spec is a living document. Every commit should leave the spec accurate to what was actually built.
Wave 1: 12 sub-agents all running at once
More than 3-4 parallel sub-agents gets chaotic. Group related tasks and keep parallelism manageable.
Before starting:
For each wave:
After all waves: