bmad-method 4.37.0 → 4.39.1

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 (251) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +3 -3
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +3 -3
  3. package/.github/workflows/discord.yaml +11 -2
  4. package/.github/workflows/format-check.yaml +42 -0
  5. package/.github/workflows/manual-release.yaml +173 -0
  6. package/.husky/pre-commit +3 -0
  7. package/.vscode/settings.json +26 -1
  8. package/CHANGELOG.md +2 -23
  9. package/README.md +2 -0
  10. package/bmad-core/agent-teams/team-all.yaml +1 -1
  11. package/bmad-core/agents/analyst.md +16 -15
  12. package/bmad-core/agents/architect.md +11 -11
  13. package/bmad-core/agents/bmad-master.md +23 -22
  14. package/bmad-core/agents/bmad-orchestrator.md +13 -17
  15. package/bmad-core/agents/dev.md +14 -11
  16. package/bmad-core/agents/pm.md +15 -14
  17. package/bmad-core/agents/po.md +9 -8
  18. package/bmad-core/agents/qa.md +42 -22
  19. package/bmad-core/agents/sm.md +7 -6
  20. package/bmad-core/agents/ux-expert.md +6 -5
  21. package/bmad-core/core-config.yaml +2 -0
  22. package/bmad-core/data/bmad-kb.md +1 -1
  23. package/bmad-core/data/test-levels-framework.md +146 -0
  24. package/bmad-core/data/test-priorities-matrix.md +172 -0
  25. package/bmad-core/tasks/apply-qa-fixes.md +148 -0
  26. package/bmad-core/tasks/facilitate-brainstorming-session.md +1 -1
  27. package/bmad-core/tasks/nfr-assess.md +343 -0
  28. package/bmad-core/tasks/qa-gate.md +161 -0
  29. package/bmad-core/tasks/review-story.md +234 -74
  30. package/bmad-core/tasks/risk-profile.md +353 -0
  31. package/bmad-core/tasks/test-design.md +174 -0
  32. package/bmad-core/tasks/trace-requirements.md +264 -0
  33. package/bmad-core/templates/architecture-tmpl.yaml +49 -49
  34. package/bmad-core/templates/brainstorming-output-tmpl.yaml +5 -5
  35. package/bmad-core/templates/brownfield-architecture-tmpl.yaml +31 -31
  36. package/bmad-core/templates/brownfield-prd-tmpl.yaml +13 -13
  37. package/bmad-core/templates/competitor-analysis-tmpl.yaml +19 -6
  38. package/bmad-core/templates/front-end-architecture-tmpl.yaml +21 -9
  39. package/bmad-core/templates/front-end-spec-tmpl.yaml +24 -24
  40. package/bmad-core/templates/fullstack-architecture-tmpl.yaml +122 -104
  41. package/bmad-core/templates/market-research-tmpl.yaml +2 -2
  42. package/bmad-core/templates/prd-tmpl.yaml +9 -9
  43. package/bmad-core/templates/project-brief-tmpl.yaml +4 -4
  44. package/bmad-core/templates/qa-gate-tmpl.yaml +102 -0
  45. package/bmad-core/templates/story-tmpl.yaml +12 -12
  46. package/bmad-core/workflows/brownfield-fullstack.yaml +9 -9
  47. package/bmad-core/workflows/brownfield-service.yaml +1 -1
  48. package/bmad-core/workflows/brownfield-ui.yaml +1 -1
  49. package/bmad-core/workflows/greenfield-fullstack.yaml +1 -1
  50. package/bmad-core/workflows/greenfield-service.yaml +1 -1
  51. package/bmad-core/workflows/greenfield-ui.yaml +1 -1
  52. package/common/utils/bmad-doc-template.md +5 -5
  53. package/dist/agents/analyst.txt +1086 -1079
  54. package/dist/agents/architect.txt +1534 -1526
  55. package/dist/agents/bmad-master.txt +646 -632
  56. package/dist/agents/bmad-orchestrator.txt +40 -18
  57. package/dist/agents/dev.txt +158 -19
  58. package/dist/agents/pm.txt +1082 -1107
  59. package/dist/agents/po.txt +314 -332
  60. package/dist/agents/qa.txt +1754 -151
  61. package/dist/agents/sm.txt +88 -98
  62. package/dist/agents/ux-expert.txt +80 -87
  63. package/dist/expansion-packs/bmad-2d-phaser-game-dev/agents/game-designer.txt +109 -146
  64. package/dist/expansion-packs/bmad-2d-phaser-game-dev/agents/game-developer.txt +75 -86
  65. package/dist/expansion-packs/bmad-2d-phaser-game-dev/agents/game-sm.txt +41 -48
  66. package/dist/expansion-packs/bmad-2d-phaser-game-dev/teams/phaser-2d-nodejs-game-team.txt +1903 -1941
  67. package/dist/expansion-packs/bmad-2d-unity-game-dev/agents/game-architect.txt +15 -50
  68. package/dist/expansion-packs/bmad-2d-unity-game-dev/agents/game-designer.txt +149 -195
  69. package/dist/expansion-packs/bmad-2d-unity-game-dev/agents/game-developer.txt +0 -15
  70. package/dist/expansion-packs/bmad-2d-unity-game-dev/agents/game-sm.txt +20 -37
  71. package/dist/expansion-packs/bmad-2d-unity-game-dev/teams/unity-2d-game-team.txt +2660 -2752
  72. package/dist/expansion-packs/bmad-creative-writing/agents/beta-reader.txt +871 -0
  73. package/dist/expansion-packs/bmad-creative-writing/agents/book-critic.txt +78 -0
  74. package/dist/expansion-packs/bmad-creative-writing/agents/character-psychologist.txt +839 -0
  75. package/dist/expansion-packs/bmad-creative-writing/agents/cover-designer.txt +85 -0
  76. package/dist/expansion-packs/bmad-creative-writing/agents/dialog-specialist.txt +861 -0
  77. package/dist/expansion-packs/bmad-creative-writing/agents/editor.txt +796 -0
  78. package/dist/expansion-packs/bmad-creative-writing/agents/genre-specialist.txt +927 -0
  79. package/dist/expansion-packs/bmad-creative-writing/agents/narrative-designer.txt +842 -0
  80. package/dist/expansion-packs/bmad-creative-writing/agents/plot-architect.txt +1126 -0
  81. package/dist/expansion-packs/bmad-creative-writing/agents/world-builder.txt +864 -0
  82. package/dist/expansion-packs/bmad-creative-writing/teams/agent-team.txt +5917 -0
  83. package/dist/expansion-packs/bmad-infrastructure-devops/agents/infra-devops-platform.txt +25 -27
  84. package/dist/teams/team-all.txt +5541 -3768
  85. package/dist/teams/team-fullstack.txt +3014 -2987
  86. package/dist/teams/team-ide-minimal.txt +2219 -469
  87. package/dist/teams/team-no-ui.txt +2993 -2966
  88. package/docs/enhanced-ide-development-workflow.md +220 -15
  89. package/docs/user-guide.md +271 -18
  90. package/docs/versioning-and-releases.md +122 -44
  91. package/docs/working-in-the-brownfield.md +264 -31
  92. package/eslint.config.mjs +119 -0
  93. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-developer.md +4 -4
  94. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-sm.md +1 -1
  95. package/expansion-packs/bmad-2d-phaser-game-dev/config.yaml +1 -1
  96. package/expansion-packs/bmad-2d-phaser-game-dev/data/development-guidelines.md +26 -28
  97. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-architecture-tmpl.yaml +50 -50
  98. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-brief-tmpl.yaml +23 -23
  99. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-design-doc-tmpl.yaml +24 -24
  100. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-story-tmpl.yaml +42 -42
  101. package/expansion-packs/bmad-2d-phaser-game-dev/templates/level-design-doc-tmpl.yaml +65 -65
  102. package/expansion-packs/bmad-2d-phaser-game-dev/workflows/game-dev-greenfield.yaml +5 -5
  103. package/expansion-packs/bmad-2d-phaser-game-dev/workflows/game-prototype.yaml +1 -1
  104. package/expansion-packs/bmad-2d-unity-game-dev/agents/game-developer.md +3 -3
  105. package/expansion-packs/bmad-2d-unity-game-dev/config.yaml +1 -1
  106. package/expansion-packs/bmad-2d-unity-game-dev/data/bmad-kb.md +1 -1
  107. package/expansion-packs/bmad-2d-unity-game-dev/templates/game-brief-tmpl.yaml +23 -23
  108. package/expansion-packs/bmad-2d-unity-game-dev/templates/game-design-doc-tmpl.yaml +63 -63
  109. package/expansion-packs/bmad-2d-unity-game-dev/templates/game-story-tmpl.yaml +20 -20
  110. package/expansion-packs/bmad-2d-unity-game-dev/templates/level-design-doc-tmpl.yaml +65 -65
  111. package/expansion-packs/bmad-2d-unity-game-dev/workflows/game-dev-greenfield.yaml +5 -5
  112. package/expansion-packs/bmad-2d-unity-game-dev/workflows/game-prototype.yaml +1 -1
  113. package/expansion-packs/bmad-creative-writing/README.md +132 -0
  114. package/expansion-packs/bmad-creative-writing/agent-teams/agent-team.yaml +19 -0
  115. package/expansion-packs/bmad-creative-writing/agents/beta-reader.md +91 -0
  116. package/expansion-packs/bmad-creative-writing/agents/book-critic.md +35 -0
  117. package/expansion-packs/bmad-creative-writing/agents/character-psychologist.md +90 -0
  118. package/expansion-packs/bmad-creative-writing/agents/cover-designer.md +41 -0
  119. package/expansion-packs/bmad-creative-writing/agents/dialog-specialist.md +89 -0
  120. package/expansion-packs/bmad-creative-writing/agents/editor.md +90 -0
  121. package/expansion-packs/bmad-creative-writing/agents/genre-specialist.md +92 -0
  122. package/expansion-packs/bmad-creative-writing/agents/narrative-designer.md +90 -0
  123. package/expansion-packs/bmad-creative-writing/agents/plot-architect.md +92 -0
  124. package/expansion-packs/bmad-creative-writing/agents/world-builder.md +91 -0
  125. package/expansion-packs/bmad-creative-writing/checklists/beta-feedback-closure-checklist.md +16 -0
  126. package/expansion-packs/bmad-creative-writing/checklists/character-consistency-checklist.md +16 -0
  127. package/expansion-packs/bmad-creative-writing/checklists/comedic-timing-checklist.md +16 -0
  128. package/expansion-packs/bmad-creative-writing/checklists/cyberpunk-aesthetic-checklist.md +16 -0
  129. package/expansion-packs/bmad-creative-writing/checklists/ebook-formatting-checklist.md +15 -0
  130. package/expansion-packs/bmad-creative-writing/checklists/epic-poetry-meter-checklist.md +16 -0
  131. package/expansion-packs/bmad-creative-writing/checklists/fantasy-magic-system-checklist.md +16 -0
  132. package/expansion-packs/bmad-creative-writing/checklists/foreshadowing-payoff-checklist.md +15 -0
  133. package/expansion-packs/bmad-creative-writing/checklists/genre-tropes-checklist.md +15 -0
  134. package/expansion-packs/bmad-creative-writing/checklists/historical-accuracy-checklist.md +16 -0
  135. package/expansion-packs/bmad-creative-writing/checklists/horror-suspense-checklist.md +16 -0
  136. package/expansion-packs/bmad-creative-writing/checklists/kdp-cover-ready-checklist.md +18 -0
  137. package/expansion-packs/bmad-creative-writing/checklists/line-edit-quality-checklist.md +16 -0
  138. package/expansion-packs/bmad-creative-writing/checklists/marketing-copy-checklist.md +16 -0
  139. package/expansion-packs/bmad-creative-writing/checklists/mystery-clue-trail-checklist.md +16 -0
  140. package/expansion-packs/bmad-creative-writing/checklists/orbital-mechanics-checklist.md +16 -0
  141. package/expansion-packs/bmad-creative-writing/checklists/plot-structure-checklist.md +49 -0
  142. package/expansion-packs/bmad-creative-writing/checklists/publication-readiness-checklist.md +16 -0
  143. package/expansion-packs/bmad-creative-writing/checklists/romance-emotional-beats-checklist.md +16 -0
  144. package/expansion-packs/bmad-creative-writing/checklists/scene-quality-checklist.md +16 -0
  145. package/expansion-packs/bmad-creative-writing/checklists/scifi-technology-plausibility-checklist.md +15 -0
  146. package/expansion-packs/bmad-creative-writing/checklists/sensitivity-representation-checklist.md +16 -0
  147. package/expansion-packs/bmad-creative-writing/checklists/steampunk-gadget-checklist.md +16 -0
  148. package/expansion-packs/bmad-creative-writing/checklists/thriller-pacing-stakes-checklist.md +16 -0
  149. package/expansion-packs/bmad-creative-writing/checklists/timeline-continuity-checklist.md +16 -0
  150. package/expansion-packs/bmad-creative-writing/checklists/world-building-continuity-checklist.md +16 -0
  151. package/expansion-packs/bmad-creative-writing/checklists/ya-appropriateness-checklist.md +16 -0
  152. package/expansion-packs/bmad-creative-writing/config.yaml +11 -0
  153. package/expansion-packs/bmad-creative-writing/data/bmad-kb.md +197 -0
  154. package/expansion-packs/bmad-creative-writing/data/story-structures.md +58 -0
  155. package/expansion-packs/bmad-creative-writing/docs/brief.md +183 -0
  156. package/expansion-packs/bmad-creative-writing/tasks/advanced-elicitation.md +117 -0
  157. package/expansion-packs/bmad-creative-writing/tasks/analyze-reader-feedback.md +16 -0
  158. package/expansion-packs/bmad-creative-writing/tasks/analyze-story-structure.md +55 -0
  159. package/expansion-packs/bmad-creative-writing/tasks/assemble-kdp-package.md +22 -0
  160. package/expansion-packs/bmad-creative-writing/tasks/brainstorm-premise.md +16 -0
  161. package/expansion-packs/bmad-creative-writing/tasks/build-world.md +17 -0
  162. package/expansion-packs/bmad-creative-writing/tasks/character-depth-pass.md +15 -0
  163. package/expansion-packs/bmad-creative-writing/tasks/create-doc.md +101 -0
  164. package/expansion-packs/bmad-creative-writing/tasks/create-draft-section.md +19 -0
  165. package/expansion-packs/bmad-creative-writing/tasks/critical-review.md +19 -0
  166. package/expansion-packs/bmad-creative-writing/tasks/develop-character.md +17 -0
  167. package/expansion-packs/bmad-creative-writing/tasks/execute-checklist.md +93 -0
  168. package/expansion-packs/bmad-creative-writing/tasks/expand-premise.md +16 -0
  169. package/expansion-packs/bmad-creative-writing/tasks/expand-synopsis.md +16 -0
  170. package/expansion-packs/bmad-creative-writing/tasks/final-polish.md +16 -0
  171. package/expansion-packs/bmad-creative-writing/tasks/generate-cover-brief.md +18 -0
  172. package/expansion-packs/bmad-creative-writing/tasks/generate-cover-prompts.md +19 -0
  173. package/expansion-packs/bmad-creative-writing/tasks/generate-scene-list.md +16 -0
  174. package/expansion-packs/bmad-creative-writing/tasks/incorporate-feedback.md +18 -0
  175. package/expansion-packs/bmad-creative-writing/tasks/outline-scenes.md +16 -0
  176. package/expansion-packs/bmad-creative-writing/tasks/provide-feedback.md +17 -0
  177. package/expansion-packs/bmad-creative-writing/tasks/publish-chapter.md +16 -0
  178. package/expansion-packs/bmad-creative-writing/tasks/quick-feedback.md +15 -0
  179. package/expansion-packs/bmad-creative-writing/tasks/select-next-arc.md +16 -0
  180. package/expansion-packs/bmad-creative-writing/tasks/workshop-dialog.md +51 -0
  181. package/expansion-packs/bmad-creative-writing/templates/beta-feedback-form.yaml +96 -0
  182. package/expansion-packs/bmad-creative-writing/templates/chapter-draft-tmpl.yaml +81 -0
  183. package/expansion-packs/bmad-creative-writing/templates/character-profile-tmpl.yaml +92 -0
  184. package/expansion-packs/bmad-creative-writing/templates/cover-design-brief-tmpl.yaml +97 -0
  185. package/expansion-packs/bmad-creative-writing/templates/premise-brief-tmpl.yaml +77 -0
  186. package/expansion-packs/bmad-creative-writing/templates/scene-list-tmpl.yaml +54 -0
  187. package/expansion-packs/bmad-creative-writing/templates/story-outline-tmpl.yaml +96 -0
  188. package/expansion-packs/bmad-creative-writing/templates/world-guide-tmpl.yaml +88 -0
  189. package/expansion-packs/bmad-creative-writing/workflows/book-cover-design-workflow.md +176 -0
  190. package/expansion-packs/bmad-creative-writing/workflows/novel-greenfield-workflow.yaml +58 -0
  191. package/expansion-packs/bmad-creative-writing/workflows/novel-serial-workflow.yaml +51 -0
  192. package/expansion-packs/bmad-creative-writing/workflows/novel-snowflake-workflow.yaml +69 -0
  193. package/expansion-packs/bmad-creative-writing/workflows/novel-writing.yaml +92 -0
  194. package/expansion-packs/bmad-creative-writing/workflows/screenplay-development.yaml +86 -0
  195. package/expansion-packs/bmad-creative-writing/workflows/series-planning.yaml +79 -0
  196. package/expansion-packs/bmad-creative-writing/workflows/short-story-creation.yaml +65 -0
  197. package/expansion-packs/bmad-infrastructure-devops/config.yaml +1 -1
  198. package/expansion-packs/bmad-infrastructure-devops/templates/infrastructure-architecture-tmpl.yaml +20 -20
  199. package/expansion-packs/bmad-infrastructure-devops/templates/infrastructure-platform-from-arch-tmpl.yaml +7 -7
  200. package/package.json +62 -39
  201. package/prettier.config.mjs +32 -0
  202. package/sync-version.sh +23 -0
  203. package/tools/bmad-npx-wrapper.js +10 -10
  204. package/tools/builders/web-builder.js +124 -130
  205. package/tools/bump-all-versions.js +42 -33
  206. package/tools/bump-expansion-version.js +23 -16
  207. package/tools/cli.js +10 -12
  208. package/tools/flattener/aggregate.js +10 -10
  209. package/tools/flattener/binary.js +44 -17
  210. package/tools/flattener/discovery.js +19 -18
  211. package/tools/flattener/files.js +6 -6
  212. package/tools/flattener/ignoreRules.js +125 -125
  213. package/tools/flattener/main.js +426 -70
  214. package/tools/flattener/projectRoot.js +186 -25
  215. package/tools/flattener/prompts.js +9 -9
  216. package/tools/flattener/stats.helpers.js +395 -0
  217. package/tools/flattener/stats.js +64 -14
  218. package/tools/flattener/test-matrix.js +413 -0
  219. package/tools/flattener/xml.js +33 -31
  220. package/tools/installer/bin/bmad.js +156 -113
  221. package/tools/installer/config/ide-agent-config.yaml +1 -1
  222. package/tools/installer/config/install.config.yaml +13 -3
  223. package/tools/installer/lib/config-loader.js +46 -42
  224. package/tools/installer/lib/file-manager.js +91 -113
  225. package/tools/installer/lib/ide-base-setup.js +57 -56
  226. package/tools/installer/lib/ide-setup.js +545 -399
  227. package/tools/installer/lib/installer.js +875 -714
  228. package/tools/installer/lib/memory-profiler.js +54 -53
  229. package/tools/installer/lib/module-manager.js +19 -15
  230. package/tools/installer/lib/resource-locator.js +26 -28
  231. package/tools/installer/package.json +19 -19
  232. package/tools/lib/dependency-resolver.js +26 -30
  233. package/tools/lib/yaml-utils.js +7 -7
  234. package/tools/preview-release-notes.js +66 -0
  235. package/tools/shared/bannerArt.js +3 -3
  236. package/tools/sync-installer-version.js +7 -9
  237. package/tools/update-expansion-version.js +14 -15
  238. package/tools/upgraders/v3-to-v4-upgrader.js +203 -294
  239. package/tools/version-bump.js +41 -26
  240. package/tools/yaml-format.js +56 -43
  241. package/.github/workflows/release.yaml +0 -60
  242. package/.releaserc.json +0 -21
  243. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/Complete AI Agent System - Flowchart.svg +0 -102
  244. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/PART 1 - Google Cloud Vertex AI Setup Documentation/1.1 Google Cloud Project Setup/1.1.1 - Initial Project Configuration - bash copy.txt +0 -13
  245. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/PART 1 - Google Cloud Vertex AI Setup Documentation/1.1 Google Cloud Project Setup/1.1.1 - Initial Project Configuration - bash.txt +0 -13
  246. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/PART 1 - Google Cloud Vertex AI Setup Documentation/1.2 Agent Development Kit Installation/1.2.2 - Basic Project Structure - txt.txt +0 -25
  247. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/PART 1 - Google Cloud Vertex AI Setup Documentation/1.3 Core Configuration Files/1.3.1 - settings.py +0 -34
  248. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/PART 1 - Google Cloud Vertex AI Setup Documentation/1.3 Core Configuration Files/1.3.2 - main.py - Base Application.py +0 -70
  249. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/PART 1 - Google Cloud Vertex AI Setup Documentation/1.4 Deployment Configuration/1.4.2 - cloudbuild.yaml +0 -26
  250. package/expansion-packs/Complete AI Agent System - Blank Templates & Google Cloud Setup/README.md +0 -109
  251. package/tools/semantic-release-sync-installer.js +0 -30
@@ -53,191 +53,1794 @@ activation-instructions:
53
53
  agent:
54
54
  name: Quinn
55
55
  id: qa
56
- title: Senior Developer & QA Architect
56
+ title: Test Architect & Quality Advisor
57
57
  icon: 🧪
58
- whenToUse: Use for senior code review, refactoring, test planning, quality assurance, and mentoring through code improvements
58
+ whenToUse: |
59
+ Use for comprehensive test architecture review, quality gate decisions,
60
+ and code improvement. Provides thorough analysis including requirements
61
+ traceability, risk assessment, and test strategy.
62
+ Advisory only - teams choose their quality bar.
59
63
  customization: null
60
64
  persona:
61
- role: Senior Developer & Test Architect
62
- style: Methodical, detail-oriented, quality-focused, mentoring, strategic
63
- identity: Senior developer with deep expertise in code quality, architecture, and test automation
64
- focus: Code excellence through review, refactoring, and comprehensive testing strategies
65
+ role: Test Architect with Quality Advisory Authority
66
+ style: Comprehensive, systematic, advisory, educational, pragmatic
67
+ identity: Test architect who provides thorough quality assessment and actionable recommendations without blocking progress
68
+ focus: Comprehensive quality analysis through test architecture, risk assessment, and advisory gates
65
69
  core_principles:
66
- - Senior Developer Mindset - Review and improve code as a senior mentoring juniors
67
- - Active Refactoring - Don't just identify issues, fix them with clear explanations
68
- - Test Strategy & Architecture - Design holistic testing strategies across all levels
69
- - Code Quality Excellence - Enforce best practices, patterns, and clean code principles
70
- - Shift-Left Testing - Integrate testing early in development lifecycle
71
- - Performance & Security - Proactively identify and fix performance/security issues
72
- - Mentorship Through Action - Explain WHY and HOW when making improvements
73
- - Risk-Based Testing - Prioritize testing based on risk and critical areas
74
- - Continuous Improvement - Balance perfection with pragmatism
75
- - Architecture & Design Patterns - Ensure proper patterns and maintainable code structure
70
+ - Depth As Needed - Go deep based on risk signals, stay concise when low risk
71
+ - Requirements Traceability - Map all stories to tests using Given-When-Then patterns
72
+ - Risk-Based Testing - Assess and prioritize by probability × impact
73
+ - Quality Attributes - Validate NFRs (security, performance, reliability) via scenarios
74
+ - Testability Assessment - Evaluate controllability, observability, debuggability
75
+ - Gate Governance - Provide clear PASS/CONCERNS/FAIL/WAIVED decisions with rationale
76
+ - Advisory Excellence - Educate through documentation, never block arbitrarily
77
+ - Technical Debt Awareness - Identify and quantify debt with improvement suggestions
78
+ - LLM Acceleration - Use LLMs to accelerate thorough yet focused analysis
79
+ - Pragmatic Balance - Distinguish must-fix from nice-to-have improvements
76
80
  story-file-permissions:
77
81
  - CRITICAL: When reviewing stories, you are ONLY authorized to update the "QA Results" section of story files
78
82
  - CRITICAL: DO NOT modify any other sections including Status, Story, Acceptance Criteria, Tasks/Subtasks, Dev Notes, Testing, Dev Agent Record, Change Log, or any other sections
79
83
  - CRITICAL: Your updates must be limited to appending your review results in the QA Results section only
80
84
  commands:
81
85
  - help: Show numbered list of the following commands to allow selection
82
- - review {story}: execute the task review-story for the highest sequence story in docs/stories unless another is specified - keep any specified technical-preferences in mind as needed
83
- - exit: Say goodbye as the QA Engineer, and then abandon inhabiting this persona
86
+ - gate {story}: Execute qa-gate task to write/update quality gate decision in directory from qa.qaLocation/gates/
87
+ - nfr-assess {story}: Execute nfr-assess task to validate non-functional requirements
88
+ - review {story}: |
89
+ Adaptive, risk-aware comprehensive review.
90
+ Produces: QA Results update in story file + gate file (PASS/CONCERNS/FAIL/WAIVED).
91
+ Gate file location: qa.qaLocation/gates/{epic}.{story}-{slug}.yml
92
+ Executes review-story task which includes all analysis and creates gate decision.
93
+ - risk-profile {story}: Execute risk-profile task to generate risk assessment matrix
94
+ - test-design {story}: Execute test-design task to create comprehensive test scenarios
95
+ - trace {story}: Execute trace-requirements task to map requirements to tests using Given-When-Then
96
+ - exit: Say goodbye as the Test Architect, and then abandon inhabiting this persona
84
97
  dependencies:
85
- tasks:
86
- - review-story.md
87
98
  data:
88
99
  - technical-preferences.md
100
+ tasks:
101
+ - nfr-assess.md
102
+ - qa-gate.md
103
+ - review-story.md
104
+ - risk-profile.md
105
+ - test-design.md
106
+ - trace-requirements.md
89
107
  templates:
108
+ - qa-gate-tmpl.yaml
90
109
  - story-tmpl.yaml
91
110
  ```
92
- ==================== END: .bmad-core/agents/qa.md ====================
111
+ ==================== END: .bmad-core/agents/qa.md ====================
112
+
113
+ ==================== START: .bmad-core/tasks/nfr-assess.md ====================
114
+ # nfr-assess
115
+
116
+ Quick NFR validation focused on the core four: security, performance, reliability, maintainability.
117
+
118
+ ## Inputs
119
+
120
+ ```yaml
121
+ required:
122
+ - story_id: '{epic}.{story}' # e.g., "1.3"
123
+ - story_path: `bmad-core/core-config.yaml` for the `devStoryLocation`
124
+
125
+ optional:
126
+ - architecture_refs: `bmad-core/core-config.yaml` for the `architecture.architectureFile`
127
+ - technical_preferences: `bmad-core/core-config.yaml` for the `technicalPreferences`
128
+ - acceptance_criteria: From story file
129
+ ```
130
+
131
+ ## Purpose
132
+
133
+ Assess non-functional requirements for a story and generate:
134
+
135
+ 1. YAML block for the gate file's `nfr_validation` section
136
+ 2. Brief markdown assessment saved to `qa.qaLocation/assessments/{epic}.{story}-nfr-{YYYYMMDD}.md`
137
+
138
+ ## Process
139
+
140
+ ### 0. Fail-safe for Missing Inputs
141
+
142
+ If story_path or story file can't be found:
143
+
144
+ - Still create assessment file with note: "Source story not found"
145
+ - Set all selected NFRs to CONCERNS with notes: "Target unknown / evidence missing"
146
+ - Continue with assessment to provide value
147
+
148
+ ### 1. Elicit Scope
149
+
150
+ **Interactive mode:** Ask which NFRs to assess
151
+ **Non-interactive mode:** Default to core four (security, performance, reliability, maintainability)
152
+
153
+ ```text
154
+ Which NFRs should I assess? (Enter numbers or press Enter for default)
155
+ [1] Security (default)
156
+ [2] Performance (default)
157
+ [3] Reliability (default)
158
+ [4] Maintainability (default)
159
+ [5] Usability
160
+ [6] Compatibility
161
+ [7] Portability
162
+ [8] Functional Suitability
163
+
164
+ > [Enter for 1-4]
165
+ ```
166
+
167
+ ### 2. Check for Thresholds
168
+
169
+ Look for NFR requirements in:
170
+
171
+ - Story acceptance criteria
172
+ - `docs/architecture/*.md` files
173
+ - `docs/technical-preferences.md`
174
+
175
+ **Interactive mode:** Ask for missing thresholds
176
+ **Non-interactive mode:** Mark as CONCERNS with "Target unknown"
177
+
178
+ ```text
179
+ No performance requirements found. What's your target response time?
180
+ > 200ms for API calls
181
+
182
+ No security requirements found. Required auth method?
183
+ > JWT with refresh tokens
184
+ ```
185
+
186
+ **Unknown targets policy:** If a target is missing and not provided, mark status as CONCERNS with notes: "Target unknown"
187
+
188
+ ### 3. Quick Assessment
189
+
190
+ For each selected NFR, check:
191
+
192
+ - Is there evidence it's implemented?
193
+ - Can we validate it?
194
+ - Are there obvious gaps?
195
+
196
+ ### 4. Generate Outputs
197
+
198
+ ## Output 1: Gate YAML Block
199
+
200
+ Generate ONLY for NFRs actually assessed (no placeholders):
201
+
202
+ ```yaml
203
+ # Gate YAML (copy/paste):
204
+ nfr_validation:
205
+ _assessed: [security, performance, reliability, maintainability]
206
+ security:
207
+ status: CONCERNS
208
+ notes: 'No rate limiting on auth endpoints'
209
+ performance:
210
+ status: PASS
211
+ notes: 'Response times < 200ms verified'
212
+ reliability:
213
+ status: PASS
214
+ notes: 'Error handling and retries implemented'
215
+ maintainability:
216
+ status: CONCERNS
217
+ notes: 'Test coverage at 65%, target is 80%'
218
+ ```
219
+
220
+ ## Deterministic Status Rules
221
+
222
+ - **FAIL**: Any selected NFR has critical gap or target clearly not met
223
+ - **CONCERNS**: No FAILs, but any NFR is unknown/partial/missing evidence
224
+ - **PASS**: All selected NFRs meet targets with evidence
225
+
226
+ ## Quality Score Calculation
227
+
228
+ ```
229
+ quality_score = 100
230
+ - 20 for each FAIL attribute
231
+ - 10 for each CONCERNS attribute
232
+ Floor at 0, ceiling at 100
233
+ ```
234
+
235
+ If `technical-preferences.md` defines custom weights, use those instead.
236
+
237
+ ## Output 2: Brief Assessment Report
238
+
239
+ **ALWAYS save to:** `qa.qaLocation/assessments/{epic}.{story}-nfr-{YYYYMMDD}.md`
240
+
241
+ ```markdown
242
+ # NFR Assessment: {epic}.{story}
243
+
244
+ Date: {date}
245
+ Reviewer: Quinn
246
+
247
+ <!-- Note: Source story not found (if applicable) -->
248
+
249
+ ## Summary
250
+
251
+ - Security: CONCERNS - Missing rate limiting
252
+ - Performance: PASS - Meets <200ms requirement
253
+ - Reliability: PASS - Proper error handling
254
+ - Maintainability: CONCERNS - Test coverage below target
255
+
256
+ ## Critical Issues
257
+
258
+ 1. **No rate limiting** (Security)
259
+ - Risk: Brute force attacks possible
260
+ - Fix: Add rate limiting middleware to auth endpoints
261
+
262
+ 2. **Test coverage 65%** (Maintainability)
263
+ - Risk: Untested code paths
264
+ - Fix: Add tests for uncovered branches
265
+
266
+ ## Quick Wins
267
+
268
+ - Add rate limiting: ~2 hours
269
+ - Increase test coverage: ~4 hours
270
+ - Add performance monitoring: ~1 hour
271
+ ```
272
+
273
+ ## Output 3: Story Update Line
274
+
275
+ **End with this line for the review task to quote:**
276
+
277
+ ```
278
+ NFR assessment: qa.qaLocation/assessments/{epic}.{story}-nfr-{YYYYMMDD}.md
279
+ ```
280
+
281
+ ## Output 4: Gate Integration Line
282
+
283
+ **Always print at the end:**
284
+
285
+ ```
286
+ Gate NFR block ready → paste into qa.qaLocation/gates/{epic}.{story}-{slug}.yml under nfr_validation
287
+ ```
288
+
289
+ ## Assessment Criteria
290
+
291
+ ### Security
292
+
293
+ **PASS if:**
294
+
295
+ - Authentication implemented
296
+ - Authorization enforced
297
+ - Input validation present
298
+ - No hardcoded secrets
299
+
300
+ **CONCERNS if:**
301
+
302
+ - Missing rate limiting
303
+ - Weak encryption
304
+ - Incomplete authorization
305
+
306
+ **FAIL if:**
307
+
308
+ - No authentication
309
+ - Hardcoded credentials
310
+ - SQL injection vulnerabilities
311
+
312
+ ### Performance
313
+
314
+ **PASS if:**
315
+
316
+ - Meets response time targets
317
+ - No obvious bottlenecks
318
+ - Reasonable resource usage
319
+
320
+ **CONCERNS if:**
321
+
322
+ - Close to limits
323
+ - Missing indexes
324
+ - No caching strategy
325
+
326
+ **FAIL if:**
327
+
328
+ - Exceeds response time limits
329
+ - Memory leaks
330
+ - Unoptimized queries
331
+
332
+ ### Reliability
333
+
334
+ **PASS if:**
335
+
336
+ - Error handling present
337
+ - Graceful degradation
338
+ - Retry logic where needed
339
+
340
+ **CONCERNS if:**
341
+
342
+ - Some error cases unhandled
343
+ - No circuit breakers
344
+ - Missing health checks
345
+
346
+ **FAIL if:**
347
+
348
+ - No error handling
349
+ - Crashes on errors
350
+ - No recovery mechanisms
351
+
352
+ ### Maintainability
353
+
354
+ **PASS if:**
355
+
356
+ - Test coverage meets target
357
+ - Code well-structured
358
+ - Documentation present
359
+
360
+ **CONCERNS if:**
361
+
362
+ - Test coverage below target
363
+ - Some code duplication
364
+ - Missing documentation
365
+
366
+ **FAIL if:**
367
+
368
+ - No tests
369
+ - Highly coupled code
370
+ - No documentation
371
+
372
+ ## Quick Reference
373
+
374
+ ### What to Check
375
+
376
+ ```yaml
377
+ security:
378
+ - Authentication mechanism
379
+ - Authorization checks
380
+ - Input validation
381
+ - Secret management
382
+ - Rate limiting
383
+
384
+ performance:
385
+ - Response times
386
+ - Database queries
387
+ - Caching usage
388
+ - Resource consumption
389
+
390
+ reliability:
391
+ - Error handling
392
+ - Retry logic
393
+ - Circuit breakers
394
+ - Health checks
395
+ - Logging
396
+
397
+ maintainability:
398
+ - Test coverage
399
+ - Code structure
400
+ - Documentation
401
+ - Dependencies
402
+ ```
403
+
404
+ ## Key Principles
405
+
406
+ - Focus on the core four NFRs by default
407
+ - Quick assessment, not deep analysis
408
+ - Gate-ready output format
409
+ - Brief, actionable findings
410
+ - Skip what doesn't apply
411
+ - Deterministic status rules for consistency
412
+ - Unknown targets → CONCERNS, not guesses
413
+
414
+ ---
415
+
416
+ ## Appendix: ISO 25010 Reference
417
+
418
+ <details>
419
+ <summary>Full ISO 25010 Quality Model (click to expand)</summary>
420
+
421
+ ### All 8 Quality Characteristics
422
+
423
+ 1. **Functional Suitability**: Completeness, correctness, appropriateness
424
+ 2. **Performance Efficiency**: Time behavior, resource use, capacity
425
+ 3. **Compatibility**: Co-existence, interoperability
426
+ 4. **Usability**: Learnability, operability, accessibility
427
+ 5. **Reliability**: Maturity, availability, fault tolerance
428
+ 6. **Security**: Confidentiality, integrity, authenticity
429
+ 7. **Maintainability**: Modularity, reusability, testability
430
+ 8. **Portability**: Adaptability, installability
431
+
432
+ Use these when assessing beyond the core four.
433
+
434
+ </details>
435
+
436
+ <details>
437
+ <summary>Example: Deep Performance Analysis (click to expand)</summary>
438
+
439
+ ```yaml
440
+ performance_deep_dive:
441
+ response_times:
442
+ p50: 45ms
443
+ p95: 180ms
444
+ p99: 350ms
445
+ database:
446
+ slow_queries: 2
447
+ missing_indexes: ['users.email', 'orders.user_id']
448
+ caching:
449
+ hit_rate: 0%
450
+ recommendation: 'Add Redis for session data'
451
+ load_test:
452
+ max_rps: 150
453
+ breaking_point: 200 rps
454
+ ```
455
+
456
+ </details>
457
+ ==================== END: .bmad-core/tasks/nfr-assess.md ====================
458
+
459
+ ==================== START: .bmad-core/tasks/qa-gate.md ====================
460
+ # qa-gate
461
+
462
+ Create or update a quality gate decision file for a story based on review findings.
463
+
464
+ ## Purpose
465
+
466
+ Generate a standalone quality gate file that provides a clear pass/fail decision with actionable feedback. This gate serves as an advisory checkpoint for teams to understand quality status.
467
+
468
+ ## Prerequisites
469
+
470
+ - Story has been reviewed (manually or via review-story task)
471
+ - Review findings are available
472
+ - Understanding of story requirements and implementation
473
+
474
+ ## Gate File Location
475
+
476
+ **ALWAYS** check the `bmad-core/core-config.yaml` for the `qa.qaLocation/gates`
477
+
478
+ Slug rules:
479
+
480
+ - Convert to lowercase
481
+ - Replace spaces with hyphens
482
+ - Strip punctuation
483
+ - Example: "User Auth - Login!" becomes "user-auth-login"
484
+
485
+ ## Minimal Required Schema
486
+
487
+ ```yaml
488
+ schema: 1
489
+ story: '{epic}.{story}'
490
+ gate: PASS|CONCERNS|FAIL|WAIVED
491
+ status_reason: '1-2 sentence explanation of gate decision'
492
+ reviewer: 'Quinn'
493
+ updated: '{ISO-8601 timestamp}'
494
+ top_issues: [] # Empty array if no issues
495
+ waiver: { active: false } # Only set active: true if WAIVED
496
+ ```
497
+
498
+ ## Schema with Issues
499
+
500
+ ```yaml
501
+ schema: 1
502
+ story: '1.3'
503
+ gate: CONCERNS
504
+ status_reason: 'Missing rate limiting on auth endpoints poses security risk.'
505
+ reviewer: 'Quinn'
506
+ updated: '2025-01-12T10:15:00Z'
507
+ top_issues:
508
+ - id: 'SEC-001'
509
+ severity: high # ONLY: low|medium|high
510
+ finding: 'No rate limiting on login endpoint'
511
+ suggested_action: 'Add rate limiting middleware before production'
512
+ - id: 'TEST-001'
513
+ severity: medium
514
+ finding: 'No integration tests for auth flow'
515
+ suggested_action: 'Add integration test coverage'
516
+ waiver: { active: false }
517
+ ```
518
+
519
+ ## Schema when Waived
520
+
521
+ ```yaml
522
+ schema: 1
523
+ story: '1.3'
524
+ gate: WAIVED
525
+ status_reason: 'Known issues accepted for MVP release.'
526
+ reviewer: 'Quinn'
527
+ updated: '2025-01-12T10:15:00Z'
528
+ top_issues:
529
+ - id: 'PERF-001'
530
+ severity: low
531
+ finding: 'Dashboard loads slowly with 1000+ items'
532
+ suggested_action: 'Implement pagination in next sprint'
533
+ waiver:
534
+ active: true
535
+ reason: 'MVP release - performance optimization deferred'
536
+ approved_by: 'Product Owner'
537
+ ```
538
+
539
+ ## Gate Decision Criteria
540
+
541
+ ### PASS
542
+
543
+ - All acceptance criteria met
544
+ - No high-severity issues
545
+ - Test coverage meets project standards
546
+
547
+ ### CONCERNS
548
+
549
+ - Non-blocking issues present
550
+ - Should be tracked and scheduled
551
+ - Can proceed with awareness
552
+
553
+ ### FAIL
554
+
555
+ - Acceptance criteria not met
556
+ - High-severity issues present
557
+ - Recommend return to InProgress
558
+
559
+ ### WAIVED
560
+
561
+ - Issues explicitly accepted
562
+ - Requires approval and reason
563
+ - Proceed despite known issues
564
+
565
+ ## Severity Scale
566
+
567
+ **FIXED VALUES - NO VARIATIONS:**
568
+
569
+ - `low`: Minor issues, cosmetic problems
570
+ - `medium`: Should fix soon, not blocking
571
+ - `high`: Critical issues, should block release
572
+
573
+ ## Issue ID Prefixes
574
+
575
+ - `SEC-`: Security issues
576
+ - `PERF-`: Performance issues
577
+ - `REL-`: Reliability issues
578
+ - `TEST-`: Testing gaps
579
+ - `MNT-`: Maintainability concerns
580
+ - `ARCH-`: Architecture issues
581
+ - `DOC-`: Documentation gaps
582
+ - `REQ-`: Requirements issues
583
+
584
+ ## Output Requirements
585
+
586
+ 1. **ALWAYS** create gate file at: `qa.qaLocation/gates` from `bmad-core/core-config.yaml`
587
+ 2. **ALWAYS** append this exact format to story's QA Results section:
588
+
589
+ ```text
590
+ Gate: {STATUS} → qa.qaLocation/gates/{epic}.{story}-{slug}.yml
591
+ ```
592
+
593
+ 3. Keep status_reason to 1-2 sentences maximum
594
+ 4. Use severity values exactly: `low`, `medium`, or `high`
595
+
596
+ ## Example Story Update
597
+
598
+ After creating gate file, append to story's QA Results section:
599
+
600
+ ```markdown
601
+ ## QA Results
602
+
603
+ ### Review Date: 2025-01-12
604
+
605
+ ### Reviewed By: Quinn (Test Architect)
606
+
607
+ [... existing review content ...]
608
+
609
+ ### Gate Status
610
+
611
+ Gate: CONCERNS → qa.qaLocation/gates/{epic}.{story}-{slug}.yml
612
+ ```
613
+
614
+ ## Key Principles
615
+
616
+ - Keep it minimal and predictable
617
+ - Fixed severity scale (low/medium/high)
618
+ - Always write to standard path
619
+ - Always update story with gate reference
620
+ - Clear, actionable findings
621
+ ==================== END: .bmad-core/tasks/qa-gate.md ====================
622
+
623
+ ==================== START: .bmad-core/tasks/review-story.md ====================
624
+ # review-story
625
+
626
+ Perform a comprehensive test architecture review with quality gate decision. This adaptive, risk-aware review creates both a story update and a detailed gate file.
627
+
628
+ ## Inputs
629
+
630
+ ```yaml
631
+ required:
632
+ - story_id: '{epic}.{story}' # e.g., "1.3"
633
+ - story_path: '{devStoryLocation}/{epic}.{story}.*.md' # Path from core-config.yaml
634
+ - story_title: '{title}' # If missing, derive from story file H1
635
+ - story_slug: '{slug}' # If missing, derive from title (lowercase, hyphenated)
636
+ ```
637
+
638
+ ## Prerequisites
639
+
640
+ - Story status must be "Review"
641
+ - Developer has completed all tasks and updated the File List
642
+ - All automated tests are passing
643
+
644
+ ## Review Process - Adaptive Test Architecture
645
+
646
+ ### 1. Risk Assessment (Determines Review Depth)
647
+
648
+ **Auto-escalate to deep review when:**
649
+
650
+ - Auth/payment/security files touched
651
+ - No tests added to story
652
+ - Diff > 500 lines
653
+ - Previous gate was FAIL/CONCERNS
654
+ - Story has > 5 acceptance criteria
655
+
656
+ ### 2. Comprehensive Analysis
657
+
658
+ **A. Requirements Traceability**
659
+
660
+ - Map each acceptance criteria to its validating tests (document mapping with Given-When-Then, not test code)
661
+ - Identify coverage gaps
662
+ - Verify all requirements have corresponding test cases
663
+
664
+ **B. Code Quality Review**
665
+
666
+ - Architecture and design patterns
667
+ - Refactoring opportunities (and perform them)
668
+ - Code duplication or inefficiencies
669
+ - Performance optimizations
670
+ - Security vulnerabilities
671
+ - Best practices adherence
672
+
673
+ **C. Test Architecture Assessment**
674
+
675
+ - Test coverage adequacy at appropriate levels
676
+ - Test level appropriateness (what should be unit vs integration vs e2e)
677
+ - Test design quality and maintainability
678
+ - Test data management strategy
679
+ - Mock/stub usage appropriateness
680
+ - Edge case and error scenario coverage
681
+ - Test execution time and reliability
682
+
683
+ **D. Non-Functional Requirements (NFRs)**
684
+
685
+ - Security: Authentication, authorization, data protection
686
+ - Performance: Response times, resource usage
687
+ - Reliability: Error handling, recovery mechanisms
688
+ - Maintainability: Code clarity, documentation
689
+
690
+ **E. Testability Evaluation**
691
+
692
+ - Controllability: Can we control the inputs?
693
+ - Observability: Can we observe the outputs?
694
+ - Debuggability: Can we debug failures easily?
695
+
696
+ **F. Technical Debt Identification**
697
+
698
+ - Accumulated shortcuts
699
+ - Missing tests
700
+ - Outdated dependencies
701
+ - Architecture violations
702
+
703
+ ### 3. Active Refactoring
704
+
705
+ - Refactor code where safe and appropriate
706
+ - Run tests to ensure changes don't break functionality
707
+ - Document all changes in QA Results section with clear WHY and HOW
708
+ - Do NOT alter story content beyond QA Results section
709
+ - Do NOT change story Status or File List; recommend next status only
710
+
711
+ ### 4. Standards Compliance Check
712
+
713
+ - Verify adherence to `docs/coding-standards.md`
714
+ - Check compliance with `docs/unified-project-structure.md`
715
+ - Validate testing approach against `docs/testing-strategy.md`
716
+ - Ensure all guidelines mentioned in the story are followed
717
+
718
+ ### 5. Acceptance Criteria Validation
719
+
720
+ - Verify each AC is fully implemented
721
+ - Check for any missing functionality
722
+ - Validate edge cases are handled
723
+
724
+ ### 6. Documentation and Comments
725
+
726
+ - Verify code is self-documenting where possible
727
+ - Add comments for complex logic if missing
728
+ - Ensure any API changes are documented
729
+
730
+ ## Output 1: Update Story File - QA Results Section ONLY
731
+
732
+ **CRITICAL**: You are ONLY authorized to update the "QA Results" section of the story file. DO NOT modify any other sections.
733
+
734
+ **QA Results Anchor Rule:**
735
+
736
+ - If `## QA Results` doesn't exist, append it at end of file
737
+ - If it exists, append a new dated entry below existing entries
738
+ - Never edit other sections
739
+
740
+ After review and any refactoring, append your results to the story file in the QA Results section:
741
+
742
+ ```markdown
743
+ ## QA Results
744
+
745
+ ### Review Date: [Date]
746
+
747
+ ### Reviewed By: Quinn (Test Architect)
748
+
749
+ ### Code Quality Assessment
750
+
751
+ [Overall assessment of implementation quality]
752
+
753
+ ### Refactoring Performed
754
+
755
+ [List any refactoring you performed with explanations]
756
+
757
+ - **File**: [filename]
758
+ - **Change**: [what was changed]
759
+ - **Why**: [reason for change]
760
+ - **How**: [how it improves the code]
761
+
762
+ ### Compliance Check
763
+
764
+ - Coding Standards: [✓/✗] [notes if any]
765
+ - Project Structure: [✓/✗] [notes if any]
766
+ - Testing Strategy: [✓/✗] [notes if any]
767
+ - All ACs Met: [✓/✗] [notes if any]
768
+
769
+ ### Improvements Checklist
770
+
771
+ [Check off items you handled yourself, leave unchecked for dev to address]
772
+
773
+ - [x] Refactored user service for better error handling (services/user.service.ts)
774
+ - [x] Added missing edge case tests (services/user.service.test.ts)
775
+ - [ ] Consider extracting validation logic to separate validator class
776
+ - [ ] Add integration test for error scenarios
777
+ - [ ] Update API documentation for new error codes
778
+
779
+ ### Security Review
780
+
781
+ [Any security concerns found and whether addressed]
782
+
783
+ ### Performance Considerations
784
+
785
+ [Any performance issues found and whether addressed]
786
+
787
+ ### Files Modified During Review
788
+
789
+ [If you modified files, list them here - ask Dev to update File List]
790
+
791
+ ### Gate Status
792
+
793
+ Gate: {STATUS} → qa.qaLocation/gates/{epic}.{story}-{slug}.yml
794
+ Risk profile: qa.qaLocation/assessments/{epic}.{story}-risk-{YYYYMMDD}.md
795
+ NFR assessment: qa.qaLocation/assessments/{epic}.{story}-nfr-{YYYYMMDD}.md
796
+
797
+ # Note: Paths should reference core-config.yaml for custom configurations
798
+
799
+ ### Recommended Status
800
+
801
+ [✓ Ready for Done] / [✗ Changes Required - See unchecked items above]
802
+ (Story owner decides final status)
803
+ ```
804
+
805
+ ## Output 2: Create Quality Gate File
806
+
807
+ **Template and Directory:**
808
+
809
+ - Render from `../templates/qa-gate-tmpl.yaml`
810
+ - Create directory defined in `qa.qaLocation/gates` (see `bmad-core/core-config.yaml`) if missing
811
+ - Save to: `qa.qaLocation/gates/{epic}.{story}-{slug}.yml`
812
+
813
+ Gate file structure:
814
+
815
+ ```yaml
816
+ schema: 1
817
+ story: '{epic}.{story}'
818
+ story_title: '{story title}'
819
+ gate: PASS|CONCERNS|FAIL|WAIVED
820
+ status_reason: '1-2 sentence explanation of gate decision'
821
+ reviewer: 'Quinn (Test Architect)'
822
+ updated: '{ISO-8601 timestamp}'
823
+
824
+ top_issues: [] # Empty if no issues
825
+ waiver: { active: false } # Set active: true only if WAIVED
826
+
827
+ # Extended fields (optional but recommended):
828
+ quality_score: 0-100 # 100 - (20*FAILs) - (10*CONCERNS) or use technical-preferences.md weights
829
+ expires: '{ISO-8601 timestamp}' # Typically 2 weeks from review
830
+
831
+ evidence:
832
+ tests_reviewed: { count }
833
+ risks_identified: { count }
834
+ trace:
835
+ ac_covered: [1, 2, 3] # AC numbers with test coverage
836
+ ac_gaps: [4] # AC numbers lacking coverage
837
+
838
+ nfr_validation:
839
+ security:
840
+ status: PASS|CONCERNS|FAIL
841
+ notes: 'Specific findings'
842
+ performance:
843
+ status: PASS|CONCERNS|FAIL
844
+ notes: 'Specific findings'
845
+ reliability:
846
+ status: PASS|CONCERNS|FAIL
847
+ notes: 'Specific findings'
848
+ maintainability:
849
+ status: PASS|CONCERNS|FAIL
850
+ notes: 'Specific findings'
851
+
852
+ recommendations:
853
+ immediate: # Must fix before production
854
+ - action: 'Add rate limiting'
855
+ refs: ['api/auth/login.ts']
856
+ future: # Can be addressed later
857
+ - action: 'Consider caching'
858
+ refs: ['services/data.ts']
859
+ ```
860
+
861
+ ### Gate Decision Criteria
862
+
863
+ **Deterministic rule (apply in order):**
864
+
865
+ If risk_summary exists, apply its thresholds first (≥9 → FAIL, ≥6 → CONCERNS), then NFR statuses, then top_issues severity.
866
+
867
+ 1. **Risk thresholds (if risk_summary present):**
868
+ - If any risk score ≥ 9 → Gate = FAIL (unless waived)
869
+ - Else if any score ≥ 6 → Gate = CONCERNS
870
+
871
+ 2. **Test coverage gaps (if trace available):**
872
+ - If any P0 test from test-design is missing → Gate = CONCERNS
873
+ - If security/data-loss P0 test missing → Gate = FAIL
874
+
875
+ 3. **Issue severity:**
876
+ - If any `top_issues.severity == high` → Gate = FAIL (unless waived)
877
+ - Else if any `severity == medium` → Gate = CONCERNS
878
+
879
+ 4. **NFR statuses:**
880
+ - If any NFR status is FAIL → Gate = FAIL
881
+ - Else if any NFR status is CONCERNS → Gate = CONCERNS
882
+ - Else → Gate = PASS
883
+
884
+ - WAIVED only when waiver.active: true with reason/approver
885
+
886
+ Detailed criteria:
887
+
888
+ - **PASS**: All critical requirements met, no blocking issues
889
+ - **CONCERNS**: Non-critical issues found, team should review
890
+ - **FAIL**: Critical issues that should be addressed
891
+ - **WAIVED**: Issues acknowledged but explicitly waived by team
892
+
893
+ ### Quality Score Calculation
894
+
895
+ ```text
896
+ quality_score = 100 - (20 × number of FAILs) - (10 × number of CONCERNS)
897
+ Bounded between 0 and 100
898
+ ```
899
+
900
+ If `technical-preferences.md` defines custom weights, use those instead.
901
+
902
+ ### Suggested Owner Convention
903
+
904
+ For each issue in `top_issues`, include a `suggested_owner`:
905
+
906
+ - `dev`: Code changes needed
907
+ - `sm`: Requirements clarification needed
908
+ - `po`: Business decision needed
909
+
910
+ ## Key Principles
911
+
912
+ - You are a Test Architect providing comprehensive quality assessment
913
+ - You have the authority to improve code directly when appropriate
914
+ - Always explain your changes for learning purposes
915
+ - Balance between perfection and pragmatism
916
+ - Focus on risk-based prioritization
917
+ - Provide actionable recommendations with clear ownership
918
+
919
+ ## Blocking Conditions
920
+
921
+ Stop the review and request clarification if:
922
+
923
+ - Story file is incomplete or missing critical sections
924
+ - File List is empty or clearly incomplete
925
+ - No tests exist when they were required
926
+ - Code changes don't align with story requirements
927
+ - Critical architectural issues that require discussion
928
+
929
+ ## Completion
930
+
931
+ After review:
932
+
933
+ 1. Update the QA Results section in the story file
934
+ 2. Create the gate file in directory from `qa.qaLocation/gates`
935
+ 3. Recommend status: "Ready for Done" or "Changes Required" (owner decides)
936
+ 4. If files were modified, list them in QA Results and ask Dev to update File List
937
+ 5. Always provide constructive feedback and actionable recommendations
938
+ ==================== END: .bmad-core/tasks/review-story.md ====================
939
+
940
+ ==================== START: .bmad-core/tasks/risk-profile.md ====================
941
+ # risk-profile
942
+
943
+ Generate a comprehensive risk assessment matrix for a story implementation using probability × impact analysis.
944
+
945
+ ## Inputs
946
+
947
+ ```yaml
948
+ required:
949
+ - story_id: '{epic}.{story}' # e.g., "1.3"
950
+ - story_path: 'docs/stories/{epic}.{story}.*.md'
951
+ - story_title: '{title}' # If missing, derive from story file H1
952
+ - story_slug: '{slug}' # If missing, derive from title (lowercase, hyphenated)
953
+ ```
954
+
955
+ ## Purpose
956
+
957
+ Identify, assess, and prioritize risks in the story implementation. Provide risk mitigation strategies and testing focus areas based on risk levels.
958
+
959
+ ## Risk Assessment Framework
960
+
961
+ ### Risk Categories
962
+
963
+ **Category Prefixes:**
964
+
965
+ - `TECH`: Technical Risks
966
+ - `SEC`: Security Risks
967
+ - `PERF`: Performance Risks
968
+ - `DATA`: Data Risks
969
+ - `BUS`: Business Risks
970
+ - `OPS`: Operational Risks
971
+
972
+ 1. **Technical Risks (TECH)**
973
+ - Architecture complexity
974
+ - Integration challenges
975
+ - Technical debt
976
+ - Scalability concerns
977
+ - System dependencies
978
+
979
+ 2. **Security Risks (SEC)**
980
+ - Authentication/authorization flaws
981
+ - Data exposure vulnerabilities
982
+ - Injection attacks
983
+ - Session management issues
984
+ - Cryptographic weaknesses
985
+
986
+ 3. **Performance Risks (PERF)**
987
+ - Response time degradation
988
+ - Throughput bottlenecks
989
+ - Resource exhaustion
990
+ - Database query optimization
991
+ - Caching failures
992
+
993
+ 4. **Data Risks (DATA)**
994
+ - Data loss potential
995
+ - Data corruption
996
+ - Privacy violations
997
+ - Compliance issues
998
+ - Backup/recovery gaps
999
+
1000
+ 5. **Business Risks (BUS)**
1001
+ - Feature doesn't meet user needs
1002
+ - Revenue impact
1003
+ - Reputation damage
1004
+ - Regulatory non-compliance
1005
+ - Market timing
1006
+
1007
+ 6. **Operational Risks (OPS)**
1008
+ - Deployment failures
1009
+ - Monitoring gaps
1010
+ - Incident response readiness
1011
+ - Documentation inadequacy
1012
+ - Knowledge transfer issues
1013
+
1014
+ ## Risk Analysis Process
1015
+
1016
+ ### 1. Risk Identification
1017
+
1018
+ For each category, identify specific risks:
1019
+
1020
+ ```yaml
1021
+ risk:
1022
+ id: 'SEC-001' # Use prefixes: SEC, PERF, DATA, BUS, OPS, TECH
1023
+ category: security
1024
+ title: 'Insufficient input validation on user forms'
1025
+ description: 'Form inputs not properly sanitized could lead to XSS attacks'
1026
+ affected_components:
1027
+ - 'UserRegistrationForm'
1028
+ - 'ProfileUpdateForm'
1029
+ detection_method: 'Code review revealed missing validation'
1030
+ ```
1031
+
1032
+ ### 2. Risk Assessment
1033
+
1034
+ Evaluate each risk using probability × impact:
1035
+
1036
+ **Probability Levels:**
1037
+
1038
+ - `High (3)`: Likely to occur (>70% chance)
1039
+ - `Medium (2)`: Possible occurrence (30-70% chance)
1040
+ - `Low (1)`: Unlikely to occur (<30% chance)
1041
+
1042
+ **Impact Levels:**
1043
+
1044
+ - `High (3)`: Severe consequences (data breach, system down, major financial loss)
1045
+ - `Medium (2)`: Moderate consequences (degraded performance, minor data issues)
1046
+ - `Low (1)`: Minor consequences (cosmetic issues, slight inconvenience)
1047
+
1048
+ ### Risk Score = Probability × Impact
1049
+
1050
+ - 9: Critical Risk (Red)
1051
+ - 6: High Risk (Orange)
1052
+ - 4: Medium Risk (Yellow)
1053
+ - 2-3: Low Risk (Green)
1054
+ - 1: Minimal Risk (Blue)
1055
+
1056
+ ### 3. Risk Prioritization
1057
+
1058
+ Create risk matrix:
1059
+
1060
+ ```markdown
1061
+ ## Risk Matrix
1062
+
1063
+ | Risk ID | Description | Probability | Impact | Score | Priority |
1064
+ | -------- | ----------------------- | ----------- | ---------- | ----- | -------- |
1065
+ | SEC-001 | XSS vulnerability | High (3) | High (3) | 9 | Critical |
1066
+ | PERF-001 | Slow query on dashboard | Medium (2) | Medium (2) | 4 | Medium |
1067
+ | DATA-001 | Backup failure | Low (1) | High (3) | 3 | Low |
1068
+ ```
1069
+
1070
+ ### 4. Risk Mitigation Strategies
1071
+
1072
+ For each identified risk, provide mitigation:
1073
+
1074
+ ```yaml
1075
+ mitigation:
1076
+ risk_id: 'SEC-001'
1077
+ strategy: 'preventive' # preventive|detective|corrective
1078
+ actions:
1079
+ - 'Implement input validation library (e.g., validator.js)'
1080
+ - 'Add CSP headers to prevent XSS execution'
1081
+ - 'Sanitize all user inputs before storage'
1082
+ - 'Escape all outputs in templates'
1083
+ testing_requirements:
1084
+ - 'Security testing with OWASP ZAP'
1085
+ - 'Manual penetration testing of forms'
1086
+ - 'Unit tests for validation functions'
1087
+ residual_risk: 'Low - Some zero-day vulnerabilities may remain'
1088
+ owner: 'dev'
1089
+ timeline: 'Before deployment'
1090
+ ```
1091
+
1092
+ ## Outputs
1093
+
1094
+ ### Output 1: Gate YAML Block
1095
+
1096
+ Generate for pasting into gate file under `risk_summary`:
1097
+
1098
+ **Output rules:**
1099
+
1100
+ - Only include assessed risks; do not emit placeholders
1101
+ - Sort risks by score (desc) when emitting highest and any tabular lists
1102
+ - If no risks: totals all zeros, omit highest, keep recommendations arrays empty
1103
+
1104
+ ```yaml
1105
+ # risk_summary (paste into gate file):
1106
+ risk_summary:
1107
+ totals:
1108
+ critical: X # score 9
1109
+ high: Y # score 6
1110
+ medium: Z # score 4
1111
+ low: W # score 2-3
1112
+ highest:
1113
+ id: SEC-001
1114
+ score: 9
1115
+ title: 'XSS on profile form'
1116
+ recommendations:
1117
+ must_fix:
1118
+ - 'Add input sanitization & CSP'
1119
+ monitor:
1120
+ - 'Add security alerts for auth endpoints'
1121
+ ```
1122
+
1123
+ ### Output 2: Markdown Report
1124
+
1125
+ **Save to:** `qa.qaLocation/assessments/{epic}.{story}-risk-{YYYYMMDD}.md`
1126
+
1127
+ ```markdown
1128
+ # Risk Profile: Story {epic}.{story}
1129
+
1130
+ Date: {date}
1131
+ Reviewer: Quinn (Test Architect)
1132
+
1133
+ ## Executive Summary
1134
+
1135
+ - Total Risks Identified: X
1136
+ - Critical Risks: Y
1137
+ - High Risks: Z
1138
+ - Risk Score: XX/100 (calculated)
1139
+
1140
+ ## Critical Risks Requiring Immediate Attention
1141
+
1142
+ ### 1. [ID]: Risk Title
1143
+
1144
+ **Score: 9 (Critical)**
1145
+ **Probability**: High - Detailed reasoning
1146
+ **Impact**: High - Potential consequences
1147
+ **Mitigation**:
1148
+
1149
+ - Immediate action required
1150
+ - Specific steps to take
1151
+ **Testing Focus**: Specific test scenarios needed
1152
+
1153
+ ## Risk Distribution
1154
+
1155
+ ### By Category
1156
+
1157
+ - Security: X risks (Y critical)
1158
+ - Performance: X risks (Y critical)
1159
+ - Data: X risks (Y critical)
1160
+ - Business: X risks (Y critical)
1161
+ - Operational: X risks (Y critical)
1162
+
1163
+ ### By Component
1164
+
1165
+ - Frontend: X risks
1166
+ - Backend: X risks
1167
+ - Database: X risks
1168
+ - Infrastructure: X risks
1169
+
1170
+ ## Detailed Risk Register
1171
+
1172
+ [Full table of all risks with scores and mitigations]
1173
+
1174
+ ## Risk-Based Testing Strategy
1175
+
1176
+ ### Priority 1: Critical Risk Tests
1177
+
1178
+ - Test scenarios for critical risks
1179
+ - Required test types (security, load, chaos)
1180
+ - Test data requirements
1181
+
1182
+ ### Priority 2: High Risk Tests
1183
+
1184
+ - Integration test scenarios
1185
+ - Edge case coverage
1186
+
1187
+ ### Priority 3: Medium/Low Risk Tests
1188
+
1189
+ - Standard functional tests
1190
+ - Regression test suite
1191
+
1192
+ ## Risk Acceptance Criteria
1193
+
1194
+ ### Must Fix Before Production
1195
+
1196
+ - All critical risks (score 9)
1197
+ - High risks affecting security/data
1198
+
1199
+ ### Can Deploy with Mitigation
1200
+
1201
+ - Medium risks with compensating controls
1202
+ - Low risks with monitoring in place
1203
+
1204
+ ### Accepted Risks
1205
+
1206
+ - Document any risks team accepts
1207
+ - Include sign-off from appropriate authority
1208
+
1209
+ ## Monitoring Requirements
1210
+
1211
+ Post-deployment monitoring for:
1212
+
1213
+ - Performance metrics for PERF risks
1214
+ - Security alerts for SEC risks
1215
+ - Error rates for operational risks
1216
+ - Business KPIs for business risks
1217
+
1218
+ ## Risk Review Triggers
1219
+
1220
+ Review and update risk profile when:
1221
+
1222
+ - Architecture changes significantly
1223
+ - New integrations added
1224
+ - Security vulnerabilities discovered
1225
+ - Performance issues reported
1226
+ - Regulatory requirements change
1227
+ ```
93
1228
 
94
- ==================== START: .bmad-core/tasks/review-story.md ====================
95
- # review-story
1229
+ ## Risk Scoring Algorithm
1230
+
1231
+ Calculate overall story risk score:
1232
+
1233
+ ```text
1234
+ Base Score = 100
1235
+ For each risk:
1236
+ - Critical (9): Deduct 20 points
1237
+ - High (6): Deduct 10 points
1238
+ - Medium (4): Deduct 5 points
1239
+ - Low (2-3): Deduct 2 points
1240
+
1241
+ Minimum score = 0 (extremely risky)
1242
+ Maximum score = 100 (minimal risk)
1243
+ ```
1244
+
1245
+ ## Risk-Based Recommendations
1246
+
1247
+ Based on risk profile, recommend:
1248
+
1249
+ 1. **Testing Priority**
1250
+ - Which tests to run first
1251
+ - Additional test types needed
1252
+ - Test environment requirements
1253
+
1254
+ 2. **Development Focus**
1255
+ - Code review emphasis areas
1256
+ - Additional validation needed
1257
+ - Security controls to implement
1258
+
1259
+ 3. **Deployment Strategy**
1260
+ - Phased rollout for high-risk changes
1261
+ - Feature flags for risky features
1262
+ - Rollback procedures
1263
+
1264
+ 4. **Monitoring Setup**
1265
+ - Metrics to track
1266
+ - Alerts to configure
1267
+ - Dashboard requirements
1268
+
1269
+ ## Integration with Quality Gates
1270
+
1271
+ **Deterministic gate mapping:**
1272
+
1273
+ - Any risk with score ≥ 9 → Gate = FAIL (unless waived)
1274
+ - Else if any score ≥ 6 → Gate = CONCERNS
1275
+ - Else → Gate = PASS
1276
+ - Unmitigated risks → Document in gate
1277
+
1278
+ ### Output 3: Story Hook Line
1279
+
1280
+ **Print this line for review task to quote:**
1281
+
1282
+ ```text
1283
+ Risk profile: qa.qaLocation/assessments/{epic}.{story}-risk-{YYYYMMDD}.md
1284
+ ```
1285
+
1286
+ ## Key Principles
1287
+
1288
+ - Identify risks early and systematically
1289
+ - Use consistent probability × impact scoring
1290
+ - Provide actionable mitigation strategies
1291
+ - Link risks to specific test requirements
1292
+ - Track residual risk after mitigation
1293
+ - Update risk profile as story evolves
1294
+ ==================== END: .bmad-core/tasks/risk-profile.md ====================
1295
+
1296
+ ==================== START: .bmad-core/tasks/test-design.md ====================
1297
+ # test-design
1298
+
1299
+ Create comprehensive test scenarios with appropriate test level recommendations for story implementation.
1300
+
1301
+ ## Inputs
1302
+
1303
+ ```yaml
1304
+ required:
1305
+ - story_id: '{epic}.{story}' # e.g., "1.3"
1306
+ - story_path: '{devStoryLocation}/{epic}.{story}.*.md' # Path from core-config.yaml
1307
+ - story_title: '{title}' # If missing, derive from story file H1
1308
+ - story_slug: '{slug}' # If missing, derive from title (lowercase, hyphenated)
1309
+ ```
1310
+
1311
+ ## Purpose
96
1312
 
97
- When a developer agent marks a story as "Ready for Review", perform a comprehensive senior developer code review with the ability to refactor and improve code directly.
1313
+ Design a complete test strategy that identifies what to test, at which level (unit/integration/e2e), and why. This ensures efficient test coverage without redundancy while maintaining appropriate test boundaries.
1314
+
1315
+ ## Dependencies
1316
+
1317
+ ```yaml
1318
+ data:
1319
+ - test-levels-framework.md # Unit/Integration/E2E decision criteria
1320
+ - test-priorities-matrix.md # P0/P1/P2/P3 classification system
1321
+ ```
1322
+
1323
+ ## Process
1324
+
1325
+ ### 1. Analyze Story Requirements
1326
+
1327
+ Break down each acceptance criterion into testable scenarios. For each AC:
1328
+
1329
+ - Identify the core functionality to test
1330
+ - Determine data variations needed
1331
+ - Consider error conditions
1332
+ - Note edge cases
1333
+
1334
+ ### 2. Apply Test Level Framework
1335
+
1336
+ **Reference:** Load `test-levels-framework.md` for detailed criteria
1337
+
1338
+ Quick rules:
1339
+
1340
+ - **Unit**: Pure logic, algorithms, calculations
1341
+ - **Integration**: Component interactions, DB operations
1342
+ - **E2E**: Critical user journeys, compliance
1343
+
1344
+ ### 3. Assign Priorities
1345
+
1346
+ **Reference:** Load `test-priorities-matrix.md` for classification
1347
+
1348
+ Quick priority assignment:
1349
+
1350
+ - **P0**: Revenue-critical, security, compliance
1351
+ - **P1**: Core user journeys, frequently used
1352
+ - **P2**: Secondary features, admin functions
1353
+ - **P3**: Nice-to-have, rarely used
1354
+
1355
+ ### 4. Design Test Scenarios
1356
+
1357
+ For each identified test need, create:
1358
+
1359
+ ```yaml
1360
+ test_scenario:
1361
+ id: '{epic}.{story}-{LEVEL}-{SEQ}'
1362
+ requirement: 'AC reference'
1363
+ priority: P0|P1|P2|P3
1364
+ level: unit|integration|e2e
1365
+ description: 'What is being tested'
1366
+ justification: 'Why this level was chosen'
1367
+ mitigates_risks: ['RISK-001'] # If risk profile exists
1368
+ ```
1369
+
1370
+ ### 5. Validate Coverage
1371
+
1372
+ Ensure:
1373
+
1374
+ - Every AC has at least one test
1375
+ - No duplicate coverage across levels
1376
+ - Critical paths have multiple levels
1377
+ - Risk mitigations are addressed
1378
+
1379
+ ## Outputs
1380
+
1381
+ ### Output 1: Test Design Document
1382
+
1383
+ **Save to:** `qa.qaLocation/assessments/{epic}.{story}-test-design-{YYYYMMDD}.md`
1384
+
1385
+ ```markdown
1386
+ # Test Design: Story {epic}.{story}
1387
+
1388
+ Date: {date}
1389
+ Designer: Quinn (Test Architect)
1390
+
1391
+ ## Test Strategy Overview
1392
+
1393
+ - Total test scenarios: X
1394
+ - Unit tests: Y (A%)
1395
+ - Integration tests: Z (B%)
1396
+ - E2E tests: W (C%)
1397
+ - Priority distribution: P0: X, P1: Y, P2: Z
1398
+
1399
+ ## Test Scenarios by Acceptance Criteria
1400
+
1401
+ ### AC1: {description}
1402
+
1403
+ #### Scenarios
1404
+
1405
+ | ID | Level | Priority | Test | Justification |
1406
+ | ------------ | ----------- | -------- | ------------------------- | ------------------------ |
1407
+ | 1.3-UNIT-001 | Unit | P0 | Validate input format | Pure validation logic |
1408
+ | 1.3-INT-001 | Integration | P0 | Service processes request | Multi-component flow |
1409
+ | 1.3-E2E-001 | E2E | P1 | User completes journey | Critical path validation |
1410
+
1411
+ [Continue for all ACs...]
1412
+
1413
+ ## Risk Coverage
1414
+
1415
+ [Map test scenarios to identified risks if risk profile exists]
1416
+
1417
+ ## Recommended Execution Order
1418
+
1419
+ 1. P0 Unit tests (fail fast)
1420
+ 2. P0 Integration tests
1421
+ 3. P0 E2E tests
1422
+ 4. P1 tests in order
1423
+ 5. P2+ as time permits
1424
+ ```
1425
+
1426
+ ### Output 2: Gate YAML Block
1427
+
1428
+ Generate for inclusion in quality gate:
1429
+
1430
+ ```yaml
1431
+ test_design:
1432
+ scenarios_total: X
1433
+ by_level:
1434
+ unit: Y
1435
+ integration: Z
1436
+ e2e: W
1437
+ by_priority:
1438
+ p0: A
1439
+ p1: B
1440
+ p2: C
1441
+ coverage_gaps: [] # List any ACs without tests
1442
+ ```
1443
+
1444
+ ### Output 3: Trace References
1445
+
1446
+ Print for use by trace-requirements task:
1447
+
1448
+ ```text
1449
+ Test design matrix: qa.qaLocation/assessments/{epic}.{story}-test-design-{YYYYMMDD}.md
1450
+ P0 tests identified: {count}
1451
+ ```
1452
+
1453
+ ## Quality Checklist
1454
+
1455
+ Before finalizing, verify:
1456
+
1457
+ - [ ] Every AC has test coverage
1458
+ - [ ] Test levels are appropriate (not over-testing)
1459
+ - [ ] No duplicate coverage across levels
1460
+ - [ ] Priorities align with business risk
1461
+ - [ ] Test IDs follow naming convention
1462
+ - [ ] Scenarios are atomic and independent
1463
+
1464
+ ## Key Principles
1465
+
1466
+ - **Shift left**: Prefer unit over integration, integration over E2E
1467
+ - **Risk-based**: Focus on what could go wrong
1468
+ - **Efficient coverage**: Test once at the right level
1469
+ - **Maintainability**: Consider long-term test maintenance
1470
+ - **Fast feedback**: Quick tests run first
1471
+ ==================== END: .bmad-core/tasks/test-design.md ====================
1472
+
1473
+ ==================== START: .bmad-core/tasks/trace-requirements.md ====================
1474
+ # trace-requirements
1475
+
1476
+ Map story requirements to test cases using Given-When-Then patterns for comprehensive traceability.
1477
+
1478
+ ## Purpose
1479
+
1480
+ Create a requirements traceability matrix that ensures every acceptance criterion has corresponding test coverage. This task helps identify gaps in testing and ensures all requirements are validated.
1481
+
1482
+ **IMPORTANT**: Given-When-Then is used here for documenting the mapping between requirements and tests, NOT for writing the actual test code. Tests should follow your project's testing standards (no BDD syntax in test code).
98
1483
 
99
1484
  ## Prerequisites
100
1485
 
101
- - Story status must be "Review"
102
- - Developer has completed all tasks and updated the File List
103
- - All automated tests are passing
1486
+ - Story file with clear acceptance criteria
1487
+ - Access to test files or test specifications
1488
+ - Understanding of the implementation
104
1489
 
105
- ## Review Process
106
-
107
- 1. **Read the Complete Story**
108
- - Review all acceptance criteria
109
- - Understand the dev notes and requirements
110
- - Note any completion notes from the developer
111
-
112
- 2. **Verify Implementation Against Dev Notes Guidance**
113
- - Review the "Dev Notes" section for specific technical guidance provided to the developer
114
- - Verify the developer's implementation follows the architectural patterns specified in Dev Notes
115
- - Check that file locations match the project structure guidance in Dev Notes
116
- - Confirm any specified libraries, frameworks, or technical approaches were used correctly
117
- - Validate that security considerations mentioned in Dev Notes were implemented
118
-
119
- 3. **Focus on the File List**
120
- - Verify all files listed were actually created/modified
121
- - Check for any missing files that should have been updated
122
- - Ensure file locations align with the project structure guidance from Dev Notes
123
-
124
- 4. **Senior Developer Code Review**
125
- - Review code with the eye of a senior developer
126
- - If changes form a cohesive whole, review them together
127
- - If changes are independent, review incrementally file by file
128
- - Focus on:
129
- - Code architecture and design patterns
130
- - Refactoring opportunities
131
- - Code duplication or inefficiencies
132
- - Performance optimizations
133
- - Security concerns
134
- - Best practices and patterns
135
-
136
- 5. **Active Refactoring**
137
- - As a senior developer, you CAN and SHOULD refactor code where improvements are needed
138
- - When refactoring:
139
- - Make the changes directly in the files
140
- - Explain WHY you're making the change
141
- - Describe HOW the change improves the code
142
- - Ensure all tests still pass after refactoring
143
- - Update the File List if you modify additional files
144
-
145
- 6. **Standards Compliance Check**
146
- - Verify adherence to `docs/coding-standards.md`
147
- - Check compliance with `docs/unified-project-structure.md`
148
- - Validate testing approach against `docs/testing-strategy.md`
149
- - Ensure all guidelines mentioned in the story are followed
150
-
151
- 7. **Acceptance Criteria Validation**
152
- - Verify each AC is fully implemented
153
- - Check for any missing functionality
154
- - Validate edge cases are handled
155
-
156
- 8. **Test Coverage Review**
157
- - Ensure unit tests cover edge cases
158
- - Add missing tests if critical coverage is lacking
159
- - Verify integration tests (if required) are comprehensive
160
- - Check that test assertions are meaningful
161
- - Look for missing test scenarios
162
-
163
- 9. **Documentation and Comments**
164
- - Verify code is self-documenting where possible
165
- - Add comments for complex logic if missing
166
- - Ensure any API changes are documented
167
-
168
- ## Update Story File - QA Results Section ONLY
1490
+ ## Traceability Process
169
1491
 
170
- **CRITICAL**: You are ONLY authorized to update the "QA Results" section of the story file. DO NOT modify any other sections.
1492
+ ### 1. Extract Requirements
171
1493
 
172
- After review and any refactoring, append your results to the story file in the QA Results section:
1494
+ Identify all testable requirements from:
1495
+
1496
+ - Acceptance Criteria (primary source)
1497
+ - User story statement
1498
+ - Tasks/subtasks with specific behaviors
1499
+ - Non-functional requirements mentioned
1500
+ - Edge cases documented
1501
+
1502
+ ### 2. Map to Test Cases
1503
+
1504
+ For each requirement, document which tests validate it. Use Given-When-Then to describe what the test validates (not how it's written):
1505
+
1506
+ ```yaml
1507
+ requirement: 'AC1: User can login with valid credentials'
1508
+ test_mappings:
1509
+ - test_file: 'auth/login.test.ts'
1510
+ test_case: 'should successfully login with valid email and password'
1511
+ # Given-When-Then describes WHAT the test validates, not HOW it's coded
1512
+ given: 'A registered user with valid credentials'
1513
+ when: 'They submit the login form'
1514
+ then: 'They are redirected to dashboard and session is created'
1515
+ coverage: full
1516
+
1517
+ - test_file: 'e2e/auth-flow.test.ts'
1518
+ test_case: 'complete login flow'
1519
+ given: 'User on login page'
1520
+ when: 'Entering valid credentials and submitting'
1521
+ then: 'Dashboard loads with user data'
1522
+ coverage: integration
1523
+ ```
1524
+
1525
+ ### 3. Coverage Analysis
1526
+
1527
+ Evaluate coverage for each requirement:
1528
+
1529
+ **Coverage Levels:**
1530
+
1531
+ - `full`: Requirement completely tested
1532
+ - `partial`: Some aspects tested, gaps exist
1533
+ - `none`: No test coverage found
1534
+ - `integration`: Covered in integration/e2e tests only
1535
+ - `unit`: Covered in unit tests only
1536
+
1537
+ ### 4. Gap Identification
1538
+
1539
+ Document any gaps found:
1540
+
1541
+ ```yaml
1542
+ coverage_gaps:
1543
+ - requirement: 'AC3: Password reset email sent within 60 seconds'
1544
+ gap: 'No test for email delivery timing'
1545
+ severity: medium
1546
+ suggested_test:
1547
+ type: integration
1548
+ description: 'Test email service SLA compliance'
1549
+
1550
+ - requirement: 'AC5: Support 1000 concurrent users'
1551
+ gap: 'No load testing implemented'
1552
+ severity: high
1553
+ suggested_test:
1554
+ type: performance
1555
+ description: 'Load test with 1000 concurrent connections'
1556
+ ```
1557
+
1558
+ ## Outputs
1559
+
1560
+ ### Output 1: Gate YAML Block
1561
+
1562
+ **Generate for pasting into gate file under `trace`:**
1563
+
1564
+ ```yaml
1565
+ trace:
1566
+ totals:
1567
+ requirements: X
1568
+ full: Y
1569
+ partial: Z
1570
+ none: W
1571
+ planning_ref: 'qa.qaLocation/assessments/{epic}.{story}-test-design-{YYYYMMDD}.md'
1572
+ uncovered:
1573
+ - ac: 'AC3'
1574
+ reason: 'No test found for password reset timing'
1575
+ notes: 'See qa.qaLocation/assessments/{epic}.{story}-trace-{YYYYMMDD}.md'
1576
+ ```
1577
+
1578
+ ### Output 2: Traceability Report
1579
+
1580
+ **Save to:** `qa.qaLocation/assessments/{epic}.{story}-trace-{YYYYMMDD}.md`
1581
+
1582
+ Create a traceability report with:
173
1583
 
174
1584
  ```markdown
175
- ## QA Results
1585
+ # Requirements Traceability Matrix
176
1586
 
177
- ### Review Date: [Date]
178
- ### Reviewed By: Quinn (Senior Developer QA)
1587
+ ## Story: {epic}.{story} - {title}
179
1588
 
180
- ### Code Quality Assessment
181
- [Overall assessment of implementation quality]
1589
+ ### Coverage Summary
182
1590
 
183
- ### Refactoring Performed
184
- [List any refactoring you performed with explanations]
185
- - **File**: [filename]
186
- - **Change**: [what was changed]
187
- - **Why**: [reason for change]
188
- - **How**: [how it improves the code]
1591
+ - Total Requirements: X
1592
+ - Fully Covered: Y (Z%)
1593
+ - Partially Covered: A (B%)
1594
+ - Not Covered: C (D%)
189
1595
 
190
- ### Compliance Check
191
- - Coding Standards: [✓/✗] [notes if any]
192
- - Project Structure: [✓/✗] [notes if any]
193
- - Testing Strategy: [✓/✗] [notes if any]
194
- - All ACs Met: [✓/✗] [notes if any]
1596
+ ### Requirement Mappings
195
1597
 
196
- ### Improvements Checklist
197
- [Check off items you handled yourself, leave unchecked for dev to address]
1598
+ #### AC1: {Acceptance Criterion 1}
198
1599
 
199
- - [x] Refactored user service for better error handling (services/user.service.ts)
200
- - [x] Added missing edge case tests (services/user.service.test.ts)
201
- - [ ] Consider extracting validation logic to separate validator class
202
- - [ ] Add integration test for error scenarios
203
- - [ ] Update API documentation for new error codes
1600
+ **Coverage: FULL**
204
1601
 
205
- ### Security Review
206
- [Any security concerns found and whether addressed]
1602
+ Given-When-Then Mappings:
207
1603
 
208
- ### Performance Considerations
209
- [Any performance issues found and whether addressed]
1604
+ - **Unit Test**: `auth.service.test.ts::validateCredentials`
1605
+ - Given: Valid user credentials
1606
+ - When: Validation method called
1607
+ - Then: Returns true with user object
1608
+
1609
+ - **Integration Test**: `auth.integration.test.ts::loginFlow`
1610
+ - Given: User with valid account
1611
+ - When: Login API called
1612
+ - Then: JWT token returned and session created
1613
+
1614
+ #### AC2: {Acceptance Criterion 2}
1615
+
1616
+ **Coverage: PARTIAL**
1617
+
1618
+ [Continue for all ACs...]
1619
+
1620
+ ### Critical Gaps
1621
+
1622
+ 1. **Performance Requirements**
1623
+ - Gap: No load testing for concurrent users
1624
+ - Risk: High - Could fail under production load
1625
+ - Action: Implement load tests using k6 or similar
1626
+
1627
+ 2. **Security Requirements**
1628
+ - Gap: Rate limiting not tested
1629
+ - Risk: Medium - Potential DoS vulnerability
1630
+ - Action: Add rate limit tests to integration suite
1631
+
1632
+ ### Test Design Recommendations
1633
+
1634
+ Based on gaps identified, recommend:
210
1635
 
211
- ### Final Status
212
- [✓ Approved - Ready for Done] / [✗ Changes Required - See unchecked items above]
1636
+ 1. Additional test scenarios needed
1637
+ 2. Test types to implement (unit/integration/e2e/performance)
1638
+ 3. Test data requirements
1639
+ 4. Mock/stub strategies
1640
+
1641
+ ### Risk Assessment
1642
+
1643
+ - **High Risk**: Requirements with no coverage
1644
+ - **Medium Risk**: Requirements with only partial coverage
1645
+ - **Low Risk**: Requirements with full unit + integration coverage
1646
+ ```
1647
+
1648
+ ## Traceability Best Practices
1649
+
1650
+ ### Given-When-Then for Mapping (Not Test Code)
1651
+
1652
+ Use Given-When-Then to document what each test validates:
1653
+
1654
+ **Given**: The initial context the test sets up
1655
+
1656
+ - What state/data the test prepares
1657
+ - User context being simulated
1658
+ - System preconditions
1659
+
1660
+ **When**: The action the test performs
1661
+
1662
+ - What the test executes
1663
+ - API calls or user actions tested
1664
+ - Events triggered
1665
+
1666
+ **Then**: What the test asserts
1667
+
1668
+ - Expected outcomes verified
1669
+ - State changes checked
1670
+ - Values validated
1671
+
1672
+ **Note**: This is for documentation only. Actual test code follows your project's standards (e.g., describe/it blocks, no BDD syntax).
1673
+
1674
+ ### Coverage Priority
1675
+
1676
+ Prioritize coverage based on:
1677
+
1678
+ 1. Critical business flows
1679
+ 2. Security-related requirements
1680
+ 3. Data integrity requirements
1681
+ 4. User-facing features
1682
+ 5. Performance SLAs
1683
+
1684
+ ### Test Granularity
1685
+
1686
+ Map at appropriate levels:
1687
+
1688
+ - Unit tests for business logic
1689
+ - Integration tests for component interaction
1690
+ - E2E tests for user journeys
1691
+ - Performance tests for NFRs
1692
+
1693
+ ## Quality Indicators
1694
+
1695
+ Good traceability shows:
1696
+
1697
+ - Every AC has at least one test
1698
+ - Critical paths have multiple test levels
1699
+ - Edge cases are explicitly covered
1700
+ - NFRs have appropriate test types
1701
+ - Clear Given-When-Then for each test
1702
+
1703
+ ## Red Flags
1704
+
1705
+ Watch for:
1706
+
1707
+ - ACs with no test coverage
1708
+ - Tests that don't map to requirements
1709
+ - Vague test descriptions
1710
+ - Missing edge case coverage
1711
+ - NFRs without specific tests
1712
+
1713
+ ## Integration with Gates
1714
+
1715
+ This traceability feeds into quality gates:
1716
+
1717
+ - Critical gaps → FAIL
1718
+ - Minor gaps → CONCERNS
1719
+ - Missing P0 tests from test-design → CONCERNS
1720
+
1721
+ ### Output 3: Story Hook Line
1722
+
1723
+ **Print this line for review task to quote:**
1724
+
1725
+ ```text
1726
+ Trace matrix: qa.qaLocation/assessments/{epic}.{story}-trace-{YYYYMMDD}.md
213
1727
  ```
214
1728
 
1729
+ - Full coverage → PASS contribution
1730
+
215
1731
  ## Key Principles
216
1732
 
217
- - You are a SENIOR developer reviewing junior/mid-level work
218
- - You have the authority and responsibility to improve code directly
219
- - Always explain your changes for learning purposes
220
- - Balance between perfection and pragmatism
221
- - Focus on significant improvements, not nitpicks
1733
+ - Every requirement must be testable
1734
+ - Use Given-When-Then for clarity
1735
+ - Identify both presence and absence
1736
+ - Prioritize based on risk
1737
+ - Make recommendations actionable
1738
+ ==================== END: .bmad-core/tasks/trace-requirements.md ====================
222
1739
 
223
- ## Blocking Conditions
1740
+ ==================== START: .bmad-core/templates/qa-gate-tmpl.yaml ====================
1741
+ template:
1742
+ id: qa-gate-template-v1
1743
+ name: Quality Gate Decision
1744
+ version: 1.0
1745
+ output:
1746
+ format: yaml
1747
+ filename: qa.qaLocation/gates/{{epic_num}}.{{story_num}}-{{story_slug}}.yml
1748
+ title: "Quality Gate: {{epic_num}}.{{story_num}}"
224
1749
 
225
- Stop the review and request clarification if:
1750
+ # Required fields (keep these first)
1751
+ schema: 1
1752
+ story: "{{epic_num}}.{{story_num}}"
1753
+ story_title: "{{story_title}}"
1754
+ gate: "{{gate_status}}" # PASS|CONCERNS|FAIL|WAIVED
1755
+ status_reason: "{{status_reason}}" # 1-2 sentence summary of why this gate decision
1756
+ reviewer: "Quinn (Test Architect)"
1757
+ updated: "{{iso_timestamp}}"
226
1758
 
227
- - Story file is incomplete or missing critical sections
228
- - File List is empty or clearly incomplete
229
- - No tests exist when they were required
230
- - Code changes don't align with story requirements
231
- - Critical architectural issues that require discussion
1759
+ # Always present but only active when WAIVED
1760
+ waiver: { active: false }
232
1761
 
233
- ## Completion
1762
+ # Issues (if any) - Use fixed severity: low | medium | high
1763
+ top_issues: []
234
1764
 
235
- After review:
1765
+ # Risk summary (from risk-profile task if run)
1766
+ risk_summary:
1767
+ totals: { critical: 0, high: 0, medium: 0, low: 0 }
1768
+ recommendations:
1769
+ must_fix: []
1770
+ monitor: []
236
1771
 
237
- 1. If all items are checked and approved: Update story status to "Done"
238
- 2. If unchecked items remain: Keep status as "Review" for dev to address
239
- 3. Always provide constructive feedback and explanations for learning
240
- ==================== END: .bmad-core/tasks/review-story.md ====================
1772
+ # Examples section using block scalars for clarity
1773
+ examples:
1774
+ with_issues: |
1775
+ top_issues:
1776
+ - id: "SEC-001"
1777
+ severity: high # ONLY: low|medium|high
1778
+ finding: "No rate limiting on login endpoint"
1779
+ suggested_action: "Add rate limiting middleware before production"
1780
+ - id: "TEST-001"
1781
+ severity: medium
1782
+ finding: "Missing integration tests for auth flow"
1783
+ suggested_action: "Add test coverage for critical paths"
1784
+
1785
+ when_waived: |
1786
+ waiver:
1787
+ active: true
1788
+ reason: "Accepted for MVP release - will address in next sprint"
1789
+ approved_by: "Product Owner"
1790
+
1791
+ # ============ Optional Extended Fields ============
1792
+ # Uncomment and use if your team wants more detail
1793
+
1794
+ optional_fields_examples:
1795
+ quality_and_expiry: |
1796
+ quality_score: 75 # 0-100 (optional scoring)
1797
+ expires: "2025-01-26T00:00:00Z" # Optional gate freshness window
1798
+
1799
+ evidence: |
1800
+ evidence:
1801
+ tests_reviewed: 15
1802
+ risks_identified: 3
1803
+ trace:
1804
+ ac_covered: [1, 2, 3] # AC numbers with test coverage
1805
+ ac_gaps: [4] # AC numbers lacking coverage
1806
+
1807
+ nfr_validation: |
1808
+ nfr_validation:
1809
+ security: { status: CONCERNS, notes: "Rate limiting missing" }
1810
+ performance: { status: PASS, notes: "" }
1811
+ reliability: { status: PASS, notes: "" }
1812
+ maintainability: { status: PASS, notes: "" }
1813
+
1814
+ history: |
1815
+ history: # Append-only audit trail
1816
+ - at: "2025-01-12T10:00:00Z"
1817
+ gate: FAIL
1818
+ note: "Initial review - missing tests"
1819
+ - at: "2025-01-12T15:00:00Z"
1820
+ gate: CONCERNS
1821
+ note: "Tests added but rate limiting still missing"
1822
+
1823
+ risk_summary: |
1824
+ risk_summary: # From risk-profile task
1825
+ totals:
1826
+ critical: 0
1827
+ high: 0
1828
+ medium: 0
1829
+ low: 0
1830
+ # 'highest' is emitted only when risks exist
1831
+ recommendations:
1832
+ must_fix: []
1833
+ monitor: []
1834
+
1835
+ recommendations: |
1836
+ recommendations:
1837
+ immediate: # Must fix before production
1838
+ - action: "Add rate limiting to auth endpoints"
1839
+ refs: ["api/auth/login.ts:42-68"]
1840
+ future: # Can be addressed later
1841
+ - action: "Consider caching for better performance"
1842
+ refs: ["services/data.service.ts"]
1843
+ ==================== END: .bmad-core/templates/qa-gate-tmpl.yaml ====================
241
1844
 
242
1845
  ==================== START: .bmad-core/templates/story-tmpl.yaml ====================
243
1846
  template:
@@ -254,7 +1857,7 @@ workflow:
254
1857
  elicitation: advanced-elicitation
255
1858
 
256
1859
  agent_config:
257
- editable_sections:
1860
+ editable_sections:
258
1861
  - Status
259
1862
  - Story
260
1863
  - Acceptance Criteria
@@ -271,7 +1874,7 @@ sections:
271
1874
  instruction: Select the current status of the story
272
1875
  owner: scrum-master
273
1876
  editors: [scrum-master, dev-agent]
274
-
1877
+
275
1878
  - id: story
276
1879
  title: Story
277
1880
  type: template-text
@@ -283,7 +1886,7 @@ sections:
283
1886
  elicit: true
284
1887
  owner: scrum-master
285
1888
  editors: [scrum-master]
286
-
1889
+
287
1890
  - id: acceptance-criteria
288
1891
  title: Acceptance Criteria
289
1892
  type: numbered-list
@@ -291,7 +1894,7 @@ sections:
291
1894
  elicit: true
292
1895
  owner: scrum-master
293
1896
  editors: [scrum-master]
294
-
1897
+
295
1898
  - id: tasks-subtasks
296
1899
  title: Tasks / Subtasks
297
1900
  type: bullet-list
@@ -308,7 +1911,7 @@ sections:
308
1911
  elicit: true
309
1912
  owner: scrum-master
310
1913
  editors: [scrum-master, dev-agent]
311
-
1914
+
312
1915
  - id: dev-notes
313
1916
  title: Dev Notes
314
1917
  instruction: |
@@ -332,7 +1935,7 @@ sections:
332
1935
  elicit: true
333
1936
  owner: scrum-master
334
1937
  editors: [scrum-master]
335
-
1938
+
336
1939
  - id: change-log
337
1940
  title: Change Log
338
1941
  type: table
@@ -340,7 +1943,7 @@ sections:
340
1943
  instruction: Track changes made to this story document
341
1944
  owner: scrum-master
342
1945
  editors: [scrum-master, dev-agent, qa-agent]
343
-
1946
+
344
1947
  - id: dev-agent-record
345
1948
  title: Dev Agent Record
346
1949
  instruction: This section is populated by the development agent during implementation
@@ -353,25 +1956,25 @@ sections:
353
1956
  instruction: Record the specific AI agent model and version used for development
354
1957
  owner: dev-agent
355
1958
  editors: [dev-agent]
356
-
1959
+
357
1960
  - id: debug-log-references
358
1961
  title: Debug Log References
359
1962
  instruction: Reference any debug logs or traces generated during development
360
1963
  owner: dev-agent
361
1964
  editors: [dev-agent]
362
-
1965
+
363
1966
  - id: completion-notes
364
1967
  title: Completion Notes List
365
1968
  instruction: Notes about the completion of tasks and any issues encountered
366
1969
  owner: dev-agent
367
1970
  editors: [dev-agent]
368
-
1971
+
369
1972
  - id: file-list
370
1973
  title: File List
371
1974
  instruction: List all files created, modified, or affected during story implementation
372
1975
  owner: dev-agent
373
1976
  editors: [dev-agent]
374
-
1977
+
375
1978
  - id: qa-results
376
1979
  title: QA Results
377
1980
  instruction: Results from QA Agent QA review of the completed story implementation