For each unit, identify:
- File path (exact, following codebase conventions)
- Action: create or modify
- Domain: database | api | shared | frontend | test | config | docs
- Dependencies: which other units must exist first
Standard dependency ordering (lower layers before higher):
- Shared types, constants, i18n keys, env variables
- Database migrations and schema updates
- API routes, handlers, validation schemas
- Shared hooks, utilities, helper functions
- UI components (atoms → molecules → organisms)
- Pages and routes composing components
- Tests (unit, integration, E2E)
- Config and infrastructure changes
- Documentation updates
Orphan-free rule — every consumer of a resource must be in the same task as its producer OR in a later task that explicitly depends on the producer's task:
- New i18n key + every component using that key → same task (or key in TASK_N, component in TASK_M where M > N and TASK_M depends on TASK_N)
- New database column + migration that adds it → same task
- New shared type + every immediate consumer → same task
- New component + the page that renders it → same task (unless page is intentionally deferred to a later task)
Rule 1 — 30-file limit: a task may create or modify at most 30 files. If a natural group exceeds this, split on domain boundaries (data layer, API layer, UI layer, test layer).
Rule 2 — Production-ready delivery: every task, when merged in order, must leave the application in a runnable state — no broken imports, unresolved references, orphaned i18n keys, or missing migrations.
Rule 3 — Forward dependency only: if TASK_N requires output from TASK_M, then M < N. No task may depend on a later task.
Rule 4 — Mergeable without breaking: use feature flags, graceful degradation, or empty-state handling so earlier tasks don't expose incomplete UX to end users.
Rule 5 — Clear value delivery: each task must deliver a demonstrable increment — a working endpoint, a rendered component, a passing test suite. Avoid tasks with no visible or testable outcome.
Recommended grouping (adapt per feature):
- Foundation — shared types, constants, i18n keys, env variables
- Data layer — database schema, migrations, ORM models
- API layer — routes, handlers, validation schemas, error codes
- Core UI — reusable components, hooks, state management
- Feature pages — pages and routes composing the core UI
- Tests & polish — comprehensive test suites, accessibility audit, performance tuning
- Documentation — CLAUDE.md updates, API docs, migration guides
Split tasks at domain boundaries when a group would exceed 30 files.
Success criteria — select PRD acceptance criteria that apply to this task's scope. Write them as testable assertions:
- "POST /api/resource returns 201 with the created resource payload" (not "API works")
- "Page renders the empty state at 1440px without console errors" (not "page looks right")
- "Migration runs cleanly on an empty database" (not "migration works")
Baseline checks — what to capture BEFORE making changes:
- Standard quality gates: tsc, lint, test, build (pass/fail and counts)
- Domain-specific: API endpoints (HTTP status + timing), pages (screenshot + LCP), schema state (table columns and types)
Post-change checks — what to verify AFTER changes, mapped 1:1 to each success criterion.
Performance benchmarks — from PRD NFRs or domain defaults:
- API endpoints: p95 response time target
- Frontend pages: LCP target, bundle size delta
- Database queries: execution time target
Non-functional requirements — scope PRD NFRs to this task's domain:
- Database task → data integrity, migration rollback safety, index strategy
- API task → input validation coverage, auth guard presence, rate limiting
- Frontend task → WCAG compliance level, responsive breakpoints, keyboard navigation
Before saving, validate each document:
Fix any violation before saving.
After saving all tasks, print a summary table:
| Task |
Title |
Files |
Depends on |
Key deliverable |
| TASK_01 |
... |
N files |
none |
... |
| TASK_02 |
... |
N files |
TASK_01 |
... |
|
|
|
|
|
1---2name: generate-task3description: Breaks a PRD into ordered, production-ready engineering tasks ready for execution by /execute-task. Use when: (1) converting a PRD document into executable engineering tasks, (2) planning feature delivery as a sequence of mergeable, self-contained pull requests, (3) the user says 'generate tasks', 'break down this PRD', 'create tasks from PRD', 'plan the implementation tasks', or 'task breakdown'. Each generated task document embeds its own success criteria, baseline checks, post-change tests, performance benchmarks, and non-functional requirements — making it directly executable by /execute-task.4---56<prd>7$ARGUMENTS8</prd>910<workflow>11Follow each phase in order.1213<phase_1_read_prd>14Read the PRD document fully. Extract and organize:15- Functional requirements — numbered, atomic conditions16- Acceptance criteria — how feature completion is verified17- Non-functional requirements — performance, security, accessibility, scalability targets18- Scope — what is included and what is explicitly excluded19- User journeys — key flows and their steps20- Success metrics and KPIs21</phase_1_read_prd>2223<phase_2_analyze_codebase>24Before decomposing tasks, understand the target project:251. Read CLAUDE.md and root package.json — project structure, package manager, tech stack, key directories.262. Identify where implementation units live — backend routes, frontend pages, shared types, database schemas, tests.273. Search for patterns similar to the feature being built — use Grep/Glob to find related files and establish co-location conventions.284. List the domain areas the feature touches — database, API, shared, frontend, tests, config.29</phase_2_analyze_codebase>3031<phase_3_identify_implementation_units>32Map every PRD requirement to concrete implementation units. An implementation unit is any atomic change: a new schema, a route, a component, a migration, a shared type, a test file, a config entry, an i18n key.3334For each unit, identify:35- **File path** (exact, following codebase conventions)36- **Action**: create or modify37- **Domain**: database | api | shared | frontend | test | config | docs38- **Dependencies**: which other units must exist first3940**Standard dependency ordering** (lower layers before higher):411. Shared types, constants, i18n keys, env variables422. Database migrations and schema updates433. API routes, handlers, validation schemas444. Shared hooks, utilities, helper functions455. UI components (atoms → molecules → organisms)466. Pages and routes composing components477. Tests (unit, integration, E2E)488. Config and infrastructure changes499. Documentation updates5051**Orphan-free rule** — every consumer of a resource must be in the same task as its producer OR in a later task that explicitly depends on the producer's task:52- New i18n key + every component using that key → same task (or key in TASK_N, component in TASK_M where M > N and TASK_M depends on TASK_N)53- New database column + migration that adds it → same task54- New shared type + every immediate consumer → same task55- New component + the page that renders it → same task (unless page is intentionally deferred to a later task)56</phase_3_identify_implementation_units>5758<phase_4_group_into_tasks>59Group implementation units into tasks. Apply these rules in order:6061**Rule 1 — 30-file limit**: a task may create or modify at most 30 files. If a natural group exceeds this, split on domain boundaries (data layer, API layer, UI layer, test layer).6263**Rule 2 — Production-ready delivery**: every task, when merged in order, must leave the application in a runnable state — no broken imports, unresolved references, orphaned i18n keys, or missing migrations.6465**Rule 3 — Forward dependency only**: if TASK_N requires output from TASK_M, then M < N. No task may depend on a later task.6667**Rule 4 — Mergeable without breaking**: use feature flags, graceful degradation, or empty-state handling so earlier tasks don't expose incomplete UX to end users.6869**Rule 5 — Clear value delivery**: each task must deliver a demonstrable increment — a working endpoint, a rendered component, a passing test suite. Avoid tasks with no visible or testable outcome.7071**Recommended grouping** (adapt per feature):721. **Foundation** — shared types, constants, i18n keys, env variables732. **Data layer** — database schema, migrations, ORM models743. **API layer** — routes, handlers, validation schemas, error codes754. **Core UI** — reusable components, hooks, state management765. **Feature pages** — pages and routes composing the core UI776. **Tests & polish** — comprehensive test suites, accessibility audit, performance tuning787. **Documentation** — CLAUDE.md updates, API docs, migration guides7980Split tasks at domain boundaries when a group would exceed 30 files.81</phase_4_group_into_tasks>8283<phase_5_define_verification_criteria>84For each task, derive its verification criteria from the PRD. These become binding requirements embedded in the task document and executed by /execute-task.8586**Success criteria** — select PRD acceptance criteria that apply to this task's scope. Write them as testable assertions:87- "POST /api/resource returns 201 with the created resource payload" (not "API works")88- "Page renders the empty state at 1440px without console errors" (not "page looks right")89- "Migration runs cleanly on an empty database" (not "migration works")9091**Baseline checks** — what to capture BEFORE making changes:92- Standard quality gates: tsc, lint, test, build (pass/fail and counts)93- Domain-specific: API endpoints (HTTP status + timing), pages (screenshot + LCP), schema state (table columns and types)9495**Post-change checks** — what to verify AFTER changes, mapped 1:1 to each success criterion.9697**Performance benchmarks** — from PRD NFRs or domain defaults:98- API endpoints: p95 response time target99- Frontend pages: LCP target, bundle size delta100- Database queries: execution time target101102**Non-functional requirements** — scope PRD NFRs to this task's domain:103- Database task → data integrity, migration rollback safety, index strategy104- API task → input validation coverage, auth guard presence, rate limiting105- Frontend task → WCAG compliance level, responsive breakpoints, keyboard navigation106</phase_5_define_verification_criteria>107108<phase_6_generate_task_documents>109Generate a document for each task using the template from [template.md](template.md).110111Before saving, validate each document:112- [ ] File count ≤ 30113- [ ] No file path appears in more than one task114- [ ] Every success criterion is testable (specific, measurable outcome)115- [ ] Every "create" file has its consumer in the same or a later task116- [ ] Task N's dependencies all have numbers < N117- [ ] Baseline checks include at minimum: tsc, lint, test, build118119Fix any violation before saving.120</phase_6_generate_task_documents>121</workflow>122123<output>124Save each task document to:125```126[project-root]/docs/features/[FEATURE_NAME]/TASK_[TASK_NUMBER].md127```128129After saving all tasks, print a summary table:130131| Task | Title | Files | Depends on | Key deliverable |132|------|-------|-------|------------|-----------------|133| TASK_01 | ... | N files | none | ... |134| TASK_02 | ... | N files | TASK_01 | ... |135</output>