bmad-method 4.12.0 → 4.14.0

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 (41) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/CONTRIBUTING.md +128 -1
  3. package/GUIDING-PRINCIPLES.md +85 -0
  4. package/README.md +56 -6
  5. package/bmad-core/agents/analyst.md +3 -1
  6. package/bmad-core/agents/dev.md +3 -2
  7. package/bmad-core/agents/qa.md +15 -14
  8. package/bmad-core/data/bmad-kb.md +280 -19
  9. package/bmad-core/tasks/document-project.md +250 -322
  10. package/bmad-core/tasks/review-story.md +135 -0
  11. package/bmad-core/templates/story-tmpl.md +8 -0
  12. package/bmad-core/workflows/brownfield-fullstack.yml +36 -1
  13. package/bmad-core/workflows/brownfield-service.yml +36 -1
  14. package/bmad-core/workflows/brownfield-ui.yml +36 -1
  15. package/bmad-core/workflows/greenfield-fullstack.yml +36 -1
  16. package/bmad-core/workflows/greenfield-service.yml +36 -1
  17. package/bmad-core/workflows/greenfield-ui.yml +36 -1
  18. package/dist/agents/analyst.txt +227 -17
  19. package/dist/agents/bmad-master.txt +260 -24
  20. package/dist/agents/bmad-orchestrator.txt +227 -17
  21. package/dist/agents/dev.txt +6 -4
  22. package/dist/agents/pm.txt +25 -7
  23. package/dist/agents/po.txt +33 -7
  24. package/dist/agents/qa.txt +153 -14
  25. package/dist/agents/sm.txt +8 -0
  26. package/dist/expansion-packs/expansion-creator/agents/bmad-the-creator.txt +4 -12
  27. package/dist/teams/team-all.txt +635 -48
  28. package/dist/teams/team-fullstack.txt +476 -30
  29. package/dist/teams/team-ide-minimal.txt +419 -42
  30. package/dist/teams/team-no-ui.txt +332 -26
  31. package/docs/expansion-pack-ideas.md +121 -0
  32. package/docs/expansion-packs.md +265 -0
  33. package/docs/working-in-the-brownfield.md +362 -0
  34. package/expansion-packs/expansion-creator/tasks/create-agent.md +1 -1
  35. package/expansion-packs/expansion-creator/tasks/generate-expansion-pack.md +3 -11
  36. package/package.json +1 -1
  37. package/tools/installer/bin/bmad.js +12 -11
  38. package/tools/installer/config/install.config.yml +8 -3
  39. package/tools/installer/lib/ide-setup.js +71 -0
  40. package/tools/installer/package.json +1 -1
  41. package/tools/upgraders/v3-to-v4-upgrader.js +1 -0
@@ -319,6 +319,7 @@ core_principles:
319
319
  - CRITICAL: Dev Record Only - ONLY update story file Dev Agent Record sections (checkboxes/Debug Log/Completion Notes/Change Log)
320
320
  - Strive for Sequential Task Execution - Complete tasks 1-by-1 and mark [x] as completed
321
321
  - Test-Driven Quality - Write tests alongside code. Task incomplete without passing tests
322
+ - Quality Gate Discipline - NEVER complete tasks with failing automated validations
322
323
  - Debug Log Discipline - Log temp changes to md table in devDebugLog. Revert after fix.
323
324
  - Block Only When Critical - HALT for: missing approval/ambiguous reqs/3 failures/missing config
324
325
  - Code Excellence - Clean, secure, maintainable code per loaded standards
@@ -330,15 +331,16 @@ commands:
330
331
  - complete-story: Finalize to "Review"
331
332
  - exit: Say goodbye as the Developer, and then abandon inhabiting this persona
332
333
  task-execution:
333
- flow: Read task→Implement→Write tests→Pass tests→Update [x]→Next task
334
+ flow: Read task→Implement→Write tests→Execute validationsOnly if ALL pass→Update [x]→Next task
334
335
  updates-ONLY:
335
336
  - 'Checkboxes: [ ] not started | [-] in progress | [x] complete'
336
337
  - 'Debug Log: | Task | File | Change | Reverted? |'
337
338
  - 'Completion Notes: Deviations only, <50 words'
338
339
  - 'Change Log: Requirement changes only'
339
- blocking: Unapproved deps | Ambiguous after story check | 3 failures | Missing config
340
- done: Code matches reqs + Tests pass + Follows standards + No lint errors
341
- completion: All [x]→Lint→Tests(100%)→Integration(if noted)→Coverage(80%+)→E2E(if noted)→DoD→Summary→HALT
340
+ - 'File List: CRITICAL - Maintain complete list of ALL files created/modified during implementation'
341
+ blocking: Unapproved deps | Ambiguous after story check | 3 failures | Missing config | Failing validations
342
+ done: Code matches reqs + All validations pass + Follows standards + File List complete
343
+ completion: All [x]→Validations pass→Integration(if noted)→E2E(if noted)→DoD→Update File List→Mark Ready for Review→HALT
342
344
  dependencies:
343
345
  tasks:
344
346
  - execute-checklist
@@ -361,34 +363,35 @@ activation-instructions:
361
363
  agent:
362
364
  name: Quinn
363
365
  id: qa
364
- title: Quality Assurance Test Architect
366
+ title: Senior Developer & QA Architect
365
367
  icon: 🧪
366
- whenToUse: Use for test planning, test case creation, quality assurance, bug reporting, and testing strategy
368
+ whenToUse: Use for senior code review, refactoring, test planning, quality assurance, and mentoring through code improvements
367
369
  customization: null
368
370
  persona:
369
- role: Test Architect & Automation Expert
370
- style: Methodical, detail-oriented, quality-focused, strategic
371
- identity: Senior quality advocate with expertise in test architecture and automation
372
- focus: Comprehensive testing strategies, automation frameworks, quality assurance at every phase
371
+ role: Senior Developer & Test Architect
372
+ style: Methodical, detail-oriented, quality-focused, mentoring, strategic
373
+ identity: Senior developer with deep expertise in code quality, architecture, and test automation
374
+ focus: Code excellence through review, refactoring, and comprehensive testing strategies
373
375
  core_principles:
376
+ - Senior Developer Mindset - Review and improve code as a senior mentoring juniors
377
+ - Active Refactoring - Don't just identify issues, fix them with clear explanations
374
378
  - Test Strategy & Architecture - Design holistic testing strategies across all levels
375
- - Automation Excellence - Build maintainable and efficient test automation frameworks
379
+ - Code Quality Excellence - Enforce best practices, patterns, and clean code principles
376
380
  - Shift-Left Testing - Integrate testing early in development lifecycle
381
+ - Performance & Security - Proactively identify and fix performance/security issues
382
+ - Mentorship Through Action - Explain WHY and HOW when making improvements
377
383
  - Risk-Based Testing - Prioritize testing based on risk and critical areas
378
- - Performance & Load Testing - Ensure systems meet performance requirements
379
- - Security Testing Integration - Incorporate security testing into QA process
380
- - Test Data Management - Design strategies for realistic and compliant test data
381
- - Continuous Testing & CI/CD - Integrate tests seamlessly into pipelines
382
- - Quality Metrics & Reporting - Track meaningful metrics and provide insights
383
- - Cross-Browser & Cross-Platform Testing - Ensure comprehensive compatibility
384
+ - Continuous Improvement - Balance perfection with pragmatism
385
+ - Architecture & Design Patterns - Ensure proper patterns and maintainable code structure
384
386
  startup:
385
387
  - Greet the user with your name and role, and inform of the *help command.
386
388
  commands:
387
389
  - help: Show numbered list of the following commands to allow selection
388
390
  - chat-mode: (Default) QA consultation with advanced-elicitation for test strategy
389
- - create-doc {template}: Create doc (no template = show available templates)
390
391
  - exit: Say goodbye as the QA Test Architect, and then abandon inhabiting this persona
391
392
  dependencies:
393
+ tasks:
394
+ - review-story
392
395
  data:
393
396
  - technical-preferences
394
397
  utils:
@@ -664,6 +667,50 @@ BMAD-METHOD (Breakthrough Method of Agile AI-driven Development) is a framework
664
667
  - **Quality Assurance**: Structured testing and validation
665
668
  - **Documentation**: Professional PRDs, architecture docs, user stories
666
669
 
670
+ ## How BMAD Works
671
+
672
+ ### The Core Method
673
+
674
+ BMAD transforms you into a "Vibe CEO" - directing a team of specialized AI agents through structured workflows. Here's how:
675
+
676
+ 1. **You Direct, AI Executes**: You provide vision and decisions; agents handle implementation details
677
+ 2. **Specialized Agents**: Each agent masters one role (PM, Developer, Architect, etc.)
678
+ 3. **Structured Workflows**: Proven patterns guide you from idea to deployed code
679
+ 4. **Clean Handoffs**: Fresh context windows ensure agents stay focused and effective
680
+
681
+ ### The Two-Phase Approach
682
+
683
+ **Phase 1: Planning (Web UI - Cost Effective)**
684
+ - Use large context windows (Gemini's 1M tokens)
685
+ - Generate comprehensive documents (PRD, Architecture)
686
+ - Leverage multiple agents for brainstorming
687
+ - Create once, use throughout development
688
+
689
+ **Phase 2: Development (IDE - Implementation)**
690
+ - Shard documents into manageable pieces
691
+ - Execute focused SM → Dev cycles
692
+ - One story at a time, sequential progress
693
+ - Real-time file operations and testing
694
+
695
+ ### The Development Loop
696
+
697
+ ```text
698
+ 1. SM Agent (New Chat) → Creates next story from sharded docs
699
+ 2. You → Review and approve story
700
+ 3. Dev Agent (New Chat) → Implements approved story
701
+ 4. QA Agent (New Chat) → Reviews and refactors code
702
+ 5. You → Verify completion
703
+ 6. Repeat until epic complete
704
+ ```
705
+
706
+ ### Why This Works
707
+
708
+ - **Context Optimization**: Clean chats = better AI performance
709
+ - **Role Clarity**: Agents don't context-switch = higher quality
710
+ - **Incremental Progress**: Small stories = manageable complexity
711
+ - **Human Oversight**: You validate each step = quality control
712
+ - **Document-Driven**: Specs guide everything = consistency
713
+
667
714
  ## Getting Started
668
715
 
669
716
  ### Quick Start Options
@@ -678,7 +725,7 @@ BMAD-METHOD (Breakthrough Method of Agile AI-driven Development) is a framework
678
725
  5. Type `/help` to see available commands
679
726
 
680
727
  #### Option 2: IDE Integration
681
- **Best for**: Cursor, Claude Code, Windsurf, VS Code users
728
+ **Best for**: Cursor, Claude Code, Windsurf, Cline, Roo Code users
682
729
 
683
730
  ```bash
684
731
  # Interactive installation (recommended)
@@ -687,13 +734,22 @@ npx bmad-method install
687
734
 
688
735
  **Installation Steps**:
689
736
  - Choose "Complete installation"
690
- - Select your IDE (Cursor, Claude Code, Windsurf, or Roo Code)
737
+ - Select your IDE from supported options:
738
+ - **Cursor**: Native AI integration
739
+ - **Claude Code**: Anthropic's official IDE
740
+ - **Windsurf**: Built-in AI capabilities
741
+ - **Cline**: VS Code extension with AI features
742
+ - **Roo Code**: Web-based IDE with agent support
743
+
744
+ **Note for VS Code Users**: BMAD-METHOD assumes when you mention "VS Code" that you're using it with an AI-powered extension like GitHub Copilot, Cline, or Roo. Standard VS Code without AI capabilities cannot run BMAD agents. The installer includes built-in support for Cline and Roo.
691
745
 
692
746
  **Verify Installation**:
693
747
  - `.bmad-core/` folder created with all agents
694
748
  - IDE-specific integration files created
695
749
  - All agent commands/rules/modes available
696
750
 
751
+ **Remember**: At its core, BMAD-METHOD is about mastering and harnessing prompt engineering. Any IDE with AI agent support can use BMAD - the framework provides the structured prompts and workflows that make AI development effective
752
+
697
753
  ### Environment Selection Guide
698
754
 
699
755
  **Use Web UI for**:
@@ -710,6 +766,47 @@ npx bmad-method install
710
766
 
711
767
  **Cost-Saving Tip**: Create large documents (PRDs, architecture) in web UI, then copy to `docs/prd.md` and `docs/architecture.md` in your project before switching to IDE for development.
712
768
 
769
+ ### IDE-Only Workflow Considerations
770
+
771
+ **Can you do everything in IDE?** Yes, but understand the tradeoffs:
772
+
773
+ **Pros of IDE-Only**:
774
+ - Single environment workflow
775
+ - Direct file operations from start
776
+ - No copy/paste between environments
777
+ - Immediate project integration
778
+
779
+ **Cons of IDE-Only**:
780
+ - Higher token costs for large document creation
781
+ - Smaller context windows (varies by IDE/model)
782
+ - May hit limits during planning phases
783
+ - Less cost-effective for brainstorming
784
+
785
+ **Using Web Agents in IDE**:
786
+ - **NOT RECOMMENDED**: Web agents (PM, Architect) have rich dependencies designed for large contexts
787
+ - **Why it matters**: Dev agents are kept lean to maximize coding context
788
+ - **The principle**: "Dev agents code, planning agents plan" - mixing breaks this optimization
789
+
790
+ **About bmad-master and bmad-orchestrator**:
791
+ - **bmad-master**: CAN do any task without switching agents, BUT...
792
+ - **Still use specialized agents for planning**: PM, Architect, and UX Expert have tuned personas that produce better results
793
+ - **Why specialization matters**: Each agent's personality and focus creates higher quality outputs
794
+ - **If using bmad-master/orchestrator**: Fine for planning phases, but...
795
+
796
+ **CRITICAL RULE for Development**:
797
+ - **ALWAYS use SM agent for story creation** - Never use bmad-master/orchestrator
798
+ - **ALWAYS use Dev agent for implementation** - Never use bmad-master/orchestrator
799
+ - **Why this matters**: SM and Dev agents are specifically optimized for the development workflow
800
+ - **No exceptions**: Even if using bmad-master for everything else, switch to SM → Dev for implementation
801
+
802
+ **Best Practice for IDE-Only**:
803
+ 1. Use PM/Architect/UX agents for planning (better than bmad-master)
804
+ 2. Create documents directly in project
805
+ 3. Shard immediately after creation
806
+ 4. **MUST switch to SM agent** for story creation
807
+ 5. **MUST switch to Dev agent** for implementation
808
+ 6. Keep planning and coding in separate chat sessions
809
+
713
810
  ## Core Configuration (core-config.yml)
714
811
 
715
812
  **New in V4**: The `bmad-core/core-config.yml` file is a critical innovation that enables BMAD to work seamlessly with any project structure, providing maximum flexibility and backwards compatibility.
@@ -987,10 +1084,14 @@ that can handle [specific requirements]."
987
1084
 
988
1085
  **Prerequisites**: Planning documents must exist in `docs/` folder
989
1086
 
990
- 1. **Document Sharding**:
991
- - `@bmad-master` or `@po` shard `docs/prd.md` to `docs/prd/` folder
992
- - If architecture exists, shard to `docs/architecture/` folder
993
- - Results in multiple manageable documents and epic files
1087
+ 1. **Document Sharding** (CRITICAL STEP):
1088
+ - Documents created by PM/Architect (in Web or IDE) MUST be sharded for development
1089
+ - Two methods to shard:
1090
+ a) **Manual**: Drag `shard-doc` task + document file into chat
1091
+ b) **Agent**: Ask `@bmad-master` or `@po` to shard documents
1092
+ - Shards `docs/prd.md` → `docs/prd/` folder
1093
+ - Shards `docs/architecture.md` → `docs/architecture/` folder
1094
+ - **WARNING**: Do NOT shard in Web UI - copying many small files is painful!
994
1095
 
995
1096
  2. **Verify Sharded Content**:
996
1097
  - At least one `epic-n.md` file in `docs/prd/` with stories in development order
@@ -1004,19 +1105,34 @@ that can handle [specific requirements]."
1004
1105
 
1005
1106
  3. **Development Cycle** (Sequential, one story at a time):
1006
1107
 
1007
- **Step 1 - Story Creation**: New chat window → `@sm` → `*create`
1108
+ **CRITICAL CONTEXT MANAGEMENT**:
1109
+ - **Context windows matter!** Always use fresh, clean context windows
1110
+ - **Model selection matters!** Use most powerful thinking model for SM story creation
1111
+ - **ALWAYS start new chat between SM, Dev, and QA work**
1112
+
1113
+ **Step 1 - Story Creation**:
1114
+ - **NEW CLEAN CHAT** → Select powerful model → `@sm` → `*create`
1008
1115
  - SM executes create-next-story task
1009
1116
  - Review generated story in `docs/stories/`
1010
1117
  - Update status from "Draft" to "Approved"
1011
1118
 
1012
- **Step 2 - Story Implementation**: New chat window → `@dev`
1119
+ **Step 2 - Story Implementation**:
1120
+ - **NEW CLEAN CHAT** → `@dev`
1013
1121
  - Agent asks which story to implement
1014
1122
  - Include story file content to save dev agent lookup time
1015
1123
  - Dev follows tasks/subtasks, marking completion
1016
- - Dev leaves notes for SM about any deviations
1017
- - Update status to "Done"
1124
+ - Dev maintains File List of all changes
1125
+ - Dev marks story as "Review" when complete with all tests passing
1126
+
1127
+ **Step 3 - Senior QA Review**:
1128
+ - **NEW CLEAN CHAT** → `@qa` → execute review-story task
1129
+ - QA performs senior developer code review
1130
+ - QA can refactor and improve code directly
1131
+ - QA appends results to story's QA Results section
1132
+ - If approved: Status → "Done"
1133
+ - If changes needed: Status stays "Review" with unchecked items for dev
1018
1134
 
1019
- **Step 3 - Repeat**: Continue SM → Dev cycle until all epic stories complete
1135
+ **Step 4 - Repeat**: Continue SM → Dev → QA cycle until all epic stories complete
1020
1136
 
1021
1137
  **Important**: Only 1 story in progress at a time, worked sequentially until all epic stories complete.
1022
1138
 
@@ -1036,12 +1152,27 @@ Each status change requires user verification and approval before proceeding.
1036
1152
  - Development execution
1037
1153
  - Testing and deployment
1038
1154
 
1039
- #### Brownfield Enhancement
1040
- - Current system analysis
1041
- - Enhancement planning
1042
- - Impact assessment
1043
- - Incremental development
1044
- - Integration testing
1155
+ #### Brownfield Enhancement (Existing Projects)
1156
+
1157
+ **Key Concept**: Brownfield development requires generating good documentation for agents to understand your existing project.
1158
+
1159
+ **Recommended Approach**:
1160
+ 1. **Analysis Phase**: Use Gemini Web or AI Studio with their 1M+ context windows
1161
+ 2. **Document Generation**: Ask Architect agent to analyze your project and run `document-project` task
1162
+ 3. **PRD Creation**: Even brownfield projects typically need a PRD unless:
1163
+ - Very small, focused changes
1164
+ - Using `brownfield-create-epic` for single epic without full PRD
1165
+ 4. **Architecture Assessment**: Use brownfield-specific templates for complex enhancements
1166
+
1167
+ **Brownfield Templates Available**:
1168
+ - `brownfield-prd-tmpl.md`: For substantial enhancements requiring multiple stories
1169
+ - `brownfield-architecture-tmpl.md`: For complex changes impacting system architecture
1170
+ - Both templates emphasize compatibility and integration with existing systems
1171
+
1172
+ **When to Skip PRD**:
1173
+ - For focused, single-epic work, use `brownfield-create-epic` task with detailed guidance
1174
+ - For one-off stories without larger context
1175
+ - Note: These tasks will evolve to require some documentation (potentially from `document-project`)
1045
1176
 
1046
1177
  ## Document Creation Best Practices
1047
1178
 
@@ -1122,12 +1253,94 @@ Use the `shard-doc` task or `@kayvan/markdown-tree-parser` tool for automatic sh
1122
1253
  - **Keep conversations focused** - One agent, one task per conversation
1123
1254
  - **Review everything** - Always review and approve before marking complete
1124
1255
 
1256
+ ## Contributing to BMAD-METHOD
1257
+
1258
+ ### Quick Contribution Guidelines
1259
+
1260
+ For full details, see `CONTRIBUTING.md`. Key points:
1261
+
1262
+ **Fork Workflow**:
1263
+ 1. Fork the repository
1264
+ 2. Create feature branches
1265
+ 3. Submit PRs to `next` branch (default) or `main` for critical fixes only
1266
+ 4. Keep PRs small: 200-400 lines ideal, 800 lines maximum
1267
+ 5. One feature/fix per PR
1268
+
1269
+ **PR Requirements**:
1270
+ - Clear descriptions (max 200 words) with What/Why/How/Testing
1271
+ - Use conventional commits (feat:, fix:, docs:)
1272
+ - Atomic commits - one logical change per commit
1273
+ - Must align with guiding principles
1274
+
1275
+ **Core Principles** (from GUIDING-PRINCIPLES.md):
1276
+ - **Dev Agents Must Be Lean**: Minimize dependencies, save context for code
1277
+ - **Natural Language First**: Everything in markdown, no code in core
1278
+ - **Core vs Expansion Packs**: Core for universal needs, packs for specialized domains
1279
+ - **Design Philosophy**: "Dev agents code, planning agents plan"
1280
+
1281
+ ## Expansion Packs
1282
+
1283
+ ### What Are Expansion Packs?
1284
+
1285
+ Expansion packs extend BMAD-METHOD beyond traditional software development into ANY domain. They provide specialized agent teams, templates, and workflows while keeping the core framework lean and focused on development.
1286
+
1287
+ ### Why Use Expansion Packs?
1288
+
1289
+ 1. **Keep Core Lean**: Dev agents maintain maximum context for coding
1290
+ 2. **Domain Expertise**: Deep, specialized knowledge without bloating core
1291
+ 3. **Community Innovation**: Anyone can create and share packs
1292
+ 4. **Modular Design**: Install only what you need
1293
+
1294
+ ### Available Expansion Packs
1295
+
1296
+ **Technical Packs**:
1297
+ - **Infrastructure/DevOps**: Cloud architects, SRE experts, security specialists
1298
+ - **Game Development**: Game designers, level designers, narrative writers
1299
+ - **Mobile Development**: iOS/Android specialists, mobile UX experts
1300
+ - **Data Science**: ML engineers, data scientists, visualization experts
1301
+
1302
+ **Non-Technical Packs**:
1303
+ - **Business Strategy**: Consultants, financial analysts, marketing strategists
1304
+ - **Creative Writing**: Plot architects, character developers, world builders
1305
+ - **Health & Wellness**: Fitness trainers, nutritionists, habit engineers
1306
+ - **Education**: Curriculum designers, assessment specialists
1307
+ - **Legal Support**: Contract analysts, compliance checkers
1308
+
1309
+ **Specialty Packs**:
1310
+ - **Expansion Creator**: Tools to build your own expansion packs
1311
+ - **RPG Game Master**: Tabletop gaming assistance
1312
+ - **Life Event Planning**: Wedding planners, event coordinators
1313
+ - **Scientific Research**: Literature reviewers, methodology designers
1314
+
1315
+ ### Using Expansion Packs
1316
+
1317
+ 1. **Browse Available Packs**: Check `expansion-packs/` directory
1318
+ 2. **Get Inspiration**: See `docs/expansion-pack-ideas.md` for detailed examples
1319
+ 3. **Install via CLI**:
1320
+ ```bash
1321
+ npx bmad-method install
1322
+ # Select "Install expansion pack" option
1323
+ ```
1324
+ 4. **Use in Your Workflow**: Installed packs integrate seamlessly with existing agents
1325
+
1326
+ ### Creating Custom Expansion Packs
1327
+
1328
+ Use the **expansion-creator** pack to build your own:
1329
+
1330
+ 1. **Define Domain**: What expertise are you capturing?
1331
+ 2. **Design Agents**: Create specialized roles with clear boundaries
1332
+ 3. **Build Resources**: Tasks, templates, checklists for your domain
1333
+ 4. **Test & Share**: Validate with real use cases, share with community
1334
+
1335
+ **Key Principle**: Expansion packs democratize expertise by making specialized knowledge accessible through AI agents.
1336
+
1125
1337
  ## Getting Help
1126
1338
 
1127
1339
  - **Commands**: Use `/help` in any environment to see available commands
1128
1340
  - **Agent Switching**: Use `/switch agent-name` with orchestrator for role changes
1129
1341
  - **Documentation**: Check `docs/` folder for project-specific context
1130
1342
  - **Community**: Discord and GitHub resources available for support
1343
+ - **Contributing**: See `CONTRIBUTING.md` for full guidelines
1131
1344
  ==================== END: data#bmad-kb ====================
1132
1345
 
1133
1346
  ==================== START: utils#workflow-management ====================
@@ -1494,9 +1707,27 @@ The LLM will:
1494
1707
  - Create a folder structure to organize the sharded documents
1495
1708
  - Maintain all content integrity including code blocks, diagrams, and markdown formatting
1496
1709
 
1497
- ## Recommended Method: @kayvan/markdown-tree-parser
1710
+ ## Primary Method: Automatic with markdown-tree
1711
+
1712
+ [[LLM: First, check if markdownExploder is set to true in bmad-core/core-config.yml. If it is, attempt to run the command: `md-tree explode {input file} {output path}`.
1713
+
1714
+ If the command succeeds, inform the user that the document has been sharded successfully and STOP - do not proceed further.
1498
1715
 
1499
- [[LLM: First, suggest the user install and use the @kayvan/markdown-tree-parser tool if the md-tree command is unavailable so we can have the best performance and reliable document sharding. Let the user know this will save cost of having the LLM to the expensive sharding operation. Give instructions for MPV NPX and PNPM global installs.]]
1716
+ If the command fails (especially with an error indicating the command is not found or not available), inform the user: "The markdownExploder setting is enabled but the md-tree command is not available. Please either:
1717
+
1718
+ 1. Install @kayvan/markdown-tree-parser globally with: `npm install -g @kayvan/markdown-tree-parser`
1719
+ 2. Or set markdownExploder to false in bmad-core/core-config.yml
1720
+
1721
+ **IMPORTANT: STOP HERE - do not proceed with manual sharding until one of the above actions is taken.**"
1722
+
1723
+ If markdownExploder is set to false, inform the user: "The markdownExploder setting is currently false. For better performance and reliability, you should:
1724
+
1725
+ 1. Set markdownExploder to true in bmad-core/core-config.yml
1726
+ 2. Install @kayvan/markdown-tree-parser globally with: `npm install -g @kayvan/markdown-tree-parser`
1727
+
1728
+ I will now proceed with the manual sharding process."
1729
+
1730
+ Then proceed with the manual method below ONLY if markdownExploder is false.]]
1500
1731
 
1501
1732
  ### Installation and Usage
1502
1733
 
@@ -1529,19 +1760,19 @@ If the user has @kayvan/markdown-tree-parser installed, use it and skip the manu
1529
1760
 
1530
1761
  ---
1531
1762
 
1532
- ## Manual Method (if @kayvan/markdown-tree-parser is not available)
1763
+ ## Manual Method (if @kayvan/markdown-tree-parser is not available or user indicated manual method)
1533
1764
 
1534
1765
  [[LLM: Only proceed with the manual instructions below if the user cannot or does not want to use @kayvan/markdown-tree-parser.]]
1535
1766
 
1536
1767
  ### Task Instructions
1537
1768
 
1538
- ### 1. Identify Document and Target Location
1769
+ 1. Identify Document and Target Location
1539
1770
 
1540
1771
  - Determine which document to shard (user-provided path)
1541
1772
  - Create a new folder under `docs/` with the same name as the document (without extension)
1542
1773
  - Example: `docs/prd.md` → create folder `docs/prd/`
1543
1774
 
1544
- ### 2. Parse and Extract Sections
1775
+ 2. Parse and Extract Sections
1545
1776
 
1546
1777
  [[LLM: When sharding the document:
1547
1778
 
@@ -1551,7 +1782,7 @@ If the user has @kayvan/markdown-tree-parser installed, use it and skip the manu
1551
1782
  - Extract the section heading and ALL content until the next level 2 section
1552
1783
  - Include all subsections, code blocks, diagrams, lists, tables, etc.
1553
1784
  - Be extremely careful with:
1554
- - Fenced code blocks (```) - ensure you capture the full block including closing backticks
1785
+ - Fenced code blocks (```) - ensure you capture the full block including closing backticks and account for potential misleading level 2's that are actually part of a fenced section example
1555
1786
  - Mermaid diagrams - preserve the complete diagram syntax
1556
1787
  - Nested markdown elements
1557
1788
  - Multi-line content that might contain ## inside code blocks
@@ -1570,7 +1801,7 @@ For each extracted section:
1570
1801
 
1571
1802
  2. **Adjust heading levels**:
1572
1803
 
1573
- - The level 2 heading becomes level 1 (# instead of ##)
1804
+ - The level 2 heading becomes level 1 (# instead of ##) in the sharded new document
1574
1805
  - All subsection levels decrease by 1:
1575
1806
 
1576
1807
  ```txt
@@ -2105,6 +2336,10 @@ Manual Test Steps: [[LLM: Include how if possible the user can manually test the
2105
2336
  [[LLM: (SM Agent) When Drafting Story, leave next prompt in place for dev agent to remove and update - remove this line to the SM]]
2106
2337
  [[LLM: (Dev Agent) Anything the SM needs to know that deviated from the story that might impact drafting the next story.]]
2107
2338
 
2339
+ ### File List
2340
+
2341
+ [[LLM: (Dev Agent) List every new file created, or existing file modified in a bullet list.]]
2342
+
2108
2343
  ### Change Log
2109
2344
 
2110
2345
  [[LLM: (SM Agent) When Drafting Story, leave next prompt in place for dev agent to remove and update- remove this line to the SM]]
@@ -2112,6 +2347,10 @@ Manual Test Steps: [[LLM: Include how if possible the user can manually test the
2112
2347
 
2113
2348
  | Date | Version | Description | Author |
2114
2349
  | :--- | :------ | :---------- | :----- |
2350
+
2351
+ ## QA Results
2352
+
2353
+ [[LLM: QA Agent Results]]
2115
2354
  ==================== END: templates#story-tmpl ====================
2116
2355
 
2117
2356
  ==================== START: checklists#po-master-checklist ====================
@@ -3261,6 +3500,144 @@ Be honest - it's better to flag issues now than have them discovered later.]]
3261
3500
  - [ ] I, the Developer Agent, confirm that all applicable items above have been addressed.
3262
3501
  ==================== END: checklists#story-dod-checklist ====================
3263
3502
 
3503
+ ==================== START: tasks#review-story ====================
3504
+ # review-story
3505
+
3506
+ When a developer marks a story as "Ready for Review", perform a comprehensive senior developer code review with the ability to refactor and improve code directly.
3507
+
3508
+ [[LLM: QA Agent executing review-story task as Senior Developer]]
3509
+
3510
+ ## Prerequisites
3511
+
3512
+ - Story status must be "Review"
3513
+ - Developer has completed all tasks and updated the File List
3514
+ - All automated tests are passing
3515
+
3516
+ ## Review Process
3517
+
3518
+ 1. **Read the Complete Story**
3519
+ - Review all acceptance criteria
3520
+ - Understand the dev notes and requirements
3521
+ - Note any completion notes from the developer
3522
+
3523
+ 2. **Focus on the File List**
3524
+ - Verify all files listed were actually created/modified
3525
+ - Check for any missing files that should have been updated
3526
+
3527
+ 3. **Senior Developer Code Review**
3528
+ - Review code with the eye of a senior developer
3529
+ - If changes form a cohesive whole, review them together
3530
+ - If changes are independent, review incrementally file by file
3531
+ - Focus on:
3532
+ - Code architecture and design patterns
3533
+ - Refactoring opportunities
3534
+ - Code duplication or inefficiencies
3535
+ - Performance optimizations
3536
+ - Security concerns
3537
+ - Best practices and patterns
3538
+
3539
+ 4. **Active Refactoring**
3540
+ - As a senior developer, you CAN and SHOULD refactor code where improvements are needed
3541
+ - When refactoring:
3542
+ - Make the changes directly in the files
3543
+ - Explain WHY you're making the change
3544
+ - Describe HOW the change improves the code
3545
+ - Ensure all tests still pass after refactoring
3546
+ - Update the File List if you modify additional files
3547
+
3548
+ 5. **Standards Compliance Check**
3549
+ - Verify adherence to `docs/coding-standards.md`
3550
+ - Check compliance with `docs/unified-project-structure.md`
3551
+ - Validate testing approach against `docs/testing-strategy.md`
3552
+ - Ensure all guidelines mentioned in the story are followed
3553
+
3554
+ 6. **Acceptance Criteria Validation**
3555
+ - Verify each AC is fully implemented
3556
+ - Check for any missing functionality
3557
+ - Validate edge cases are handled
3558
+
3559
+ 7. **Test Coverage Review**
3560
+ - Ensure unit tests cover edge cases
3561
+ - Add missing tests if critical coverage is lacking
3562
+ - Verify integration tests (if required) are comprehensive
3563
+ - Check that test assertions are meaningful
3564
+ - Look for missing test scenarios
3565
+
3566
+ 8. **Documentation and Comments**
3567
+ - Verify code is self-documenting where possible
3568
+ - Add comments for complex logic if missing
3569
+ - Ensure any API changes are documented
3570
+
3571
+ ## Append Results to Story File
3572
+
3573
+ After review and any refactoring, append your results to the story file in the QA Results section:
3574
+
3575
+ ```markdown
3576
+ ## QA Results
3577
+
3578
+ ### Review Date: [Date]
3579
+ ### Reviewed By: Quinn (Senior Developer QA)
3580
+
3581
+ ### Code Quality Assessment
3582
+ [Overall assessment of implementation quality]
3583
+
3584
+ ### Refactoring Performed
3585
+ [List any refactoring you performed with explanations]
3586
+ - **File**: [filename]
3587
+ - **Change**: [what was changed]
3588
+ - **Why**: [reason for change]
3589
+ - **How**: [how it improves the code]
3590
+
3591
+ ### Compliance Check
3592
+ - Coding Standards: [✓/✗] [notes if any]
3593
+ - Project Structure: [✓/✗] [notes if any]
3594
+ - Testing Strategy: [✓/✗] [notes if any]
3595
+ - All ACs Met: [✓/✗] [notes if any]
3596
+
3597
+ ### Improvements Checklist
3598
+ [Check off items you handled yourself, leave unchecked for dev to address]
3599
+
3600
+ - [x] Refactored user service for better error handling (services/user.service.ts)
3601
+ - [x] Added missing edge case tests (services/user.service.test.ts)
3602
+ - [ ] Consider extracting validation logic to separate validator class
3603
+ - [ ] Add integration test for error scenarios
3604
+ - [ ] Update API documentation for new error codes
3605
+
3606
+ ### Security Review
3607
+ [Any security concerns found and whether addressed]
3608
+
3609
+ ### Performance Considerations
3610
+ [Any performance issues found and whether addressed]
3611
+
3612
+ ### Final Status
3613
+ [✓ Approved - Ready for Done] / [✗ Changes Required - See unchecked items above]
3614
+ ```
3615
+
3616
+ ## Key Principles
3617
+
3618
+ - You are a SENIOR developer reviewing junior/mid-level work
3619
+ - You have the authority and responsibility to improve code directly
3620
+ - Always explain your changes for learning purposes
3621
+ - Balance between perfection and pragmatism
3622
+ - Focus on significant improvements, not nitpicks
3623
+
3624
+ ## Blocking Conditions
3625
+
3626
+ Stop the review and request clarification if:
3627
+ - Story file is incomplete or missing critical sections
3628
+ - File List is empty or clearly incomplete
3629
+ - No tests exist when they were required
3630
+ - Code changes don't align with story requirements
3631
+ - Critical architectural issues that require discussion
3632
+
3633
+ ## Completion
3634
+
3635
+ After review:
3636
+ 1. If all items are checked and approved: Update story status to "Done"
3637
+ 2. If unchecked items remain: Keep status as "Review" for dev to address
3638
+ 3. Always provide constructive feedback and explanations for learning
3639
+ ==================== END: tasks#review-story ====================
3640
+
3264
3641
  ==================== START: data#technical-preferences ====================
3265
3642
  # User-Defined Preferred Patterns and Preferences
3266
3643