@@ -18,37 +18,57 @@ You **MUST** consider the user input before proceeding (if not empty).
18181 . ** Setup** : Run ` {SCRIPT} ` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute.
1919
20202 . ** Load design documents** : Read from FEATURE_DIR:
21- - ** Required** : plan.md (tech stack, libraries, structure)
21+ - ** Required** : plan.md (tech stack, libraries, structure), spec.md (user stories with priorities)
2222 - ** Optional** : data-model.md (entities), contracts/ (API endpoints), research.md (decisions), quickstart.md (test scenarios)
2323 - Note: Not all projects have all documents. Generate tasks based on what's available.
2424
25253 . ** Execute task generation workflow** (follow the template structure):
2626 - Load plan.md and extract tech stack, libraries, project structure
27- - If data-model.md exists: Extract entities → generate model tasks
28- - If contracts/ exists: Each file → generate endpoint/API tasks
27+ - ** Load spec.md and extract user stories with their priorities (P1, P2, P3, etc.)**
28+ - If data-model.md exists: Extract entities → map to user stories
29+ - If contracts/ exists: Each file → map endpoints to user stories
2930 - If research.md exists: Extract decisions → generate setup tasks
30- - Generate tasks by category: Setup, Core Implementation, Integration, Polish
31+ - ** Generate tasks ORGANIZED BY USER STORY** :
32+ - Setup tasks (shared infrastructure needed by all stories)
33+ - ** Foundational tasks (prerequisites that must complete before ANY user story can start)**
34+ - For each user story (in priority order P1, P2, P3...):
35+ - Group all tasks needed to complete JUST that story
36+ - Include models, services, endpoints, UI components specific to that story
37+ - Mark which tasks are [ P] parallelizable
38+ - If tests requested: Include tests specific to that story
39+ - Polish/Integration tasks (cross-cutting concerns)
3140 - ** Tests are OPTIONAL** : Only generate test tasks if explicitly requested in the feature spec or user asks for TDD approach
3241 - Apply task rules:
33- * Different files = mark [ P] for parallel
34- * Same file = sequential (no [ P] )
35- * If tests requested: Tests before implementation (TDD order)
42+ - Different files = mark [ P] for parallel
43+ - Same file = sequential (no [ P] )
44+ - If tests requested: Tests before implementation (TDD order)
3645 - Number tasks sequentially (T001, T002...)
37- - Generate dependency graph
38- - Create parallel execution examples
39- - Validate task completeness (all entities have implementations, all endpoints covered )
46+ - Generate dependency graph showing user story completion order
47+ - Create parallel execution examples per user story
48+ - Validate task completeness (each user story has all needed tasks, independently testable )
4049
41504 . ** Generate tasks.md** : Use ` .specify/templates/tasks-template.md ` as structure, fill with:
4251 - Correct feature name from plan.md
43- - Numbered tasks (T001, T002...) in dependency order
52+ - Phase 1: Setup tasks (project initialization)
53+ - Phase 2: Foundational tasks (blocking prerequisites for all user stories)
54+ - Phase 3+: One phase per user story (in priority order from spec.md)
55+ - Each phase includes: story goal, independent test criteria, tests (if requested), implementation tasks
56+ - Clear [ Story] labels (US1, US2, US3...) for each task
57+ - [ P] markers for parallelizable tasks within each story
58+ - Checkpoint markers after each story phase
59+ - Final Phase: Polish & cross-cutting concerns
60+ - Numbered tasks (T001, T002...) in execution order
4461 - Clear file paths for each task
45- - [ P] markers for parallelizable tasks
46- - Phase groupings based on what's needed (Setup, Core Implementation, Integration, Polish)
47- - If tests requested: Include separate "Tests First (TDD)" phase before Core Implementation
48- - Dependency notes
62+ - Dependencies section showing story completion order
63+ - Parallel execution examples per story
64+ - Implementation strategy section (MVP first, incremental delivery)
4965
50- 5 . ** Report** : Output path to generated tasks.md and summary of task counts by phase.
51- - Parallel execution guidance
66+ 5 . ** Report** : Output path to generated tasks.md and summary:
67+ - Total task count
68+ - Task count per user story
69+ - Parallel opportunities identified
70+ - Independent test criteria for each story
71+ - Suggested MVP scope (typically just User Story 1)
5272
5373Context for task generation: {ARGS}
5474
@@ -58,20 +78,38 @@ The tasks.md should be immediately executable - each task must be specific enoug
5878
5979** IMPORTANT** : Tests are optional. Only generate test tasks if the user explicitly requested testing or TDD approach in the feature specification.
6080
61- 1 . ** From Contracts** :
62- - Each contract/endpoint → implementation task
63- - If tests requested: Each contract → contract test task [ P] before implementation
81+ ** CRITICAL** : Tasks MUST be organized by user story to enable independent implementation and testing.
82+
83+ 1 . ** From User Stories (spec.md)** - PRIMARY ORGANIZATION:
84+ - Each user story (P1, P2, P3...) gets its own phase
85+ - Map all related components to their story:
86+ - Models needed for that story
87+ - Services needed for that story
88+ - Endpoints/UI needed for that story
89+ - If tests requested: Tests specific to that story
90+ - Mark story dependencies (most stories should be independent)
91+
92+ 2 . ** From Contracts** :
93+ - Map each contract/endpoint → to the user story it serves
94+ - If tests requested: Each contract → contract test task [ P] before implementation in that story's phase
6495
65- 2 . ** From Data Model** :
66- - Each entity → model creation task [ P]
67- - Relationships → service layer tasks
96+ 3 . ** From Data Model** :
97+ - Map each entity → to the user story(ies) that need it
98+ - If entity serves multiple stories: Put in earliest story or Setup phase
99+ - Relationships → service layer tasks in appropriate story phase
68100
69- 3 . ** From User Stories** :
70- - Each story → implementation tasks
71- - If tests requested: Each story → integration test [ P]
72- - If quickstart.md exists: Validation tasks
73-
74- 4 . ** Ordering** :
75- - Without tests: Setup → Models → Services → Endpoints → Integration → Polish
76- - With tests (TDD): Setup → Tests → Models → Services → Endpoints → Integration → Polish
77- - Dependencies block parallel execution
101+ 4 . ** From Setup/Infrastructure** :
102+ - Shared infrastructure → Setup phase (Phase 1)
103+ - Foundational/blocking tasks → Foundational phase (Phase 2)
104+ - Examples: Database schema setup, authentication framework, core libraries, base configurations
105+ - These MUST complete before any user story can be implemented
106+ - Story-specific setup → within that story's phase
107+
108+ 5 . ** Ordering** :
109+ - Phase 1: Setup (project initialization)
110+ - Phase 2: Foundational (blocking prerequisites - must complete before user stories)
111+ - Phase 3+: User Stories in priority order (P1, P2, P3...)
112+ - Within each story: Tests (if requested) → Models → Services → Endpoints → Integration
113+ - Final Phase: Polish & Cross-Cutting Concerns
114+ - Each user story phase should be a complete, independently testable increment
115+
0 commit comments