Skip to content

Commit f1b749f

Browse files
feat: add explicit task dependency declarations and execution wave DAG (github#1934)
Add `(depends on T###)` suffix to the task format for explicit inter-task dependency tracking. This enables AI agents to identify which tasks can run in parallel and which must wait. Changes: - tasks-template.md: Document dependency suffix in format section, add dependency annotations to sample tasks, replace Parallel Example section with structured Execution Wave DAG - commands/tasks.md: Add dependency suffix as format component github#6, instruct task generation to include Wave DAG section Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 parent 94ba857 commit f1b749f

2 files changed

Lines changed: 61 additions & 25 deletions

File tree

‎templates/commands/tasks.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,9 @@ You **MUST** consider the user input before proceeding (if not empty).
8585
- Final Phase: Polish & cross-cutting concerns
8686
- All tasks must follow the strict checklist format (see Task Generation Rules below)
8787
- Clear file paths for each task
88+
- Explicit `(depends on T###, T###)` suffix on every task that has dependencies on other tasks
89+
- An **Execution Wave DAG** section that groups tasks into waves by dependency resolution — tasks within the same wave can run in parallel, each wave starts after its dependencies complete
8890
- Dependencies section showing story completion order
89-
- Parallel execution examples per story
9091
- Implementation strategy section (MVP first, incremental delivery)
9192
9293
5. **Report**: Output path to generated tasks.md and summary:
@@ -141,7 +142,7 @@ The tasks.md should be immediately executable - each task must be specific enoug
141142
Every task MUST strictly follow this format:
142143
143144
```text
144-
- [ ] [TaskID] [P?] [Story?] Description with file path
145+
- [ ] [TaskID] [P?] [Story?] Description with file path [(depends on ...)]
145146
```
146147

147148
**Format Components**:
@@ -152,17 +153,18 @@ Every task MUST strictly follow this format:
152153
4. **[Story] label**: REQUIRED for user story phase tasks only
153154
- Format: [US1], [US2], [US3], etc. (maps to user stories from spec.md)
154155
- Setup phase: NO story label
155-
- Foundational phase: NO story label
156+
- Foundational phase: NO story label
156157
- User Story phases: MUST have story label
157158
- Polish phase: NO story label
158159
5. **Description**: Clear action with exact file path
160+
6. **(depends on ...)**: Append at end if the task depends on specific other task IDs. Omit if the task has no dependencies within its phase. Use comma-separated IDs for multiple dependencies.
159161

160162
**Examples**:
161163

162164
- ✅ CORRECT: `- [ ] T001 Create project structure per implementation plan`
163165
- ✅ CORRECT: `- [ ] T005 [P] Implement authentication middleware in src/middleware/auth.py`
164166
- ✅ CORRECT: `- [ ] T012 [P] [US1] Create User model in src/models/user.py`
165-
- ✅ CORRECT: `- [ ] T014 [US1] Implement UserService in src/services/user_service.py`
167+
- ✅ CORRECT: `- [ ] T014 [US1] Implement UserService in src/services/user_service.py (depends on T012, T013)`
166168
- ❌ WRONG: `- [ ] Create User model` (missing ID and Story label)
167169
- ❌ WRONG: `T001 [US1] Create model` (missing checkbox)
168170
- ❌ WRONG: `- [ ] [US1] Create User model` (missing Task ID)

‎templates/tasks-template.md‎

Lines changed: 55 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ description: "Task list template for feature implementation"
1212

1313
**Organization**: Tasks are grouped by user story to enable independent implementation and testing of each story.
1414

15-
## Format: `[ID] [P?] [Story] Description`
15+
## Format: `[ID] [P?] [Story] Description [(depends on ...)]`
1616

1717
- **[P]**: Can run in parallel (different files, no dependencies)
1818
- **[Story]**: Which user story this task belongs to (e.g., US1, US2, US3)
19+
- **(depends on ...)**: Explicit dependency on other task IDs. Omit if task has no dependencies within its phase.
1920
- Include exact file paths in descriptions
2021

2122
## Path Conventions
@@ -49,8 +50,8 @@ description: "Task list template for feature implementation"
4950
**Purpose**: Project initialization and basic structure
5051

5152
- [ ] T001 Create project structure per implementation plan
52-
- [ ] T002 Initialize [language] project with [framework] dependencies
53-
- [ ] T003 [P] Configure linting and formatting tools
53+
- [ ] T002 Initialize [language] project with [framework] dependencies (depends on T001)
54+
- [ ] T003 [P] Configure linting and formatting tools (depends on T001)
5455

5556
---
5657

@@ -65,7 +66,7 @@ Examples of foundational tasks (adjust based on your project):
6566
- [ ] T004 Setup database schema and migrations framework
6667
- [ ] T005 [P] Implement authentication/authorization framework
6768
- [ ] T006 [P] Setup API routing and middleware structure
68-
- [ ] T007 Create base models/entities that all stories depend on
69+
- [ ] T007 Create base models/entities that all stories depend on (depends on T004)
6970
- [ ] T008 Configure error handling and logging infrastructure
7071
- [ ] T009 Setup environment configuration management
7172

@@ -91,9 +92,9 @@ Examples of foundational tasks (adjust based on your project):
9192
- [ ] T012 [P] [US1] Create [Entity1] model in src/models/[entity1].py
9293
- [ ] T013 [P] [US1] Create [Entity2] model in src/models/[entity2].py
9394
- [ ] T014 [US1] Implement [Service] in src/services/[service].py (depends on T012, T013)
94-
- [ ] T015 [US1] Implement [endpoint/feature] in src/[location]/[file].py
95-
- [ ] T016 [US1] Add validation and error handling
96-
- [ ] T017 [US1] Add logging for user story 1 operations
95+
- [ ] T015 [US1] Implement [endpoint/feature] in src/[location]/[file].py (depends on T014)
96+
- [ ] T016 [US1] Add validation and error handling (depends on T015)
97+
- [ ] T017 [US1] Add logging for user story 1 operations (depends on T015)
9798

9899
**Checkpoint**: At this point, User Story 1 should be fully functional and testable independently
99100

@@ -113,9 +114,9 @@ Examples of foundational tasks (adjust based on your project):
113114
### Implementation for User Story 2
114115

115116
- [ ] T020 [P] [US2] Create [Entity] model in src/models/[entity].py
116-
- [ ] T021 [US2] Implement [Service] in src/services/[service].py
117-
- [ ] T022 [US2] Implement [endpoint/feature] in src/[location]/[file].py
118-
- [ ] T023 [US2] Integrate with User Story 1 components (if needed)
117+
- [ ] T021 [US2] Implement [Service] in src/services/[service].py (depends on T020)
118+
- [ ] T022 [US2] Implement [endpoint/feature] in src/[location]/[file].py (depends on T021)
119+
- [ ] T023 [US2] Integrate with User Story 1 components (if needed) (depends on T022)
119120

120121
**Checkpoint**: At this point, User Stories 1 AND 2 should both work independently
121122

@@ -135,8 +136,8 @@ Examples of foundational tasks (adjust based on your project):
135136
### Implementation for User Story 3
136137

137138
- [ ] T026 [P] [US3] Create [Entity] model in src/models/[entity].py
138-
- [ ] T027 [US3] Implement [Service] in src/services/[service].py
139-
- [ ] T028 [US3] Implement [endpoint/feature] in src/[location]/[file].py
139+
- [ ] T027 [US3] Implement [Service] in src/services/[service].py (depends on T026)
140+
- [ ] T028 [US3] Implement [endpoint/feature] in src/[location]/[file].py (depends on T027)
140141

141142
**Checkpoint**: All user stories should now be independently functional
142143

@@ -195,16 +196,48 @@ Examples of foundational tasks (adjust based on your project):
195196

196197
---
197198

198-
## Parallel Example: User Story 1
199+
## Execution Wave DAG
199200

200-
```bash
201-
# Launch all tests for User Story 1 together (if tests requested):
202-
Task: "Contract test for [endpoint] in tests/contract/test_[name].py"
203-
Task: "Integration test for [user journey] in tests/integration/test_[name].py"
201+
Tasks grouped by dependency resolution. Tasks within the same wave can run in parallel.
204202

205-
# Launch all models for User Story 1 together:
206-
Task: "Create [Entity1] model in src/models/[entity1].py"
207-
Task: "Create [Entity2] model in src/models/[entity2].py"
203+
```text
204+
Wave 1 (no dependencies):
205+
T001 Create project structure
206+
207+
Wave 2 (T001 done):
208+
T002 Initialize project (depends on T001)
209+
T003 Configure linting (depends on T001)
210+
211+
Wave 3 (Phase 2 — T002, T003 done):
212+
T004 Setup database schema
213+
T005 Implement auth framework [P]
214+
T006 Setup API routing [P]
215+
T008 Configure error handling [P]
216+
T009 Setup environment config [P]
217+
218+
Wave 4 (T004 done):
219+
T007 Create base models (depends on T004)
220+
221+
Wave 5 (Phase 2 complete — User Stories can begin in parallel):
222+
T010 [US1] Contract test [P]
223+
T011 [US1] Integration test [P]
224+
T012 [US1] Create Entity1 model [P]
225+
T013 [US1] Create Entity2 model [P]
226+
T018 [US2] Contract test [P]
227+
T020 [US2] Create Entity model [P]
228+
229+
Wave 6:
230+
T014 [US1] Implement Service (depends on T012, T013)
231+
T021 [US2] Implement Service (depends on T020)
232+
233+
Wave 7:
234+
T015 [US1] Implement endpoint (depends on T014)
235+
T022 [US2] Implement endpoint (depends on T021)
236+
237+
Wave 8:
238+
T016 [US1] Validation (depends on T015) [P]
239+
T017 [US1] Logging (depends on T015) [P]
240+
T023 [US2] Integrate with US1 (depends on T022)
208241
```
209242

210243
---
@@ -242,7 +275,8 @@ With multiple developers:
242275

243276
## Notes
244277

245-
- [P] tasks = different files, no dependencies
278+
- [P] tasks = different files, no dependencies on incomplete tasks
279+
- (depends on ...) = explicit dependency on other task IDs; omit if no dependencies within the phase
246280
- [Story] label maps task to specific user story for traceability
247281
- Each user story should be independently completable and testable
248282
- Verify tests fail before implementing

0 commit comments

Comments
 (0)