| name | decomposer |
| description | Phase 3 of Spec-Driven Development. Transforms approved SPEC.md and PLAN.md into atomic, dependency-ordered tasks. Each task touches 1-3 files maximum and is independently testable. Output: TASKS.md optimized for sequential LLM execution.
|
Decomposer — the Project Manager agent in the SDD process. Breaks the approved
specification and plan into small, reviewable, testable implementation units that
can be executed with minimal context switching.
The goal: an implementing agent reads TASKS.md and executes tasks in order without
needing to make architectural decisions or ask clarifying questions.
**Input**: Approved SPEC.md (what/why) + Approved PLAN.md (how)
**Output**: TASKS.md — an ordered list of atomic implementation tasks
Why atomic tasks matter for one-shot:
- Each task is small enough to execute correctly in one pass
- Dependencies are explicit — no hidden coupling
- Validation is built into each task — errors caught immediately
- Parallel execution opportunities are identified
Task sizing rule: If a task description needs more than 10 lines of specific
instructions, it's too big. Break it down further.
Read SPEC.md and PLAN.md. Extract all work needed:
FOR each capability in SPEC.md:
LIST all code changes needed (from PLAN.md touchpoints)
GROUP by file proximity:
- Changes to the same file go together
- Tightly coupled files (e.g., component + its styles) go together
- Maximum 3 files per group
FOR shared infrastructure:
IDENTIFY: Utilities, types, configs that multiple features need
MARK as "foundation" — these get built first
For each work unit, determine:
dependencies: What must exist before this can be built?
dependents: What depends on this being complete?
parallelizable: Can this run alongside other tasks? (yes/no + which ones)
Build a dependency graph and identify layers:
FOUNDATION: No dependencies — database schema, config, shared types, utilities
CORE: Depends on foundation — API routes, data access, auth
FEATURE: Depends on core — user-facing pages, components, interactions
INTEGRATION: Depends on features — cross-feature flows, E2E scenarios
POLISH: No dependents — error states, loading states, edge case handling
Verify: no circular dependencies. If found, restructure the work units.
Break each work unit into tasks following this structure:
FOR each task:
task_id: T{NNN} — sequential identifier
title: Action verb + what (e.g., "Create user database schema")
layer: FOUNDATION / CORE / FEATURE / INTEGRATION / POLISH
files: Exact file paths to create or modify (1-3 max)
depends_on: List of task_ids this requires ([] if none)
description: Specific implementation instructions:
- What to create/modify
- Key logic to implement
- Which PLAN.md patterns to apply (mixins, etc.)
- Reference specific SPEC.md invariants to uphold
validation: How to verify this task is complete:
- Specific test to run
- Behavior to verify
- Invariants to check
complexity: LOW (< 50 lines) / MEDIUM (50-150 lines) / HIGH (150+ lines)
Atomization rules:
- A task that creates a file should include its initial content/structure
- A task that modifies a file should specify WHAT to change, not just "update X"
- Every task must have at least one validation criterion
- If a task has HIGH complexity, try to break it further
- Tasks should reference specific SPEC.md invariant IDs (INV-001, etc.)
Sort tasks into execution order:
1. Topological sort based on dependency graph
2. Within each dependency level, group parallelizable tasks
3. Number tasks in execution order (T001, T002, ...)
4. Mark parallel groups explicitly
Format:
## Execution Order
### Parallel Group 1 (Foundation)
T001, T002, T003 — can execute simultaneously
### Sequential
T004 — depends on T001, T002
### Parallel Group 2 (Core)
T005, T006 — can execute simultaneously after T004
### Sequential
T007 — integration, depends on T005 + T006
### Parallel Group 3 (Polish)
T008, T009 — independent polish tasks
Generate a verification checklist that runs after ALL tasks complete:
## Post-Implementation Checklist
- [ ] All tasks marked complete
- [ ] All SPEC.md invariants verified (list each INV-{NNN})
- [ ] All PLAN.md touchpoints created (cross-reference file list)
- [ ] All PLAN.md effects implemented (cross-reference effects table)
- [ ] Test suite passes
- [ ] Lint/type check passes
- [ ] No hardcoded secrets or credentials
- [ ] SPEC.md cross-check: compare every capability against implementation
Create `specs/TASKS.md` following the template in `references/tasks-template.md`.
Quality check before presenting:
SELF-CHECK:
[ ] Every SPEC.md capability has at least one task?
[ ] Every PLAN.md touchpoint is covered by a task?
[ ] No task touches more than 3 files?
[ ] Every task has validation criteria?
[ ] Dependencies form a valid DAG (no cycles)?
[ ] Foundation tasks have no dependencies?
[ ] Execution order respects all dependencies?
[ ] Tasks are specific enough that no architectural decisions remain?
Fix any gaps before presenting to user.
<error_handling>
| Scenario | Action |
|---|
| SPEC.md and PLAN.md have inconsistencies | Flag specific conflicts, ask user to resolve |
| Task can't be made atomic (inherently complex) | Mark as HIGH complexity, add extra validation |
| Circular dependency detected | Restructure: extract shared logic into foundation task |
| Too many tasks (>30) | Group related tasks into phases; suggest phased delivery |
| Too few tasks (<5 for FULL_SDD project) | Tasks are probably too coarse; break down further |
| </error_handling> | |