bmad-method 6.0.0-alpha.4 → 6.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/.claude/commands/bmad/bmm/agents/architect.md +0 -1
  2. package/.claude/commands/bmad/bmm/agents/sm.md +1 -1
  3. package/.claude/commands/bmad/bmm/agents/tech-writer.md +82 -0
  4. package/.claude/commands/bmad/bmm/workflows/README.md +1 -1
  5. package/.claude/commands/bmad/bmm/workflows/epic-tech-context.md +15 -0
  6. package/.claude/commands/bmad/core/workflows/README.md +10 -0
  7. package/.claude/settings.local.json +4 -8
  8. package/CHANGELOG.md +305 -0
  9. package/README.md +88 -39
  10. package/bmad/_cfg/agent-manifest.csv +2 -1
  11. package/bmad/_cfg/agents/bmm-tech-writer.customize.yaml +42 -0
  12. package/bmad/_cfg/files-manifest.csv +40 -62
  13. package/bmad/_cfg/ides/claude-code.yaml +1 -1
  14. package/bmad/_cfg/manifest.yaml +4 -3
  15. package/bmad/_cfg/task-manifest.csv +4 -1
  16. package/bmad/_cfg/tool-manifest.csv +1 -0
  17. package/bmad/_cfg/workflow-manifest.csv +3 -1
  18. package/bmad/bmb/config.yaml +2 -2
  19. package/bmad/bmb/workflows/audit-workflow/instructions.md +1 -1
  20. package/bmad/bmm/README.md +79 -120
  21. package/bmad/bmm/README.md.bak +169 -0
  22. package/bmad/bmm/agents/analyst.md.bak +67 -0
  23. package/bmad/bmm/agents/architect.md +0 -1
  24. package/bmad/bmm/agents/architect.md.bak +73 -0
  25. package/bmad/bmm/agents/dev.md.bak +69 -0
  26. package/bmad/bmm/agents/pm.md.bak +76 -0
  27. package/bmad/bmm/agents/sm.md +1 -1
  28. package/bmad/bmm/agents/sm.md.bak +85 -0
  29. package/bmad/bmm/agents/tea.md.bak +72 -0
  30. package/bmad/bmm/agents/tech-writer.md +82 -0
  31. package/bmad/bmm/agents/ux-designer.md.bak +71 -0
  32. package/bmad/bmm/config.yaml +2 -2
  33. package/bmad/bmm/docs/README.md +235 -0
  34. package/bmad/bmm/docs/agents-guide.md +1057 -0
  35. package/bmad/bmm/docs/brownfield-guide.md +471 -972
  36. package/bmad/bmm/docs/enterprise-agentic-development.md +680 -0
  37. package/bmad/bmm/docs/faq.md +589 -0
  38. package/bmad/bmm/docs/glossary.md +321 -0
  39. package/bmad/bmm/docs/party-mode.md +224 -0
  40. package/bmad/bmm/docs/quick-spec-flow.md +64 -57
  41. package/bmad/bmm/docs/quick-start.md +72 -47
  42. package/bmad/bmm/docs/scale-adaptive-system.md +332 -778
  43. package/bmad/bmm/docs/troubleshooting.md +680 -0
  44. package/bmad/bmm/{workflows/3-solutioning/architecture/README.md → docs/workflow-architecture-reference.md} +130 -77
  45. package/bmad/bmm/{workflows/document-project/README.md → docs/workflow-document-project-reference.md} +45 -2
  46. package/bmad/bmm/docs/workflows-analysis.md +670 -0
  47. package/bmad/bmm/docs/workflows-implementation.md +1758 -0
  48. package/bmad/bmm/docs/workflows-planning.md +1086 -0
  49. package/bmad/bmm/docs/workflows-solutioning.md +726 -0
  50. package/bmad/bmm/tasks/daily-standup.xml +1 -1
  51. package/bmad/bmm/workflows/2-plan-workflows/tech-spec/workflow.yaml.bak +60 -0
  52. package/bmad/bmm/workflows/4-implementation/epic-tech-context/workflow.yaml +1 -1
  53. package/bmad/bmm/workflows/techdoc/documentation-standards.md +2 -1
  54. package/bmad/bmm/workflows/techdoc/documentation-standards.md.bak +238 -0
  55. package/bmad/bmm/workflows/workflow-status/init/instructions.md +623 -242
  56. package/bmad/bmm/workflows/workflow-status/init/workflow.yaml.bak +27 -0
  57. package/bmad/bmm/workflows/workflow-status/paths/enterprise-brownfield.yaml +120 -0
  58. package/bmad/bmm/workflows/workflow-status/paths/enterprise-greenfield.yaml +108 -0
  59. package/{src/modules/bmm/workflows/workflow-status/paths/brownfield-level-3.yaml → bmad/bmm/workflows/workflow-status/paths/method-brownfield.yaml} +33 -31
  60. package/{src/modules/bmm/workflows/workflow-status/paths/greenfield-level-2.yaml → bmad/bmm/workflows/workflow-status/paths/method-greenfield.yaml} +31 -21
  61. package/{src/modules/bmm/workflows/workflow-status/paths/brownfield-level-1.yaml → bmad/bmm/workflows/workflow-status/paths/quick-flow-brownfield.yaml} +18 -18
  62. package/bmad/bmm/workflows/workflow-status/paths/{greenfield-level-1.yaml → quick-flow-greenfield.yaml} +16 -18
  63. package/bmad/bmm/workflows/workflow-status/workflow-status-template.yaml +4 -4
  64. package/bmad/cis/agents/brainstorming-coach.md.bak +62 -0
  65. package/bmad/cis/agents/creative-problem-solver.md.bak +62 -0
  66. package/bmad/cis/agents/design-thinking-coach.md.bak +62 -0
  67. package/bmad/cis/agents/innovation-strategist.md.bak +62 -0
  68. package/bmad/cis/agents/storyteller.md.bak +59 -0
  69. package/bmad/cis/config.yaml +2 -2
  70. package/bmad/core/agents/bmad-master.md.bak +15 -13
  71. package/bmad/core/config.yaml +2 -2
  72. package/bmad/core/tasks/workflow.xml +1 -11
  73. package/package.json +1 -1
  74. package/src/core/tasks/workflow.xml +1 -11
  75. package/src/modules/bmb/workflows/audit-workflow/instructions.md +1 -1
  76. package/src/modules/bmm/README.md +1 -1
  77. package/src/modules/bmm/agents/architect.agent.yaml +0 -4
  78. package/src/modules/bmm/agents/game-dev.agent.yaml +8 -12
  79. package/src/modules/bmm/agents/sm.agent.yaml +1 -1
  80. package/src/modules/bmm/agents/{paige.agent.yaml → tech-writer.agent.yaml} +4 -4
  81. package/src/modules/bmm/docs/README.md +9 -9
  82. package/src/modules/bmm/docs/agents-guide.md +46 -98
  83. package/src/modules/bmm/docs/brownfield-guide.md +211 -90
  84. package/src/modules/bmm/docs/enterprise-agentic-development.md +380 -740
  85. package/src/modules/bmm/docs/faq.md +10 -10
  86. package/src/modules/bmm/docs/glossary.md +36 -42
  87. package/src/modules/bmm/docs/party-mode.md +110 -1122
  88. package/src/modules/bmm/docs/quick-spec-flow.md +33 -33
  89. package/src/modules/bmm/docs/quick-start.md +29 -29
  90. package/src/modules/bmm/docs/scale-adaptive-system.md +303 -453
  91. package/src/modules/bmm/docs/troubleshooting.md +1 -1
  92. package/src/modules/bmm/docs/workflows-implementation.md +20 -21
  93. package/src/modules/bmm/docs/workflows-solutioning.md +1 -1
  94. package/src/modules/bmm/tasks/daily-standup.xml +1 -1
  95. package/src/modules/bmm/workflows/2-plan-workflows/create-ux-design/instructions.md +1 -19
  96. package/src/modules/bmm/workflows/2-plan-workflows/prd/checklist.md +10 -9
  97. package/src/modules/bmm/workflows/2-plan-workflows/prd/create-epics-and-stories/epics-template.md +23 -34
  98. package/src/modules/bmm/workflows/2-plan-workflows/prd/create-epics-and-stories/instructions.md +105 -331
  99. package/src/modules/bmm/workflows/2-plan-workflows/prd/create-epics-and-stories/workflow.yaml +23 -11
  100. package/src/modules/bmm/workflows/2-plan-workflows/prd/instructions.md +23 -38
  101. package/src/modules/bmm/workflows/2-plan-workflows/prd/workflow.yaml +2 -2
  102. package/src/modules/bmm/workflows/2-plan-workflows/tech-spec/epics-template.md +38 -16
  103. package/src/modules/bmm/workflows/2-plan-workflows/tech-spec/instructions.md +1 -19
  104. package/src/modules/bmm/workflows/2-plan-workflows/tech-spec/user-story-template.md +35 -32
  105. package/src/modules/bmm/workflows/2-plan-workflows/tech-spec/workflow.yaml +2 -2
  106. package/src/modules/bmm/workflows/3-solutioning/architecture/instructions.md +7 -18
  107. package/src/modules/bmm/workflows/3-solutioning/solutioning-gate-check/instructions.md +1 -18
  108. package/src/modules/bmm/workflows/3-solutioning/solutioning-gate-check/workflow.yaml +6 -6
  109. package/src/modules/bmm/workflows/4-implementation/epic-tech-context/workflow.yaml +1 -1
  110. package/src/modules/bmm/workflows/techdoc/documentation-standards.md +1 -1
  111. package/src/modules/bmm/workflows/workflow-status/init/instructions.md +623 -242
  112. package/src/modules/bmm/workflows/workflow-status/paths/enterprise-brownfield.yaml +120 -0
  113. package/src/modules/bmm/workflows/workflow-status/paths/enterprise-greenfield.yaml +108 -0
  114. package/{bmad/bmm/workflows/workflow-status/paths/brownfield-level-3.yaml → src/modules/bmm/workflows/workflow-status/paths/method-brownfield.yaml} +33 -31
  115. package/{bmad/bmm/workflows/workflow-status/paths/greenfield-level-2.yaml → src/modules/bmm/workflows/workflow-status/paths/method-greenfield.yaml} +31 -21
  116. package/{bmad/bmm/workflows/workflow-status/paths/brownfield-level-1.yaml → src/modules/bmm/workflows/workflow-status/paths/quick-flow-brownfield.yaml} +18 -18
  117. package/src/modules/bmm/workflows/workflow-status/paths/{greenfield-level-1.yaml → quick-flow-greenfield.yaml} +16 -18
  118. package/src/modules/bmm/workflows/workflow-status/workflow-status-template.yaml +4 -4
  119. package/bmad/bmm/tasks/retrospective.xml +0 -104
  120. package/bmad/bmm/testarch/README.md +0 -311
  121. package/bmad/bmm/workflows/1-analysis/brainstorm-project/README.md +0 -113
  122. package/bmad/bmm/workflows/1-analysis/product-brief/README.md +0 -180
  123. package/bmad/bmm/workflows/1-analysis/research/README.md +0 -454
  124. package/bmad/bmm/workflows/2-plan-workflows/README.md +0 -258
  125. package/bmad/bmm/workflows/3-solutioning/README.md +0 -1
  126. package/bmad/bmm/workflows/3-solutioning/solutioning-gate-check/README.md +0 -177
  127. package/bmad/bmm/workflows/4-implementation/README.md +0 -221
  128. package/bmad/bmm/workflows/4-implementation/code-review/README.md +0 -69
  129. package/bmad/bmm/workflows/4-implementation/correct-course/README.md +0 -73
  130. package/bmad/bmm/workflows/4-implementation/create-story/README.md +0 -146
  131. package/bmad/bmm/workflows/4-implementation/dev-story/README.md +0 -206
  132. package/bmad/bmm/workflows/4-implementation/epic-tech-context/README.md +0 -195
  133. package/bmad/bmm/workflows/4-implementation/retrospective/README.md +0 -77
  134. package/bmad/bmm/workflows/4-implementation/sprint-planning/README.md +0 -156
  135. package/bmad/bmm/workflows/4-implementation/story-context/README.md +0 -234
  136. package/bmad/bmm/workflows/README.md +0 -256
  137. package/bmad/bmm/workflows/document-project/templates/README.md +0 -38
  138. package/bmad/bmm/workflows/testarch/README.md +0 -26
  139. package/bmad/bmm/workflows/testarch/atdd/README.md +0 -672
  140. package/bmad/bmm/workflows/testarch/automate/README.md +0 -869
  141. package/bmad/bmm/workflows/testarch/ci/README.md +0 -493
  142. package/bmad/bmm/workflows/testarch/framework/README.md +0 -340
  143. package/bmad/bmm/workflows/testarch/nfr-assess/README.md +0 -469
  144. package/bmad/bmm/workflows/testarch/test-design/README.md +0 -493
  145. package/bmad/bmm/workflows/testarch/test-review/README.md +0 -775
  146. package/bmad/bmm/workflows/testarch/trace/README.md +0 -802
  147. package/bmad/bmm/workflows/workflow-status/README.md +0 -260
  148. package/bmad/bmm/workflows/workflow-status/paths/brownfield-level-0.yaml +0 -54
  149. package/bmad/bmm/workflows/workflow-status/paths/brownfield-level-2.yaml +0 -76
  150. package/bmad/bmm/workflows/workflow-status/paths/brownfield-level-4.yaml +0 -88
  151. package/bmad/bmm/workflows/workflow-status/paths/greenfield-level-0.yaml +0 -45
  152. package/bmad/bmm/workflows/workflow-status/paths/greenfield-level-3.yaml +0 -73
  153. package/bmad/bmm/workflows/workflow-status/paths/greenfield-level-4.yaml +0 -75
  154. package/src/modules/bmm/docs/brownfield-guide.md.backup +0 -1324
  155. package/src/modules/bmm/docs/workflows-testing.md +0 -1572
  156. package/src/modules/bmm/workflows/workflow-status/paths/brownfield-level-0.yaml +0 -54
  157. package/src/modules/bmm/workflows/workflow-status/paths/brownfield-level-2.yaml +0 -76
  158. package/src/modules/bmm/workflows/workflow-status/paths/brownfield-level-4.yaml +0 -88
  159. package/src/modules/bmm/workflows/workflow-status/paths/greenfield-level-0.yaml +0 -45
  160. package/src/modules/bmm/workflows/workflow-status/paths/greenfield-level-3.yaml +0 -73
  161. package/src/modules/bmm/workflows/workflow-status/paths/greenfield-level-4.yaml +0 -75
  162. /package/bmad/bmm/agents/{paige.md → paige.md.bak} +0 -0
@@ -0,0 +1,1758 @@
1
+ # BMM Implementation Workflows (Phase 4)
2
+
3
+ **Reading Time:** ~20 minutes
4
+
5
+ ## Overview
6
+
7
+ Phase 4 (Implementation) workflows manage the iterative sprint-based development cycle. This phase uses a **story-centric workflow** where each story moves through a defined lifecycle from creation to completion.
8
+
9
+ **Key principle:** One story at a time, move it through the entire lifecycle before starting the next.
10
+
11
+ ## Quick Reference
12
+
13
+ | Workflow | Agent | Duration | Purpose |
14
+ | --------------------- | ------- | -------------- | ------------------------------------ |
15
+ | **sprint-planning** | SM | 30-60 min | Initialize sprint tracking file |
16
+ | **epic-tech-context** | SM | 15-30 min/epic | Epic-specific technical guidance |
17
+ | **create-story** | SM | 10-20 min | Create next story from epics |
18
+ | **story-context** | PM | 10-15 min | Assemble dynamic story context |
19
+ | **dev-story** | DEV | 2-8 hours | Implement story with tests |
20
+ | **code-review** | DEV | 30-60 min | Senior dev review of completed story |
21
+ | **correct-course** | SM | 30-90 min | Handle mid-sprint changes |
22
+ | **retrospective** | SM | 60-90 min | Post-epic review and lessons |
23
+ | **workflow-status** | All | 2-5 min | Check "what should I do now?" |
24
+ | **document-project** | Analyst | 1-3 hours | Document brownfield projects |
25
+
26
+ ---
27
+
28
+ ## Understanding the Implementation Phase
29
+
30
+ ### Story Lifecycle
31
+
32
+ Every story moves through this lifecycle:
33
+
34
+ ```
35
+ 1. TODO (Not Started)
36
+ ↓ [sprint-planning creates status file]
37
+
38
+ 2. IN PROGRESS (Being Implemented)
39
+ ↓ [create-story generates story file]
40
+ ↓ [story-context assembles context]
41
+ ↓ [dev-story implements with tests]
42
+
43
+ 3. READY FOR REVIEW (Implementation Complete)
44
+ ↓ [code-review validates quality]
45
+
46
+ 4. DONE (Accepted)
47
+ ↓ [story-done marks complete]
48
+ ↓ [Repeat for next story]
49
+ ```
50
+
51
+ ### Sprint-Based Development Model
52
+
53
+ **Sprint Structure:**
54
+
55
+ - **Sprint 0 (Planning)**: Phases 1-3 complete
56
+ - **Sprint 1**: Epic 1 stories (P0/P1)
57
+ - **Sprint 2**: Epic 2 stories (P0/P1)
58
+ - **Sprint 3**: Epic 3+ stories (P0/P1)
59
+ - **Sprint N**: P2/P3 stories, polish
60
+
61
+ **Typical Sprint Timeline:**
62
+
63
+ - Week 1-2: Epic 1 implementation
64
+ - Week 3-4: Epic 2 implementation
65
+ - Week 5-6: Epic 3 implementation
66
+ - Week 7+: Refinement, P2/P3, polish
67
+
68
+ ### Multi-Agent Workflow
69
+
70
+ Phase 4 involves coordination between agents:
71
+
72
+ | Agent | Primary Workflows | Role |
73
+ | ----------- | ------------------------------------------------------------------------------- | -------------------------- |
74
+ | **SM** | sprint-planning, epic-tech-context, create-story, correct-course, retrospective | Orchestration, tracking |
75
+ | **PM** | story-context | Context assembly |
76
+ | **DEV** | dev-story, code-review | Implementation, quality |
77
+ | **Analyst** | document-project | Documentation (brownfield) |
78
+
79
+ ---
80
+
81
+ ## sprint-planning
82
+
83
+ ### Purpose
84
+
85
+ Generate and manage the sprint status tracking file for Phase 4 implementation, extracting all epics and stories from epic files and tracking their status through the development lifecycle.
86
+
87
+ **Agent:** SM (Scrum Master)
88
+ **Phase:** 4 (Implementation)
89
+ **Required:** Yes (first step of Phase 4)
90
+ **Typical Duration:** 30-60 minutes
91
+
92
+ ### When to Use
93
+
94
+ Run **once at the start of Phase 4** after solutioning-gate-check passes (or after PRD for Level 0-2).
95
+
96
+ **Trigger Points:**
97
+
98
+ - solutioning-gate-check PASS (Level 3-4)
99
+ - PRD complete (Level 2)
100
+ - tech-spec complete (Level 0-1)
101
+
102
+ ### Purpose of Sprint Planning
103
+
104
+ **Creates:**
105
+
106
+ - Sprint status tracking file (`sprint-status.yaml`)
107
+ - Story queue (ordered by priority and dependencies)
108
+ - Epic-level tracking
109
+ - Sprint assignments
110
+
111
+ **Enables:**
112
+
113
+ - workflow-status to answer "what's next?"
114
+ - Progress tracking throughout implementation
115
+ - Dependency management
116
+ - Velocity measurement
117
+
118
+ ### Process Overview
119
+
120
+ **Phase 1: Context Loading (Step 1)**
121
+
122
+ - Load epics.md
123
+ - Load individual epic files
124
+ - Load architecture.md (if exists)
125
+ - Extract all stories
126
+
127
+ **Phase 2: Story Extraction (Steps 2-3)**
128
+
129
+ - Parse stories from epic files
130
+ - Extract acceptance criteria
131
+ - Identify priorities (P0/P1/P2/P3)
132
+ - Extract dependencies
133
+
134
+ **Phase 3: Sprint Assignment (Steps 4-5)**
135
+
136
+ - Group stories by epic
137
+ - Sequence by priority and dependencies
138
+ - Assign to sprints (Sprint 1, 2, 3, etc.)
139
+ - Calculate sprint capacity estimates
140
+
141
+ **Phase 4: Status File Creation (Step 6)**
142
+
143
+ - Generate sprint-status.yaml
144
+ - Initialize all stories as TODO
145
+ - Document sprint plan
146
+ - Save to output folder
147
+
148
+ ### Inputs
149
+
150
+ Required:
151
+
152
+ - epics.md
153
+ - Epic files (epic-1-_.md, epic-2-_.md, etc.)
154
+
155
+ Optional:
156
+
157
+ - architecture.md (for technical dependencies)
158
+ - Team velocity data (for sprint sizing)
159
+
160
+ ### Outputs
161
+
162
+ **Primary Output:** `sprint-status.yaml`
163
+
164
+ **File Structure:**
165
+
166
+ ```yaml
167
+ metadata:
168
+ project_name: 'E-Commerce Platform'
169
+ total_epics: 3
170
+ total_stories: 24
171
+ current_sprint: 1
172
+ sprint_start_date: '2025-11-02'
173
+
174
+ sprints:
175
+ sprint_1:
176
+ name: 'Epic 1: Authentication'
177
+ start_date: '2025-11-02'
178
+ end_date: '2025-11-15'
179
+ capacity_points: 40
180
+ stories:
181
+ - id: '1.1'
182
+ title: 'User can register with email'
183
+ status: 'TODO'
184
+ priority: 'P0'
185
+ epic: 1
186
+ estimated_hours: 8
187
+ assigned_to: null
188
+ dependencies: []
189
+ - id: '1.2'
190
+ title: 'User can login with email'
191
+ status: 'TODO'
192
+ priority: 'P0'
193
+ epic: 1
194
+ estimated_hours: 6
195
+ assigned_to: null
196
+ dependencies: ['1.1']
197
+
198
+ sprint_2:
199
+ name: 'Epic 2: Product Catalog'
200
+ # ...
201
+
202
+ story_queue:
203
+ - '1.1' # No dependencies, P0
204
+ - '1.2' # Depends on 1.1, P0
205
+ - '1.3' # Depends on 1.2, P0
206
+ # ...
207
+
208
+ epics:
209
+ - id: 1
210
+ name: 'Authentication'
211
+ total_stories: 8
212
+ completed_stories: 0
213
+ status: 'IN_PROGRESS'
214
+ - id: 2
215
+ name: 'Product Catalog'
216
+ total_stories: 10
217
+ completed_stories: 0
218
+ status: 'TODO'
219
+ - id: 3
220
+ name: 'Shopping Cart'
221
+ total_stories: 6
222
+ completed_stories: 0
223
+ status: 'TODO'
224
+ ```
225
+
226
+ ### Example Scenario
227
+
228
+ **Input:** 3 epics with 24 total stories
229
+
230
+ **Output:**
231
+
232
+ - **Sprint 1**: Epic 1 (8 stories, 2 weeks)
233
+ - **Sprint 2**: Epic 2 (10 stories, 2 weeks)
234
+ - **Sprint 3**: Epic 3 (6 stories, 1 week)
235
+
236
+ **Story Queue:**
237
+
238
+ 1. Story 1.1 (P0, no deps) → Start here
239
+ 2. Story 1.2 (P0, deps: 1.1)
240
+ 3. Story 1.3 (P0, deps: 1.2)
241
+ 4. Story 2.1 (P0, no deps) → Can parallelize with 1.x
242
+ ...
243
+
244
+ ### Related Workflows
245
+
246
+ - **solutioning-gate-check** (Phase 3) - Must PASS before sprint-planning
247
+ - **workflow-status** - Uses sprint-status.yaml to answer "what's next?"
248
+ - **create-story** - Uses story_queue to determine next story
249
+
250
+ ---
251
+
252
+ ## epic-tech-context
253
+
254
+ ### Purpose
255
+
256
+ Generate epic-specific technical context document that provides implementation guidance, patterns, and technical decisions for a single epic. Bridges architecture and story implementation.
257
+
258
+ **Agent:** SM (Scrum Master)
259
+ **Phase:** 4 (Implementation)
260
+ **Required:** Optional (recommended for Level 3-4)
261
+ **Typical Duration:** 15-30 minutes per epic
262
+
263
+ ### When to Use
264
+
265
+ Run **once per epic** before starting epic stories.
266
+
267
+ **Trigger Points:**
268
+
269
+ - Before implementing first story of an epic
270
+ - When starting a new epic in a sprint
271
+ - When architecture guidance is needed
272
+
273
+ **Skip if:**
274
+
275
+ - Level 0-1 (no epics)
276
+ - Level 2 (simple epics, architecture is straightforward)
277
+
278
+ ### Purpose of Epic Tech Context
279
+
280
+ **Provides:**
281
+
282
+ - Epic-specific technical guidance
283
+ - Code patterns and examples
284
+ - Integration points
285
+ - Testing strategy for epic
286
+ - Epic-level architectural decisions
287
+
288
+ **Prevents:**
289
+
290
+ - Re-reading entire architecture.md for each story
291
+ - Inconsistent implementations within epic
292
+ - Missing epic-level integration patterns
293
+
294
+ ### Process Overview
295
+
296
+ **Phase 1: Context Loading (Step 1)**
297
+
298
+ - Load architecture.md
299
+ - Load epic file (epic-X-\*.md)
300
+ - Load sprint-status.yaml
301
+ - Identify epic stories
302
+
303
+ **Phase 2: Technical Extraction (Steps 2-4)**
304
+
305
+ - Extract relevant architecture sections for epic
306
+ - Identify epic-specific ADRs
307
+ - Determine code patterns
308
+ - Identify integration points
309
+
310
+ **Phase 3: Implementation Guidance (Steps 5-7)**
311
+
312
+ - Define directory structure for epic
313
+ - Specify testing approach
314
+ - Provide code examples
315
+ - Document epic-level constants/config
316
+
317
+ **Phase 4: Documentation (Step 8)**
318
+
319
+ - Generate epic-tech-context.md
320
+ - Save to output folder
321
+ - Update sprint-status.yaml with context path
322
+
323
+ ### Inputs
324
+
325
+ Required:
326
+
327
+ - architecture.md
328
+ - epic-X-\*.md (specific epic file)
329
+ - sprint-status.yaml
330
+
331
+ ### Outputs
332
+
333
+ **Primary Output:** `epic-{N}-tech-context.md`
334
+
335
+ **Document Structure:**
336
+
337
+ 1. Epic Overview
338
+ 2. Relevant Architecture Decisions
339
+ - ADRs applicable to this epic
340
+ - Technology selections
341
+ 3. Directory Structure
342
+ - Files to create/modify
343
+ - Module organization
344
+ 4. Code Patterns
345
+ - Epic-specific patterns
346
+ - Code examples
347
+ 5. Integration Points
348
+ - APIs to create/consume
349
+ - Database interactions
350
+ - Third-party services
351
+ 6. Testing Strategy
352
+ - Test levels for epic (E2E, API, Unit)
353
+ - Test fixtures needed
354
+ - Mock strategies
355
+ 7. Configuration
356
+ - Environment variables
357
+ - Feature flags
358
+ - Constants
359
+
360
+ ### Example: Epic 1 Tech Context (Authentication)
361
+
362
+ ```markdown
363
+ # Epic 1 Tech Context: Authentication
364
+
365
+ ## Architecture Decisions
366
+
367
+ **ADR-001: Use NextAuth.js**
368
+
369
+ - All stories in this epic use NextAuth.js
370
+ - Database adapter: PostgreSQL (via Prisma)
371
+ - Session strategy: Database sessions (not JWT)
372
+
373
+ **ADR-003: Password Security**
374
+
375
+ - Use bcrypt with 12 rounds
376
+ - Minimum password length: 8 characters
377
+ - Require: uppercase, lowercase, number
378
+
379
+ ## Directory Structure
380
+ ```
381
+
382
+ /pages/api/auth/
383
+ [...nextauth].ts # Story 1.1
384
+ register.ts # Story 1.2
385
+ verify-email.ts # Story 1.3
386
+
387
+ /lib/auth/
388
+ validation.ts # Story 1.2
389
+ email-service.ts # Story 1.3
390
+
391
+ /prisma/schema.prisma
392
+ User model # Story 1.1
393
+ Session model # Story 1.1
394
+
395
+ ````
396
+
397
+ ## Code Patterns
398
+
399
+ **User Registration (Story 1.2):**
400
+ ```typescript
401
+ // /lib/auth/validation.ts
402
+ export const validatePassword = (password: string) => {
403
+ const minLength = 8;
404
+ const hasUppercase = /[A-Z]/.test(password);
405
+ const hasLowercase = /[a-z]/.test(password);
406
+ const hasNumber = /\d/.test(password);
407
+
408
+ if (password.length < minLength) {
409
+ throw new Error('Password too short');
410
+ }
411
+ // ...
412
+ };
413
+ ````
414
+
415
+ ## Integration Points
416
+
417
+ **Database:**
418
+
419
+ - Create User table with Prisma migration (Story 1.1)
420
+ - Create Session table with Prisma migration (Story 1.1)
421
+
422
+ **Third-Party Services:**
423
+
424
+ - SendGrid for email verification (Story 1.3)
425
+ - API Key: SENDGRID_API_KEY env variable
426
+ - From email: no-reply@example.com
427
+
428
+ ## Testing Strategy
429
+
430
+ **E2E Tests:**
431
+
432
+ - Story 1.1: Full registration flow
433
+ - Story 1.2: Login flow
434
+ - Story 1.3: Email verification flow
435
+
436
+ **API Tests:**
437
+
438
+ - All /api/auth/\* endpoints
439
+ - Error cases: duplicate email, invalid password
440
+
441
+ **Unit Tests:**
442
+
443
+ - validation.ts functions
444
+ - email-service.ts functions
445
+
446
+ **Test Fixtures:**
447
+
448
+ - Create `tests/fixtures/auth.fixture.ts`
449
+ - Provide: createTestUser(), loginTestUser(), cleanupTestUser()
450
+
451
+ ## Configuration
452
+
453
+ **Environment Variables:**
454
+
455
+ ```
456
+ DATABASE_URL=postgresql://...
457
+ NEXTAUTH_URL=http://localhost:3000
458
+ NEXTAUTH_SECRET=<generate-random-string>
459
+ SENDGRID_API_KEY=SG.xxx
460
+ ```
461
+
462
+ **Constants:**
463
+
464
+ ```typescript
465
+ // /lib/auth/constants.ts
466
+ export const PASSWORD_MIN_LENGTH = 8;
467
+ export const BCRYPT_ROUNDS = 12;
468
+ export const EMAIL_VERIFICATION_EXPIRY_HOURS = 24;
469
+ ```
470
+
471
+ ````
472
+
473
+ ### Related Workflows
474
+ - **architecture** (Phase 3) - Source of technical guidance
475
+ - **story-context** - Uses epic-tech-context as input
476
+ - **dev-story** - References epic-tech-context during implementation
477
+
478
+ ---
479
+
480
+ ## create-story
481
+
482
+ ### Purpose
483
+ Create the next user story markdown from epics/PRD and architecture, using a standard template and saving to the stories folder.
484
+
485
+ **Agent:** SM (Scrum Master)
486
+ **Phase:** 4 (Implementation)
487
+ **Required:** Yes (for each story)
488
+ **Typical Duration:** 10-20 minutes per story
489
+
490
+ ### When to Use
491
+ Run **before implementing each story** to generate story file.
492
+
493
+ **Trigger Points:**
494
+ - Before starting work on a new story
495
+ - When story_queue identifies next story
496
+ - After completing previous story
497
+
498
+ ### Process Overview
499
+
500
+ **Phase 1: Story Selection (Step 1)**
501
+ - Load sprint-status.yaml
502
+ - Read story_queue
503
+ - Select next story (first in queue with dependencies met)
504
+
505
+ **Phase 2: Story Extraction (Steps 2-3)**
506
+ - Load epic file for selected story
507
+ - Extract story details
508
+ - Extract acceptance criteria
509
+ - Extract dependencies
510
+
511
+ **Phase 3: Context Gathering (Steps 4-5)**
512
+ - Load PRD/GDD for product context
513
+ - Load architecture for technical context
514
+ - Load epic-tech-context (if exists)
515
+
516
+ **Phase 4: Story File Creation (Step 6)**
517
+ - Generate story markdown using template
518
+ - Include acceptance criteria
519
+ - Include technical notes
520
+ - Save to stories/ folder
521
+
522
+ **Phase 5: Status Update (Step 7)**
523
+ - Update sprint-status.yaml
524
+ - Move story from TODO → IN PROGRESS
525
+ - Update workflow-status.md
526
+
527
+ ### Inputs
528
+ Required:
529
+ - sprint-status.yaml (story queue)
530
+ - epic-X-*.md (for story details)
531
+ - PRD.md or GDD.md
532
+
533
+ Optional:
534
+ - architecture.md
535
+ - epic-tech-context.md
536
+
537
+ ### Outputs
538
+
539
+ **Primary Output:** `story-{epic}.{num}-{title}.md`
540
+
541
+ **Story File Structure:**
542
+ ```markdown
543
+ # Story {Epic}.{Num}: {Title}
544
+
545
+ **Epic:** {Epic Name}
546
+ **Priority:** P0/P1/P2/P3
547
+ **Status:** IN PROGRESS
548
+ **Estimated Hours:** {Hours}
549
+ **Dependencies:** {Story IDs or "None"}
550
+
551
+ ## User Story
552
+
553
+ As a {user type},
554
+ I want to {action},
555
+ So that {benefit}.
556
+
557
+ ## Acceptance Criteria
558
+
559
+ - [ ] AC-1: {Criterion}
560
+ - [ ] AC-2: {Criterion}
561
+ - [ ] AC-3: {Criterion}
562
+
563
+ ## Technical Notes
564
+
565
+ {From architecture/epic-tech-context}
566
+
567
+ ## Implementation Checklist
568
+
569
+ - [ ] Read story-context.xml for dynamic context
570
+ - [ ] Implement feature code
571
+ - [ ] Write tests (unit, integration, E2E as needed)
572
+ - [ ] Update documentation
573
+ - [ ] Run tests locally
574
+ - [ ] Verify acceptance criteria
575
+ - [ ] Mark story as READY FOR REVIEW
576
+
577
+ ## Definition of Done
578
+
579
+ - [ ] All acceptance criteria met
580
+ - [ ] Tests written and passing
581
+ - [ ] Code reviewed
582
+ - [ ] Documentation updated
583
+ - [ ] No regressions in existing features
584
+ ````
585
+
586
+ ### Example: Story 1.2 - User Can Login
587
+
588
+ ```markdown
589
+ # Story 1.2: User Can Login with Email
590
+
591
+ **Epic:** Epic 1 - Authentication
592
+ **Priority:** P0
593
+ **Status:** IN PROGRESS
594
+ **Estimated Hours:** 6
595
+ **Dependencies:** Story 1.1 (User Registration)
596
+
597
+ ## User Story
598
+
599
+ As a registered user,
600
+ I want to login with my email and password,
601
+ So that I can access my account.
602
+
603
+ ## Acceptance Criteria
604
+
605
+ - [ ] AC-1: User can enter email and password on login page
606
+ - [ ] AC-2: Valid credentials redirect to dashboard
607
+ - [ ] AC-3: Invalid credentials show error message
608
+ - [ ] AC-4: Error message does not reveal if email exists (security)
609
+ - [ ] AC-5: Login creates session that persists across page refreshes
610
+
611
+ ## Technical Notes
612
+
613
+ **From Architecture (ADR-001):**
614
+
615
+ - Use NextAuth.js with database session strategy
616
+ - Session stored in PostgreSQL via Prisma
617
+
618
+ **From Epic Tech Context:**
619
+
620
+ - Implement /pages/api/auth/[...nextauth].ts
621
+ - Use bcrypt.compare() for password validation
622
+ - Return generic error for security (don't reveal "email not found" vs "wrong password")
623
+
624
+ ## Implementation Checklist
625
+
626
+ - [ ] Read story-context.xml
627
+ - [ ] Create /pages/login.tsx
628
+ - [ ] Configure NextAuth.js credentials provider
629
+ - [ ] Implement password comparison logic
630
+ - [ ] Write E2E test: Valid login → Dashboard
631
+ - [ ] Write E2E test: Invalid login → Error
632
+ - [ ] Write API test: POST /api/auth/callback/credentials
633
+ - [ ] Verify AC-1 through AC-5
634
+ - [ ] Mark READY FOR REVIEW
635
+
636
+ ## Definition of Done
637
+
638
+ - [ ] Login page exists and is styled
639
+ - [ ] Valid credentials authenticate successfully
640
+ - [ ] Invalid credentials show error
641
+ - [ ] Session persists across page loads
642
+ - [ ] Tests pass (2 E2E, 3 API)
643
+ - [ ] Code reviewed
644
+ ```
645
+
646
+ ### Related Workflows
647
+
648
+ - **sprint-planning** - Creates story_queue
649
+ - **story-context** - Run after create-story
650
+ - **dev-story** - Implements the story
651
+
652
+ ---
653
+
654
+ ## story-context
655
+
656
+ ### Purpose
657
+
658
+ Assemble dynamic story context XML by pulling latest documentation and existing code/library artifacts relevant to a drafted story.
659
+
660
+ **Agent:** PM (Project Manager)
661
+ **Phase:** 4 (Implementation)
662
+ **Required:** Yes (before implementing story)
663
+ **Typical Duration:** 10-15 minutes per story
664
+
665
+ ### When to Use
666
+
667
+ Run **after create-story** and **before dev-story** for each story.
668
+
669
+ **Trigger Points:**
670
+
671
+ - Immediately after create-story generates story file
672
+ - Before DEV agent starts implementation
673
+
674
+ ### Purpose of Story Context
675
+
676
+ **Problem Without Context:**
677
+
678
+ - DEV agent re-reads entire PRD, architecture, epic files (100+ pages)
679
+ - Slow context loading
680
+ - Irrelevant information clutters thinking
681
+
682
+ **Solution With Context:**
683
+
684
+ - PM assembles **only relevant** context for this story
685
+ - DEV agent receives focused, story-specific information
686
+ - Fast, targeted implementation
687
+
688
+ ### Process Overview
689
+
690
+ **Phase 1: Story Loading (Step 1)**
691
+
692
+ - Load story file (story-{epic}.{num}-{title}.md)
693
+ - Extract story ID, epic, dependencies
694
+ - Extract acceptance criteria
695
+
696
+ **Phase 2: Documentation Context (Steps 2-4)**
697
+
698
+ - Load relevant PRD/GDD sections
699
+ - Load relevant architecture sections
700
+ - Load epic-tech-context (if exists)
701
+ - Load dependent story files
702
+
703
+ **Phase 3: Code Context (Steps 5-6)**
704
+
705
+ - Identify existing code files related to story
706
+ - Load relevant library code (models, services, utils)
707
+ - Load related test files
708
+
709
+ **Phase 4: Context Assembly (Step 7)**
710
+
711
+ - Generate story-context.xml
712
+ - Organize context by type (docs, code, tests)
713
+ - Include only relevant sections
714
+ - Save to output folder
715
+
716
+ ### Inputs
717
+
718
+ Required:
719
+
720
+ - story-{epic}.{num}-{title}.md
721
+
722
+ Optional (loaded as needed):
723
+
724
+ - PRD.md or GDD.md
725
+ - architecture.md
726
+ - epic-tech-context.md
727
+ - Existing codebase files
728
+
729
+ ### Outputs
730
+
731
+ **Primary Output:** `story-{epic}.{num}-context.xml`
732
+
733
+ **XML Structure:**
734
+
735
+ ```xml
736
+ <story-context>
737
+ <story id="1.2" epic="1" title="User Can Login">
738
+ <acceptance-criteria>
739
+ <criterion id="AC-1">User can enter email and password on login page</criterion>
740
+ <criterion id="AC-2">Valid credentials redirect to dashboard</criterion>
741
+ <!-- ... -->
742
+ </acceptance-criteria>
743
+ </story>
744
+
745
+ <product-context>
746
+ <section source="PRD.md" name="Authentication Requirements">
747
+ <!-- Relevant PRD excerpt -->
748
+ </section>
749
+ </product-context>
750
+
751
+ <architecture-context>
752
+ <adr id="ADR-001" title="Use NextAuth.js">
753
+ <!-- Full ADR content -->
754
+ </adr>
755
+ <section source="architecture.md" name="Authentication Architecture">
756
+ <!-- Relevant architecture excerpt -->
757
+ </section>
758
+ </architecture-context>
759
+
760
+ <epic-context>
761
+ <section source="epic-1-tech-context.md">
762
+ <!-- Epic-specific technical guidance -->
763
+ </section>
764
+ </epic-context>
765
+
766
+ <code-context>
767
+ <file path="/prisma/schema.prisma">
768
+ <!-- Existing User model -->
769
+ </file>
770
+ <file path="/lib/auth/validation.ts">
771
+ <!-- Existing validation functions -->
772
+ </file>
773
+ </code-context>
774
+
775
+ <dependency-context>
776
+ <story id="1.1" title="User Can Register">
777
+ <!-- Story 1.1 summary for context -->
778
+ </story>
779
+ </dependency-context>
780
+ </story-context>
781
+ ```
782
+
783
+ ### Example: Story 1.2 Context Assembly
784
+
785
+ **Story 1.2: User Can Login**
786
+
787
+ **Context Assembled:**
788
+
789
+ 1. **Product Context** (from PRD):
790
+ - Authentication requirements section (2 pages)
791
+ - User personas: Primary user is buyer
792
+
793
+ 2. **Architecture Context** (from architecture.md):
794
+ - ADR-001: Use NextAuth.js (full ADR)
795
+ - Authentication Architecture section (1 page)
796
+
797
+ 3. **Epic Context** (from epic-1-tech-context.md):
798
+ - Code patterns for login
799
+ - Integration points (NextAuth.js config)
800
+ - Testing strategy
801
+
802
+ 4. **Code Context** (existing files):
803
+ - `/prisma/schema.prisma` - User and Session models
804
+ - `/lib/auth/validation.ts` - Password validation (from Story 1.1)
805
+ - `/pages/api/auth/[...nextauth].ts` - Auth config (created in Story 1.1)
806
+
807
+ 5. **Dependency Context** (Story 1.1):
808
+ - Summary: User registration creates User in DB
809
+ - Dependency: User table must exist
810
+
811
+ **Result:** DEV agent receives 8-10 pages of **focused** context instead of 100+ pages of full documentation.
812
+
813
+ ### Related Workflows
814
+
815
+ - **create-story** - Creates story file that story-context uses
816
+ - **dev-story** - Consumes story-context.xml
817
+
818
+ ---
819
+
820
+ ## dev-story
821
+
822
+ ### Purpose
823
+
824
+ Execute a story by implementing tasks/subtasks, writing tests, validating, and updating the story file per acceptance criteria.
825
+
826
+ **Agent:** DEV (Developer)
827
+ **Phase:** 4 (Implementation)
828
+ **Required:** Yes (for each story)
829
+ **Typical Duration:** 2-8 hours per story (varies by complexity)
830
+
831
+ ### When to Use
832
+
833
+ Run **after story-context** to implement the story.
834
+
835
+ **Trigger Points:**
836
+
837
+ - After story-context.xml is generated
838
+ - When story status is IN PROGRESS
839
+ - For each story in story_queue
840
+
841
+ ### Process Overview
842
+
843
+ **Phase 1: Context Loading (Step 1)**
844
+
845
+ - Load story file
846
+ - Load story-context.xml
847
+ - Review acceptance criteria
848
+ - Review technical notes
849
+
850
+ **Phase 2: Implementation Planning (Steps 2-3)**
851
+
852
+ - Break story into tasks
853
+ - Identify files to create/modify
854
+ - Plan test strategy
855
+ - Estimate implementation approach
856
+
857
+ **Phase 3: Implementation (Steps 4-6)**
858
+
859
+ - Write code to satisfy acceptance criteria
860
+ - Follow architecture decisions
861
+ - Apply code patterns from epic-tech-context
862
+ - Write tests (unit, integration, E2E as needed)
863
+
864
+ **Phase 4: Validation (Steps 7-8)**
865
+
866
+ - Run tests locally
867
+ - Verify all acceptance criteria met
868
+ - Check for regressions
869
+ - Ensure code quality
870
+
871
+ **Phase 5: Documentation (Step 9)**
872
+
873
+ - Update story file (check off AC items)
874
+ - Document any deviations
875
+ - Mark story as READY FOR REVIEW
876
+ - Update sprint-status.yaml
877
+
878
+ ### Inputs
879
+
880
+ Required:
881
+
882
+ - story-{epic}.{num}-{title}.md
883
+ - story-{epic}.{num}-context.xml
884
+
885
+ ### Outputs
886
+
887
+ - Implementation code (multiple files)
888
+ - Test files
889
+ - Updated story file (AC checked off)
890
+ - Updated sprint-status.yaml (status: READY FOR REVIEW)
891
+
892
+ ### Example: Implementing Story 1.2 (Login)
893
+
894
+ **Phase 1: Planning**
895
+ Tasks identified:
896
+
897
+ 1. Create /pages/login.tsx (UI)
898
+ 2. Configure NextAuth credentials provider
899
+ 3. Implement password verification logic
900
+ 4. Write E2E test: Valid login
901
+ 5. Write E2E test: Invalid login
902
+ 6. Write API test: /api/auth/callback/credentials
903
+
904
+ **Phase 2: Implementation**
905
+ Files created/modified:
906
+
907
+ - `/pages/login.tsx` (new)
908
+ - `/pages/api/auth/[...nextauth].ts` (modified - add credentials provider)
909
+ - `/lib/auth/password.ts` (new - password verification)
910
+ - `/tests/e2e/auth-login.spec.ts` (new)
911
+ - `/tests/api/auth-api.spec.ts` (modified - add login tests)
912
+
913
+ **Phase 3: Testing**
914
+
915
+ ```bash
916
+ npm run test:e2e
917
+ npm run test:api
918
+ npm run test:unit
919
+ ```
920
+
921
+ All tests pass ✅
922
+
923
+ **Phase 4: Verification**
924
+
925
+ - [x] AC-1: Login page exists with email/password inputs
926
+ - [x] AC-2: Valid credentials → Dashboard
927
+ - [x] AC-3: Invalid credentials → Error message
928
+ - [x] AC-4: Error message generic (security)
929
+ - [x] AC-5: Session persists across page refreshes
930
+
931
+ **Phase 5: Documentation**
932
+ Update story file:
933
+
934
+ ```markdown
935
+ ## Acceptance Criteria
936
+
937
+ - [x] AC-1: User can enter email and password on login page
938
+ - [x] AC-2: Valid credentials redirect to dashboard
939
+ - [x] AC-3: Invalid credentials show error message
940
+ - [x] AC-4: Error message does not reveal if email exists (security)
941
+ - [x] AC-5: Login creates session that persists across page refreshes
942
+
943
+ ## Implementation Summary
944
+
945
+ Files Created:
946
+
947
+ - /pages/login.tsx
948
+ - /lib/auth/password.ts
949
+ - /tests/e2e/auth-login.spec.ts
950
+
951
+ Files Modified:
952
+
953
+ - /pages/api/auth/[...nextauth].ts
954
+ - /tests/api/auth-api.spec.ts
955
+
956
+ Tests Added:
957
+
958
+ - 2 E2E tests (valid/invalid login)
959
+ - 3 API tests (credentials endpoint)
960
+
961
+ **Status:** READY FOR REVIEW
962
+ ```
963
+
964
+ ### Related Workflows
965
+
966
+ - **story-context** - Provides focused context
967
+ - **code-review** - Next step after implementation
968
+ - **correct-course** - If changes needed mid-story
969
+
970
+ ---
971
+
972
+ ## code-review
973
+
974
+ ### Purpose
975
+
976
+ Perform a Senior Developer code review on a completed story flagged Ready for Review, leveraging story-context, epic-tech-context, repo docs, MCP servers for latest best-practices, and web search as fallback.
977
+
978
+ **Agent:** DEV (Senior Developer persona)
979
+ **Phase:** 4 (Implementation)
980
+ **Required:** Recommended (especially for P0/P1 stories)
981
+ **Typical Duration:** 30-60 minutes per story
982
+
983
+ ### When to Use
984
+
985
+ Run **after dev-story** when story status is READY FOR REVIEW.
986
+
987
+ **Trigger Points:**
988
+
989
+ - Story status: READY FOR REVIEW
990
+ - Before marking story as DONE
991
+ - For P0/P1 stories (required)
992
+ - For P2/P3 stories (optional but recommended)
993
+
994
+ ### Process Overview
995
+
996
+ **Phase 1: Context Loading (Step 1)**
997
+
998
+ - Load story file
999
+ - Load story-context.xml
1000
+ - Load implementation files
1001
+ - Load test files
1002
+
1003
+ **Phase 2: Review Criteria (Steps 2-5)**
1004
+
1005
+ - **Acceptance Criteria**: All AC met?
1006
+ - **Architecture Alignment**: Follows architecture decisions?
1007
+ - **Code Quality**: Readable, maintainable, follows conventions?
1008
+ - **Test Coverage**: Sufficient tests, tests passing?
1009
+ - **Best Practices**: Uses latest framework patterns?
1010
+
1011
+ **Phase 3: Knowledge Loading (Steps 6-7)**
1012
+
1013
+ - Load repository documentation (CONTRIBUTING.md, CODE_STYLE.md)
1014
+ - Use MCP servers for framework best practices (if available)
1015
+ - Web search for latest patterns (fallback)
1016
+
1017
+ **Phase 4: Review Execution (Steps 8-10)**
1018
+
1019
+ - Review each file changed
1020
+ - Identify issues (critical, high, medium, low)
1021
+ - Suggest improvements
1022
+ - Verify tests
1023
+
1024
+ **Phase 5: Review Report (Step 11)**
1025
+
1026
+ - Generate code-review.md
1027
+ - Append to story file
1028
+ - Update sprint-status.yaml
1029
+
1030
+ ### Review Criteria
1031
+
1032
+ **Acceptance Criteria Validation:**
1033
+
1034
+ - [ ] All AC items checked off in story file
1035
+ - [ ] AC validated through tests
1036
+ - [ ] AC validated manually (if needed)
1037
+
1038
+ **Architecture Alignment:**
1039
+
1040
+ - [ ] Follows ADRs
1041
+ - [ ] Uses specified technology choices
1042
+ - [ ] Follows directory structure conventions
1043
+ - [ ] Follows code patterns from epic-tech-context
1044
+
1045
+ **Code Quality:**
1046
+
1047
+ - [ ] Readable and maintainable
1048
+ - [ ] Follows repository conventions
1049
+ - [ ] No code smells (long functions, god classes, etc.)
1050
+ - [ ] Appropriate error handling
1051
+ - [ ] Security best practices followed
1052
+
1053
+ **Test Coverage:**
1054
+
1055
+ - [ ] Tests exist for all AC
1056
+ - [ ] Tests pass locally
1057
+ - [ ] Edge cases covered
1058
+ - [ ] Tests follow framework best practices
1059
+ - [ ] No flaky tests
1060
+
1061
+ **Best Practices:**
1062
+
1063
+ - [ ] Uses latest framework patterns
1064
+ - [ ] Avoids deprecated APIs
1065
+ - [ ] Performance considerations addressed
1066
+ - [ ] Accessibility requirements met (if applicable)
1067
+
1068
+ ### Inputs
1069
+
1070
+ Required:
1071
+
1072
+ - story-{epic}.{num}-{title}.md (with READY FOR REVIEW status)
1073
+ - story-{epic}.{num}-context.xml
1074
+ - Implementation files (code)
1075
+ - Test files
1076
+
1077
+ Optional:
1078
+
1079
+ - Repository documentation (CONTRIBUTING.md, CODE_STYLE.md)
1080
+ - MCP servers for best practices
1081
+ - Web search for latest patterns
1082
+
1083
+ ### Outputs
1084
+
1085
+ **Primary Output:** Code review appended to story file
1086
+
1087
+ **Review Structure:**
1088
+
1089
+ ````markdown
1090
+ ---
1091
+
1092
+ ## Code Review - {Date}
1093
+
1094
+ **Reviewer:** DEV (Senior Developer)
1095
+ **Status:** APPROVED / REQUEST CHANGES / APPROVED WITH COMMENTS
1096
+
1097
+ ### Summary
1098
+
1099
+ {Overall assessment}
1100
+
1101
+ ### Acceptance Criteria Validation
1102
+
1103
+ - [x] AC-1: Validated ✅
1104
+ - [x] AC-2: Validated ✅
1105
+ - [x] AC-3: Validated ✅
1106
+ - [x] AC-4: Validated ✅
1107
+ - [x] AC-5: Validated ✅
1108
+
1109
+ ### Architecture Alignment
1110
+
1111
+ ✅ Follows ADR-001 (NextAuth.js)
1112
+ ✅ Uses database session strategy
1113
+ ✅ Follows epic-tech-context patterns
1114
+
1115
+ ### Code Quality Issues
1116
+
1117
+ **Critical Issues (Must Fix):**
1118
+ None
1119
+
1120
+ **High Priority (Should Fix Before Merge):**
1121
+
1122
+ 1. /lib/auth/password.ts:15 - Use constant for bcrypt rounds instead of magic number
1123
+
1124
+ ```typescript
1125
+ // Current:
1126
+ const hash = await bcrypt.hash(password, 12);
1127
+
1128
+ // Suggested:
1129
+ import { BCRYPT_ROUNDS } from './constants';
1130
+ const hash = await bcrypt.hash(password, BCRYPT_ROUNDS);
1131
+ ```
1132
+ ````
1133
+
1134
+ **Medium Priority (Address in Follow-up):**
1135
+
1136
+ 1. /pages/login.tsx:42 - Consider extracting form validation to custom hook
1137
+ 2. Add JSDoc comments to public functions in /lib/auth/password.ts
1138
+
1139
+ **Low Priority (Nice to Have):**
1140
+
1141
+ 1. Consider using react-hook-form for login form (reduces boilerplate)
1142
+
1143
+ ### Test Coverage
1144
+
1145
+ ✅ E2E tests cover happy and sad paths
1146
+ ✅ API tests cover error cases
1147
+ ⚠️ Consider adding unit test for password validation edge cases
1148
+
1149
+ ### Best Practices
1150
+
1151
+ ✅ Uses latest Next.js 14 patterns
1152
+ ✅ Follows React best practices
1153
+ ✅ Accessibility: Form has labels and error messages
1154
+
1155
+ ### Recommendation
1156
+
1157
+ **APPROVED WITH COMMENTS** - Address high priority issue #1, then merge.
1158
+
1159
+ Medium/low priority items can be addressed in future stories.
1160
+
1161
+ ````
1162
+
1163
+ ### Review Outcomes
1164
+
1165
+ **APPROVED** ✅
1166
+ - All criteria met
1167
+ - No critical/high issues
1168
+ - Story can be marked DONE
1169
+ - **Action**: Run story-done workflow
1170
+
1171
+ **APPROVED WITH COMMENTS** ✅⚠️
1172
+ - Minor issues noted
1173
+ - Suggestions for improvement
1174
+ - Story can be marked DONE
1175
+ - **Action**: Address comments in follow-up (optional)
1176
+
1177
+ **REQUEST CHANGES** ❌
1178
+ - Critical or high-priority issues found
1179
+ - Changes required before merge
1180
+ - Story remains READY FOR REVIEW
1181
+ - **Action**: Fix issues, re-request review
1182
+
1183
+ ### Related Workflows
1184
+ - **dev-story** - Implementation that's being reviewed
1185
+ - **story-done** - Next step if approved
1186
+ - **correct-course** - If significant changes needed
1187
+
1188
+ ---
1189
+
1190
+ ## correct-course
1191
+
1192
+ ### Purpose
1193
+ Navigate significant changes during sprint execution by analyzing impact, proposing solutions, and routing for implementation.
1194
+
1195
+ **Agent:** SM (Scrum Master)
1196
+ **Phase:** 4 (Implementation)
1197
+ **Required:** As needed
1198
+ **Typical Duration:** 30-90 minutes
1199
+
1200
+ ### When to Use
1201
+ Run when **significant changes** occur mid-sprint:
1202
+
1203
+ **Trigger Scenarios:**
1204
+ - New requirements discovered during implementation
1205
+ - Architecture decision needs revision
1206
+ - Story dependencies change
1207
+ - External factors impact sprint (API changes, platform updates)
1208
+ - Critical bug discovered requiring immediate attention
1209
+
1210
+ **Don't Use For:**
1211
+ - Minor clarifications → Clarify in story file
1212
+ - Small scope adjustments → Adjust AC in story
1213
+ - Typical development blockers → Resolve within team
1214
+
1215
+ ### Process Overview
1216
+
1217
+ **Phase 1: Change Analysis (Steps 1-3)**
1218
+ - Identify change type (requirements, technical, external)
1219
+ - Assess impact (stories, epics, architecture)
1220
+ - Determine urgency (blocking, high, medium, low)
1221
+
1222
+ **Phase 2: Impact Assessment (Steps 4-6)**
1223
+ - Stories affected
1224
+ - Epics affected
1225
+ - Architecture changes needed
1226
+ - Timeline impact
1227
+
1228
+ **Phase 3: Solution Proposal (Steps 7-9)**
1229
+ - **Option A**: Adjust scope (remove stories, defer features)
1230
+ - **Option B**: Adjust architecture (revise decisions)
1231
+ - **Option C**: Adjust timeline (extend sprint)
1232
+ - **Option D**: Combination approach
1233
+
1234
+ **Phase 4: Decision and Routing (Steps 10-12)**
1235
+ - Consult stakeholders (if needed)
1236
+ - Select solution
1237
+ - Route to appropriate workflow:
1238
+ - Requirements change → Update PRD → Re-run create-story
1239
+ - Architecture change → Update architecture → Re-run epic-tech-context
1240
+ - Story change → Update story file → Continue dev-story
1241
+ - Update sprint-status.yaml
1242
+
1243
+ ### Change Types
1244
+
1245
+ **Requirements Change:**
1246
+ - New AC discovered
1247
+ - AC invalidated by new information
1248
+ - Feature scope expansion/reduction
1249
+
1250
+ **Technical Change:**
1251
+ - Architecture decision no longer viable
1252
+ - Technology choice needs revision
1253
+ - Integration approach changed
1254
+
1255
+ **External Change:**
1256
+ - Third-party API changed
1257
+ - Platform update breaks implementation
1258
+ - Regulatory requirement introduced
1259
+
1260
+ ### Inputs
1261
+ Required:
1262
+ - Description of change
1263
+ - Current story/epic affected
1264
+ - Current sprint-status.yaml
1265
+
1266
+ ### Outputs
1267
+ - Change impact analysis document
1268
+ - Updated documentation (PRD/architecture/stories)
1269
+ - Updated sprint-status.yaml
1270
+ - Routing recommendations
1271
+
1272
+ ### Example: API Change Mid-Sprint
1273
+
1274
+ **Change:** SendGrid deprecated email API, requires migration to new API
1275
+
1276
+ **Impact Analysis:**
1277
+ - **Stories Affected**: Story 1.3 (Email Verification) - IN PROGRESS
1278
+ - **Epics Affected**: Epic 1 (Authentication)
1279
+ - **Architecture Impact**: ADR-004 (Email Service) needs revision
1280
+ - **Timeline Impact**: +1 day (API migration work)
1281
+
1282
+ **Solution Options:**
1283
+
1284
+ **Option A:** Continue with deprecated API, plan migration for later
1285
+ - **Pros**: No sprint disruption
1286
+ - **Cons**: Technical debt, API sunset in 6 months
1287
+
1288
+ **Option B:** Migrate to new API now
1289
+ - **Pros**: No technical debt, future-proof
1290
+ - **Cons**: +1 day to sprint
1291
+
1292
+ **Option C:** Defer email verification to next sprint
1293
+ - **Pros**: No disruption to current sprint
1294
+ - **Cons**: Story 1.3 incomplete, Epic 1 not done
1295
+
1296
+ **Decision:** Option B (Migrate now)
1297
+
1298
+ **Actions:**
1299
+ 1. Update architecture.md (ADR-004: Use SendGrid v4 API)
1300
+ 2. Update epic-1-tech-context.md (new email patterns)
1301
+ 3. Update Story 1.3 acceptance criteria (new API endpoints)
1302
+ 4. Continue dev-story with new approach
1303
+ 5. Extend sprint by 1 day
1304
+
1305
+ ### Related Workflows
1306
+ - **architecture** - May need updates
1307
+ - **create-story** - May need to create new stories
1308
+ - **sprint-planning** - May need to re-prioritize
1309
+ - **retrospective** - Document learnings
1310
+
1311
+ ---
1312
+
1313
+ ## retrospective
1314
+
1315
+ ### Purpose
1316
+ Run after epic completion to review overall success, extract lessons learned, and explore if new information emerged that might impact the next epic.
1317
+
1318
+ **Agent:** SM (Scrum Master)
1319
+ **Phase:** 4 (Implementation)
1320
+ **Required:** Recommended (after each epic)
1321
+ **Typical Duration:** 60-90 minutes
1322
+
1323
+ ### When to Use
1324
+ Run **after completing an epic** (all stories DONE).
1325
+
1326
+ **Trigger Points:**
1327
+ - Epic status: DONE
1328
+ - All epic stories completed
1329
+ - Before starting next epic
1330
+ - Before final release (after all epics)
1331
+
1332
+ ### Process Overview
1333
+
1334
+ **Phase 1: Data Gathering (Steps 1-3)**
1335
+ - Load sprint-status.yaml
1336
+ - Load completed story files
1337
+ - Load code-review feedback
1338
+ - Gather metrics (velocity, story cycle time)
1339
+
1340
+ **Phase 2: Review Execution (Steps 4-7)**
1341
+ - **What Went Well**: Successes and wins
1342
+ - **What Didn't Go Well**: Challenges and issues
1343
+ - **Lessons Learned**: Actionable insights
1344
+ - **Process Improvements**: Changes for next epic
1345
+
1346
+ **Phase 3: Technical Insights (Steps 8-10)**
1347
+ - Architecture decisions review
1348
+ - Technology choices validation
1349
+ - Code quality assessment
1350
+ - Test coverage and quality
1351
+
1352
+ **Phase 4: Planning Insights (Steps 11-13)**
1353
+ - Estimation accuracy
1354
+ - Requirements clarity
1355
+ - Dependency management
1356
+ - Scope changes
1357
+
1358
+ **Phase 5: Action Items (Step 14)**
1359
+ - Process changes for next epic
1360
+ - Architecture updates needed
1361
+ - Documentation improvements
1362
+ - Training or knowledge gaps
1363
+
1364
+ ### Inputs
1365
+ Required:
1366
+ - sprint-status.yaml (epic completion data)
1367
+ - Completed story files
1368
+ - code-review feedback
1369
+
1370
+ Optional:
1371
+ - Team velocity data
1372
+ - CI/CD metrics
1373
+ - Bug reports
1374
+
1375
+ ### Outputs
1376
+
1377
+ **Primary Output:** `retrospective-epic-{N}-{date}.md`
1378
+
1379
+ **Document Structure:**
1380
+ 1. Epic Summary
1381
+ - Stories completed
1382
+ - Time taken
1383
+ - Velocity achieved
1384
+ 2. What Went Well
1385
+ 3. What Didn't Go Well
1386
+ 4. Lessons Learned
1387
+ 5. Technical Insights
1388
+ 6. Planning Insights
1389
+ 7. Action Items for Next Epic
1390
+ 8. Process Improvements
1391
+
1392
+ ### Example: Epic 1 Retrospective
1393
+
1394
+ ```markdown
1395
+ # Retrospective: Epic 1 - Authentication
1396
+
1397
+ **Date:** 2025-11-15
1398
+ **Duration:** 2 weeks (planned), 2.5 weeks (actual)
1399
+ **Stories Completed:** 8/8
1400
+ **Velocity:** 48 points (target: 60 points)
1401
+
1402
+ ## What Went Well
1403
+
1404
+ ✅ **Architecture decisions solid**
1405
+ - NextAuth.js choice worked well
1406
+ - Database sessions simpler than JWT
1407
+
1408
+ ✅ **Test coverage excellent**
1409
+ - All stories have E2E + API tests
1410
+ - No critical bugs in production
1411
+
1412
+ ✅ **Team collaboration strong**
1413
+ - Code reviews thorough
1414
+ - Knowledge sharing effective
1415
+
1416
+ ## What Didn't Go Well
1417
+
1418
+ ❌ **Estimation inaccurate**
1419
+ - Stories took 20% longer than estimated
1420
+ - Story 1.3 (Email Verification) took 2 days instead of 1
1421
+
1422
+ ❌ **Third-party integration surprise**
1423
+ - SendGrid API deprecation discovered mid-sprint
1424
+ - Required correct-course workflow
1425
+
1426
+ ❌ **Testing setup overhead**
1427
+ - Test fixtures took longer than expected to set up
1428
+ - Should have created fixtures earlier
1429
+
1430
+ ## Lessons Learned
1431
+
1432
+ 💡 **Buffer time for integrations**
1433
+ - Add 25% buffer to stories with third-party APIs
1434
+ - Research API stability before committing
1435
+
1436
+ 💡 **Test fixtures upfront**
1437
+ - Create test fixtures in first story of epic
1438
+ - Reuse across all stories
1439
+
1440
+ 💡 **Architecture review cadence**
1441
+ - Mid-epic architecture check-in would have caught issues earlier
1442
+
1443
+ ## Technical Insights
1444
+
1445
+ **Architecture:**
1446
+ - ADR-001 (NextAuth.js) validated ✅
1447
+ - ADR-004 (SendGrid) needed revision (v3 → v4)
1448
+
1449
+ **Code Quality:**
1450
+ - Average code-review score: 8.5/10
1451
+ - No critical issues
1452
+ - 3 high-priority issues (all addressed)
1453
+
1454
+ **Test Coverage:**
1455
+ - E2E: 95% of critical paths
1456
+ - API: 100% of endpoints
1457
+ - Unit: 85% of business logic
1458
+
1459
+ ## Planning Insights
1460
+
1461
+ **Estimation Accuracy:**
1462
+ - Estimated: 60 points
1463
+ - Actual: 72 points
1464
+ - Variance: +20%
1465
+ - **Adjustment**: Use 1.2× multiplier for next epic
1466
+
1467
+ **Requirements Clarity:**
1468
+ - PRD was clear ✅
1469
+ - Architecture was thorough ✅
1470
+ - Story AC needed refinement in 2 stories
1471
+
1472
+ **Dependency Management:**
1473
+ - Story dependencies well-sequenced
1474
+ - No blocking issues
1475
+
1476
+ ## Action Items for Epic 2
1477
+
1478
+ 1. **Create test fixtures first** (Story 2.1)
1479
+ - Owner: DEV
1480
+ - Timeline: First story of Epic 2
1481
+
1482
+ 2. **Add 25% buffer to integration stories**
1483
+ - Owner: SM
1484
+ - Apply in epic-2 estimates
1485
+
1486
+ 3. **Mid-epic architecture check-in**
1487
+ - Owner: Architect
1488
+ - Schedule after 50% epic completion
1489
+
1490
+ 4. **Research third-party API stability**
1491
+ - Owner: DEV
1492
+ - Before starting stories with external APIs
1493
+
1494
+ ## Process Improvements
1495
+
1496
+ **For Next Epic:**
1497
+ - ✅ Run architecture review mid-epic
1498
+ - ✅ Create test fixtures in first story
1499
+ - ✅ Add buffer time to estimates
1500
+ - ✅ Document third-party API versions in architecture
1501
+
1502
+ **For Future Projects:**
1503
+ - Document API stability research process
1504
+ - Create reusable test fixture templates
1505
+ ````
1506
+
1507
+ ### Related Workflows
1508
+
1509
+ - **sprint-planning** - Next epic planning
1510
+ - **architecture** - May need updates from insights
1511
+ - **create-story** - Apply lessons to story creation
1512
+
1513
+ ---
1514
+
1515
+ ## Utility Workflows
1516
+
1517
+ ### workflow-status
1518
+
1519
+ **Purpose:** Check "what should I do now?" for any agent.
1520
+
1521
+ **Agent:** All
1522
+ **Duration:** 2-5 minutes
1523
+ **When to Use:** Anytime you're unsure of next step
1524
+
1525
+ **How It Works:**
1526
+
1527
+ 1. Loads sprint-status.yaml
1528
+ 2. Determines current phase
1529
+ 3. Identifies next workflow to run
1530
+ 4. Provides clear recommendation
1531
+
1532
+ **Example Output:**
1533
+
1534
+ ```
1535
+ Current Phase: 4 (Implementation)
1536
+ Current Epic: Epic 1 (Authentication)
1537
+ Current Sprint: Sprint 1
1538
+
1539
+ Next Story: Story 1.3 (Email Verification)
1540
+ Status: TODO
1541
+ Dependencies: Story 1.2 (DONE) ✅
1542
+
1543
+ **Recommendation:** Run `create-story` to generate Story 1.3
1544
+
1545
+ After create-story:
1546
+ 1. Run story-context
1547
+ 2. Run dev-story
1548
+ 3. Run code-review
1549
+ 4. Run story-done
1550
+ ```
1551
+
1552
+ See: [workflow-status README](../workflows/workflow-status/README.md)
1553
+
1554
+ ---
1555
+
1556
+ ### document-project
1557
+
1558
+ **Purpose:** Analyze and document brownfield projects by scanning codebase, architecture, and patterns.
1559
+
1560
+ **Agent:** Analyst
1561
+ **Duration:** 1-3 hours
1562
+ **When to Use:** Brownfield projects without documentation
1563
+
1564
+ **How It Works:**
1565
+
1566
+ 1. Scans codebase structure
1567
+ 2. Identifies architecture patterns
1568
+ 3. Documents technology stack
1569
+ 4. Creates reference documentation
1570
+ 5. Generates PRD-like document from existing code
1571
+
1572
+ **Output:** `project-documentation-{date}.md`
1573
+
1574
+ **When to Run:**
1575
+
1576
+ - Before starting work on legacy project
1577
+ - When inheriting undocumented codebase
1578
+ - Creating onboarding documentation
1579
+
1580
+ See: [document-project README](../workflows/document-project/README.md)
1581
+
1582
+ ---
1583
+
1584
+ ## Story Lifecycle Visualization
1585
+
1586
+ ```
1587
+ ┌─────────────────────────────────────────────────────────────┐
1588
+ │ PHASE 4: IMPLEMENTATION (Iterative Story Lifecycle) │
1589
+ └─────────────────────────────────────────────────────────────┘
1590
+
1591
+ ┌─────────────────┐
1592
+ │ Sprint Planning │ → Creates sprint-status.yaml
1593
+ └────────┬────────┘ Defines story queue
1594
+
1595
+ ├──────────────────────────────────────────┐
1596
+ │ │
1597
+ ▼ │
1598
+ ┌─────────────────────┐ │
1599
+ │ Epic Tech Context │ → Optional per epic │
1600
+ │ (Once per epic) │ Provides technical │
1601
+ └─────────────────────┘ guidance │
1602
+ │ │
1603
+ ▼ │
1604
+ ┌─────────────────────────────────────────────────┤
1605
+ │ FOR EACH STORY IN QUEUE: │
1606
+ ├─────────────────────────────────────────────────┤
1607
+ │ │
1608
+ ▼ │
1609
+ ┌─────────────────┐ │
1610
+ │ Create Story │ → Generates story file │
1611
+ │ (TODO → IN PROGRESS) │
1612
+ └────────┬────────┘ │
1613
+ │ │
1614
+ ▼ │
1615
+ ┌─────────────────┐ │
1616
+ │ Story Context │ → Assembles focused context │
1617
+ └────────┬────────┘ │
1618
+ │ │
1619
+ ▼ │
1620
+ ┌─────────────────┐ │
1621
+ │ Dev Story │ → Implements + tests │
1622
+ │ (IN PROGRESS) │ │
1623
+ └────────┬────────┘ │
1624
+ │ │
1625
+ ▼ │
1626
+ ┌─────────────────┐ │
1627
+ │ Code Review │ → Senior dev review │
1628
+ │ (IN PROGRESS → │ │
1629
+ │ READY FOR REVIEW) │
1630
+ └────────┬────────┘ │
1631
+ │ │
1632
+ ┌────┴────┐ │
1633
+ │ Result? │ │
1634
+ └────┬────┘ │
1635
+ │ │
1636
+ ┌────┼────────────────────┐ │
1637
+ │ │ │ │
1638
+ ▼ ▼ ▼ │
1639
+ APPROVED APPROVED REQUEST │
1640
+ WITH COMMENTS CHANGES │
1641
+ │ │ │ │
1642
+ └─────────┴───────────────────┘ │
1643
+ │ │
1644
+ ▼ │
1645
+ ┌─────────────────┐ │
1646
+ │ Story Done │ → READY FOR REVIEW → DONE│
1647
+ └────────┬────────┘ │
1648
+ │ │
1649
+ ├─────────────────────────────────────┘
1650
+ │ More stories?
1651
+
1652
+
1653
+ ┌────────────────┐
1654
+ │ Epic Complete? │
1655
+ └────────┬───────┘
1656
+
1657
+ ┌────┼────┐
1658
+ │ │
1659
+ Yes No
1660
+ │ └──> Continue to next story
1661
+
1662
+
1663
+ ┌─────────────────┐
1664
+ │ Retrospective │ → Review epic, lessons learned
1665
+ └─────────────────┘
1666
+
1667
+
1668
+ All epics done?
1669
+
1670
+ Yes → PROJECT COMPLETE
1671
+ ```
1672
+
1673
+ ---
1674
+
1675
+ ## Best Practices for Phase 4
1676
+
1677
+ ### 1. One Story at a Time
1678
+
1679
+ **Focus on completing stories fully** before starting new ones. Don't parallelize stories unless you have multiple developers.
1680
+
1681
+ ### 2. Always Run story-context
1682
+
1683
+ Don't skip context assembly. DEV agent performs better with focused, relevant context.
1684
+
1685
+ ### 3. Write Tests First (ATDD)
1686
+
1687
+ For P0/P1 stories, write failing tests first (acceptance test-driven development), then implement to make them pass.
1688
+
1689
+ ### 4. Code Review P0/P1 Stories
1690
+
1691
+ Always review critical stories. P2/P3 can be optional reviews.
1692
+
1693
+ ### 5. Run Retrospectives
1694
+
1695
+ Don't skip retrospectives. They provide valuable insights that improve velocity in subsequent epics.
1696
+
1697
+ ### 6. Use workflow-status
1698
+
1699
+ When unsure what to do next, run workflow-status. It will guide you.
1700
+
1701
+ ### 7. Document Deviations
1702
+
1703
+ If you deviate from architecture or PRD, document why in story file.
1704
+
1705
+ ---
1706
+
1707
+ ## Common Anti-Patterns
1708
+
1709
+ ### ❌ Starting Multiple Stories Simultaneously
1710
+
1711
+ "Let's parallelize 5 stories to go faster."
1712
+ → **Result**: Context switching, incomplete stories, harder to track
1713
+
1714
+ ### ❌ Skipping story-context
1715
+
1716
+ "The DEV agent can just read the full PRD."
1717
+ → **Result**: Slow context loading, irrelevant info, slower implementation
1718
+
1719
+ ### ❌ No Code Reviews
1720
+
1721
+ "Code reviews slow us down, skip them."
1722
+ → **Result**: Technical debt, inconsistent quality, bugs in production
1723
+
1724
+ ### ❌ Skipping Retrospectives
1725
+
1726
+ "We're too busy shipping, no time for retros."
1727
+ → **Result**: Repeat mistakes, no process improvement, lower velocity
1728
+
1729
+ ### ✅ Correct Approach
1730
+
1731
+ - Focus on one story at a time
1732
+ - Always assemble story context
1733
+ - Review P0/P1 stories
1734
+ - Run retrospectives after epics
1735
+ - Use workflow-status for guidance
1736
+
1737
+ ---
1738
+
1739
+ ## Summary
1740
+
1741
+ Phase 4 Implementation follows a **story-centric workflow**:
1742
+
1743
+ | Workflow | Purpose | Frequency |
1744
+ | --------------------- | ------------------- | ----------------- |
1745
+ | **sprint-planning** | Initialize tracking | Once at start |
1746
+ | **epic-tech-context** | Technical guidance | Once per epic |
1747
+ | **create-story** | Generate story file | Per story |
1748
+ | **story-context** | Assemble context | Per story |
1749
+ | **dev-story** | Implement story | Per story |
1750
+ | **code-review** | Review quality | Per story (P0/P1) |
1751
+ | **correct-course** | Handle changes | As needed |
1752
+ | **retrospective** | Learn and improve | After each epic |
1753
+
1754
+ **Key Takeaway:** Implementation is iterative and incremental. Move one story through its full lifecycle before starting the next. Use retrospectives to continuously improve.
1755
+
1756
+ **Next:** Testing & QA (testarch workflows) run in parallel with implementation.
1757
+
1758
+ See: [workflows-testing.md](./workflows-testing.md)