bmad-method 4.13.0 → 4.14.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 (34) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/GUIDING-PRINCIPLES.md +0 -33
  3. package/README.md +3 -2
  4. package/bmad-core/agents/analyst.md +3 -1
  5. package/bmad-core/agents/dev.md +3 -2
  6. package/bmad-core/agents/qa.md +15 -14
  7. package/bmad-core/data/bmad-kb.md +280 -19
  8. package/bmad-core/tasks/document-project.md +250 -322
  9. package/bmad-core/tasks/review-story.md +135 -0
  10. package/bmad-core/templates/story-tmpl.md +8 -0
  11. package/bmad-core/workflows/brownfield-fullstack.yml +36 -1
  12. package/bmad-core/workflows/brownfield-service.yml +36 -1
  13. package/bmad-core/workflows/brownfield-ui.yml +36 -1
  14. package/bmad-core/workflows/greenfield-fullstack.yml +36 -1
  15. package/bmad-core/workflows/greenfield-service.yml +36 -1
  16. package/bmad-core/workflows/greenfield-ui.yml +36 -1
  17. package/dist/agents/analyst.txt +603 -20
  18. package/dist/agents/architect.txt +230 -302
  19. package/dist/agents/bmad-master.txt +543 -328
  20. package/dist/agents/bmad-orchestrator.txt +280 -19
  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/bmad-2d-phaser-game-dev/teams/phaser-2d-nodejs-game-team.txt +323 -1
  27. package/dist/expansion-packs/expansion-creator/agents/bmad-the-creator.txt +4 -12
  28. package/dist/teams/team-all.txt +1011 -443
  29. package/dist/teams/team-fullstack.txt +852 -425
  30. package/dist/teams/team-ide-minimal.txt +472 -44
  31. package/dist/teams/team-no-ui.txt +708 -421
  32. package/docs/working-in-the-brownfield.md +362 -0
  33. package/package.json +1 -1
  34. package/tools/installer/package.json +1 -1
@@ -200,7 +200,7 @@ agent:
200
200
  id: analyst
201
201
  title: Business Analyst
202
202
  icon: 📊
203
- whenToUse: Use for market research, brainstorming, competitive analysis, creating project briefs, and initial project discovery
203
+ whenToUse: Use for market research, brainstorming, competitive analysis, creating project briefs, initial project discovery, and documenting existing projects (brownfield)
204
204
  customization: null
205
205
  persona:
206
206
  role: Insightful Analyst & Strategic Ideation Partner
@@ -228,6 +228,7 @@ commands:
228
228
  - brainstorm {topic}: Facilitate structured brainstorming session
229
229
  - research {topic}: Generate deep research prompt for investigation
230
230
  - elicit: Run advanced elicitation to clarify requirements
231
+ - document-project: Analyze and document existing project structure comprehensively
231
232
  - exit: Say goodbye as the Business Analyst, and then abandon inhabiting this persona
232
233
  dependencies:
233
234
  tasks:
@@ -235,6 +236,7 @@ dependencies:
235
236
  - create-deep-research-prompt
236
237
  - create-doc
237
238
  - advanced-elicitation
239
+ - document-project
238
240
  templates:
239
241
  - project-brief-tmpl
240
242
  - market-research-tmpl
@@ -765,6 +767,50 @@ BMAD-METHOD (Breakthrough Method of Agile AI-driven Development) is a framework
765
767
  - **Quality Assurance**: Structured testing and validation
766
768
  - **Documentation**: Professional PRDs, architecture docs, user stories
767
769
 
770
+ ## How BMAD Works
771
+
772
+ ### The Core Method
773
+
774
+ BMAD transforms you into a "Vibe CEO" - directing a team of specialized AI agents through structured workflows. Here's how:
775
+
776
+ 1. **You Direct, AI Executes**: You provide vision and decisions; agents handle implementation details
777
+ 2. **Specialized Agents**: Each agent masters one role (PM, Developer, Architect, etc.)
778
+ 3. **Structured Workflows**: Proven patterns guide you from idea to deployed code
779
+ 4. **Clean Handoffs**: Fresh context windows ensure agents stay focused and effective
780
+
781
+ ### The Two-Phase Approach
782
+
783
+ **Phase 1: Planning (Web UI - Cost Effective)**
784
+ - Use large context windows (Gemini's 1M tokens)
785
+ - Generate comprehensive documents (PRD, Architecture)
786
+ - Leverage multiple agents for brainstorming
787
+ - Create once, use throughout development
788
+
789
+ **Phase 2: Development (IDE - Implementation)**
790
+ - Shard documents into manageable pieces
791
+ - Execute focused SM → Dev cycles
792
+ - One story at a time, sequential progress
793
+ - Real-time file operations and testing
794
+
795
+ ### The Development Loop
796
+
797
+ ```text
798
+ 1. SM Agent (New Chat) → Creates next story from sharded docs
799
+ 2. You → Review and approve story
800
+ 3. Dev Agent (New Chat) → Implements approved story
801
+ 4. QA Agent (New Chat) → Reviews and refactors code
802
+ 5. You → Verify completion
803
+ 6. Repeat until epic complete
804
+ ```
805
+
806
+ ### Why This Works
807
+
808
+ - **Context Optimization**: Clean chats = better AI performance
809
+ - **Role Clarity**: Agents don't context-switch = higher quality
810
+ - **Incremental Progress**: Small stories = manageable complexity
811
+ - **Human Oversight**: You validate each step = quality control
812
+ - **Document-Driven**: Specs guide everything = consistency
813
+
768
814
  ## Getting Started
769
815
 
770
816
  ### Quick Start Options
@@ -779,7 +825,7 @@ BMAD-METHOD (Breakthrough Method of Agile AI-driven Development) is a framework
779
825
  5. Type `/help` to see available commands
780
826
 
781
827
  #### Option 2: IDE Integration
782
- **Best for**: Cursor, Claude Code, Windsurf, VS Code users
828
+ **Best for**: Cursor, Claude Code, Windsurf, Cline, Roo Code users
783
829
 
784
830
  ```bash
785
831
  # Interactive installation (recommended)
@@ -788,13 +834,22 @@ npx bmad-method install
788
834
 
789
835
  **Installation Steps**:
790
836
  - Choose "Complete installation"
791
- - Select your IDE (Cursor, Claude Code, Windsurf, or Roo Code)
837
+ - Select your IDE from supported options:
838
+ - **Cursor**: Native AI integration
839
+ - **Claude Code**: Anthropic's official IDE
840
+ - **Windsurf**: Built-in AI capabilities
841
+ - **Cline**: VS Code extension with AI features
842
+ - **Roo Code**: Web-based IDE with agent support
843
+
844
+ **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.
792
845
 
793
846
  **Verify Installation**:
794
847
  - `.bmad-core/` folder created with all agents
795
848
  - IDE-specific integration files created
796
849
  - All agent commands/rules/modes available
797
850
 
851
+ **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
852
+
798
853
  ### Environment Selection Guide
799
854
 
800
855
  **Use Web UI for**:
@@ -811,6 +866,47 @@ npx bmad-method install
811
866
 
812
867
  **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.
813
868
 
869
+ ### IDE-Only Workflow Considerations
870
+
871
+ **Can you do everything in IDE?** Yes, but understand the tradeoffs:
872
+
873
+ **Pros of IDE-Only**:
874
+ - Single environment workflow
875
+ - Direct file operations from start
876
+ - No copy/paste between environments
877
+ - Immediate project integration
878
+
879
+ **Cons of IDE-Only**:
880
+ - Higher token costs for large document creation
881
+ - Smaller context windows (varies by IDE/model)
882
+ - May hit limits during planning phases
883
+ - Less cost-effective for brainstorming
884
+
885
+ **Using Web Agents in IDE**:
886
+ - **NOT RECOMMENDED**: Web agents (PM, Architect) have rich dependencies designed for large contexts
887
+ - **Why it matters**: Dev agents are kept lean to maximize coding context
888
+ - **The principle**: "Dev agents code, planning agents plan" - mixing breaks this optimization
889
+
890
+ **About bmad-master and bmad-orchestrator**:
891
+ - **bmad-master**: CAN do any task without switching agents, BUT...
892
+ - **Still use specialized agents for planning**: PM, Architect, and UX Expert have tuned personas that produce better results
893
+ - **Why specialization matters**: Each agent's personality and focus creates higher quality outputs
894
+ - **If using bmad-master/orchestrator**: Fine for planning phases, but...
895
+
896
+ **CRITICAL RULE for Development**:
897
+ - **ALWAYS use SM agent for story creation** - Never use bmad-master/orchestrator
898
+ - **ALWAYS use Dev agent for implementation** - Never use bmad-master/orchestrator
899
+ - **Why this matters**: SM and Dev agents are specifically optimized for the development workflow
900
+ - **No exceptions**: Even if using bmad-master for everything else, switch to SM → Dev for implementation
901
+
902
+ **Best Practice for IDE-Only**:
903
+ 1. Use PM/Architect/UX agents for planning (better than bmad-master)
904
+ 2. Create documents directly in project
905
+ 3. Shard immediately after creation
906
+ 4. **MUST switch to SM agent** for story creation
907
+ 5. **MUST switch to Dev agent** for implementation
908
+ 6. Keep planning and coding in separate chat sessions
909
+
814
910
  ## Core Configuration (core-config.yml)
815
911
 
816
912
  **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.
@@ -1051,10 +1147,16 @@ This architecture enables seamless operation across environments while maintaini
1051
1147
 
1052
1148
  ## Complete Development Workflow
1053
1149
 
1054
- ### Planning Phase (Web UI Recommended)
1150
+ ### Planning Phase (Web UI Recommended - Especially Gemini!)
1151
+
1152
+ **Ideal for cost efficiency with Gemini's massive context:**
1055
1153
 
1056
- **Ideal for cost efficiency, especially with Gemini:**
1154
+ **For Brownfield Projects - Start Here!**:
1155
+ 1. **Upload entire project to Gemini Web** (GitHub URL, files, or zip)
1156
+ 2. **Document existing system**: `/analyst` → `*document-project`
1157
+ 3. **Creates comprehensive docs** from entire codebase analysis
1057
1158
 
1159
+ **For All Projects**:
1058
1160
  1. **Optional Analysis**: `/analyst` - Market research, competitive analysis
1059
1161
  2. **Project Brief**: Create foundation document (Analyst or user)
1060
1162
  3. **PRD Creation**: `/pm create-doc prd` - Comprehensive product requirements
@@ -1088,10 +1190,14 @@ that can handle [specific requirements]."
1088
1190
 
1089
1191
  **Prerequisites**: Planning documents must exist in `docs/` folder
1090
1192
 
1091
- 1. **Document Sharding**:
1092
- - `@bmad-master` or `@po` shard `docs/prd.md` to `docs/prd/` folder
1093
- - If architecture exists, shard to `docs/architecture/` folder
1094
- - Results in multiple manageable documents and epic files
1193
+ 1. **Document Sharding** (CRITICAL STEP):
1194
+ - Documents created by PM/Architect (in Web or IDE) MUST be sharded for development
1195
+ - Two methods to shard:
1196
+ a) **Manual**: Drag `shard-doc` task + document file into chat
1197
+ b) **Agent**: Ask `@bmad-master` or `@po` to shard documents
1198
+ - Shards `docs/prd.md` → `docs/prd/` folder
1199
+ - Shards `docs/architecture.md` → `docs/architecture/` folder
1200
+ - **WARNING**: Do NOT shard in Web UI - copying many small files is painful!
1095
1201
 
1096
1202
  2. **Verify Sharded Content**:
1097
1203
  - At least one `epic-n.md` file in `docs/prd/` with stories in development order
@@ -1105,19 +1211,34 @@ that can handle [specific requirements]."
1105
1211
 
1106
1212
  3. **Development Cycle** (Sequential, one story at a time):
1107
1213
 
1108
- **Step 1 - Story Creation**: New chat window → `@sm` → `*create`
1214
+ **CRITICAL CONTEXT MANAGEMENT**:
1215
+ - **Context windows matter!** Always use fresh, clean context windows
1216
+ - **Model selection matters!** Use most powerful thinking model for SM story creation
1217
+ - **ALWAYS start new chat between SM, Dev, and QA work**
1218
+
1219
+ **Step 1 - Story Creation**:
1220
+ - **NEW CLEAN CHAT** → Select powerful model → `@sm` → `*create`
1109
1221
  - SM executes create-next-story task
1110
1222
  - Review generated story in `docs/stories/`
1111
1223
  - Update status from "Draft" to "Approved"
1112
1224
 
1113
- **Step 2 - Story Implementation**: New chat window → `@dev`
1225
+ **Step 2 - Story Implementation**:
1226
+ - **NEW CLEAN CHAT** → `@dev`
1114
1227
  - Agent asks which story to implement
1115
1228
  - Include story file content to save dev agent lookup time
1116
1229
  - Dev follows tasks/subtasks, marking completion
1117
- - Dev leaves notes for SM about any deviations
1118
- - Update status to "Done"
1230
+ - Dev maintains File List of all changes
1231
+ - Dev marks story as "Review" when complete with all tests passing
1232
+
1233
+ **Step 3 - Senior QA Review**:
1234
+ - **NEW CLEAN CHAT** → `@qa` → execute review-story task
1235
+ - QA performs senior developer code review
1236
+ - QA can refactor and improve code directly
1237
+ - QA appends results to story's QA Results section
1238
+ - If approved: Status → "Done"
1239
+ - If changes needed: Status stays "Review" with unchecked items for dev
1119
1240
 
1120
- **Step 3 - Repeat**: Continue SM → Dev cycle until all epic stories complete
1241
+ **Step 4 - Repeat**: Continue SM → Dev → QA cycle until all epic stories complete
1121
1242
 
1122
1243
  **Important**: Only 1 story in progress at a time, worked sequentially until all epic stories complete.
1123
1244
 
@@ -1137,12 +1258,72 @@ Each status change requires user verification and approval before proceeding.
1137
1258
  - Development execution
1138
1259
  - Testing and deployment
1139
1260
 
1140
- #### Brownfield Enhancement
1141
- - Current system analysis
1142
- - Enhancement planning
1143
- - Impact assessment
1144
- - Incremental development
1145
- - Integration testing
1261
+ #### Brownfield Enhancement (Existing Projects)
1262
+
1263
+ **Key Concept**: Brownfield development requires comprehensive documentation of your existing project for AI agents to understand context, patterns, and constraints.
1264
+
1265
+ **Complete Brownfield Workflow Options**:
1266
+
1267
+ **Option 1: PRD-First (Recommended for Large Codebases/Monorepos)**:
1268
+ 1. **Upload project to Gemini Web** (GitHub URL, files, or zip)
1269
+ 2. **Create PRD first**: `@pm` → `*create-doc brownfield-prd`
1270
+ 3. **Focused documentation**: `@analyst` → `*document-project`
1271
+ - Analyst asks for focus if no PRD provided
1272
+ - Choose "single document" format for Web UI
1273
+ - Uses PRD to document ONLY relevant areas
1274
+ - Creates one comprehensive markdown file
1275
+ - Avoids bloating docs with unused code
1276
+
1277
+ **Option 2: Document-First (Good for Smaller Projects)**:
1278
+ 1. **Upload project to Gemini Web**
1279
+ 2. **Document everything**: `@analyst` → `*document-project`
1280
+ 3. **Then create PRD**: `@pm` → `*create-doc brownfield-prd`
1281
+ - More thorough but can create excessive documentation
1282
+
1283
+ 2. **Requirements Gathering**:
1284
+ - **Brownfield PRD**: Use PM agent with `brownfield-prd-tmpl`
1285
+ - **Analyzes**: Existing system, constraints, integration points
1286
+ - **Defines**: Enhancement scope, compatibility requirements, risk assessment
1287
+ - **Creates**: Epic and story structure for changes
1288
+
1289
+ 3. **Architecture Planning**:
1290
+ - **Brownfield Architecture**: Use Architect agent with `brownfield-architecture-tmpl`
1291
+ - **Integration Strategy**: How new features integrate with existing system
1292
+ - **Migration Planning**: Gradual rollout and backwards compatibility
1293
+ - **Risk Mitigation**: Addressing potential breaking changes
1294
+
1295
+ **Brownfield-Specific Resources**:
1296
+
1297
+ **Templates**:
1298
+ - `brownfield-prd-tmpl.md`: Comprehensive enhancement planning with existing system analysis
1299
+ - `brownfield-architecture-tmpl.md`: Integration-focused architecture for existing systems
1300
+
1301
+ **Tasks**:
1302
+ - `document-project`: Generates comprehensive documentation from existing codebase
1303
+ - `brownfield-create-epic`: Creates single epic for focused enhancements (when full PRD is overkill)
1304
+ - `brownfield-create-story`: Creates individual story for small, isolated changes
1305
+
1306
+ **When to Use Each Approach**:
1307
+
1308
+ **Full Brownfield Workflow** (Recommended for):
1309
+ - Major feature additions
1310
+ - System modernization
1311
+ - Complex integrations
1312
+ - Multiple related changes
1313
+
1314
+ **Quick Epic/Story Creation** (Use when):
1315
+ - Single, focused enhancement
1316
+ - Isolated bug fixes
1317
+ - Small feature additions
1318
+ - Well-documented existing system
1319
+
1320
+ **Critical Success Factors**:
1321
+ 1. **Documentation First**: Always run `document-project` if docs are outdated/missing
1322
+ 2. **Context Matters**: Provide agents access to relevant code sections
1323
+ 3. **Integration Focus**: Emphasize compatibility and non-breaking changes
1324
+ 4. **Incremental Approach**: Plan for gradual rollout and testing
1325
+
1326
+ **For detailed guide**: See `docs/working-in-the-brownfield.md`
1146
1327
 
1147
1328
  ## Document Creation Best Practices
1148
1329
 
@@ -1223,12 +1404,94 @@ Use the `shard-doc` task or `@kayvan/markdown-tree-parser` tool for automatic sh
1223
1404
  - **Keep conversations focused** - One agent, one task per conversation
1224
1405
  - **Review everything** - Always review and approve before marking complete
1225
1406
 
1407
+ ## Contributing to BMAD-METHOD
1408
+
1409
+ ### Quick Contribution Guidelines
1410
+
1411
+ For full details, see `CONTRIBUTING.md`. Key points:
1412
+
1413
+ **Fork Workflow**:
1414
+ 1. Fork the repository
1415
+ 2. Create feature branches
1416
+ 3. Submit PRs to `next` branch (default) or `main` for critical fixes only
1417
+ 4. Keep PRs small: 200-400 lines ideal, 800 lines maximum
1418
+ 5. One feature/fix per PR
1419
+
1420
+ **PR Requirements**:
1421
+ - Clear descriptions (max 200 words) with What/Why/How/Testing
1422
+ - Use conventional commits (feat:, fix:, docs:)
1423
+ - Atomic commits - one logical change per commit
1424
+ - Must align with guiding principles
1425
+
1426
+ **Core Principles** (from GUIDING-PRINCIPLES.md):
1427
+ - **Dev Agents Must Be Lean**: Minimize dependencies, save context for code
1428
+ - **Natural Language First**: Everything in markdown, no code in core
1429
+ - **Core vs Expansion Packs**: Core for universal needs, packs for specialized domains
1430
+ - **Design Philosophy**: "Dev agents code, planning agents plan"
1431
+
1432
+ ## Expansion Packs
1433
+
1434
+ ### What Are Expansion Packs?
1435
+
1436
+ 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.
1437
+
1438
+ ### Why Use Expansion Packs?
1439
+
1440
+ 1. **Keep Core Lean**: Dev agents maintain maximum context for coding
1441
+ 2. **Domain Expertise**: Deep, specialized knowledge without bloating core
1442
+ 3. **Community Innovation**: Anyone can create and share packs
1443
+ 4. **Modular Design**: Install only what you need
1444
+
1445
+ ### Available Expansion Packs
1446
+
1447
+ **Technical Packs**:
1448
+ - **Infrastructure/DevOps**: Cloud architects, SRE experts, security specialists
1449
+ - **Game Development**: Game designers, level designers, narrative writers
1450
+ - **Mobile Development**: iOS/Android specialists, mobile UX experts
1451
+ - **Data Science**: ML engineers, data scientists, visualization experts
1452
+
1453
+ **Non-Technical Packs**:
1454
+ - **Business Strategy**: Consultants, financial analysts, marketing strategists
1455
+ - **Creative Writing**: Plot architects, character developers, world builders
1456
+ - **Health & Wellness**: Fitness trainers, nutritionists, habit engineers
1457
+ - **Education**: Curriculum designers, assessment specialists
1458
+ - **Legal Support**: Contract analysts, compliance checkers
1459
+
1460
+ **Specialty Packs**:
1461
+ - **Expansion Creator**: Tools to build your own expansion packs
1462
+ - **RPG Game Master**: Tabletop gaming assistance
1463
+ - **Life Event Planning**: Wedding planners, event coordinators
1464
+ - **Scientific Research**: Literature reviewers, methodology designers
1465
+
1466
+ ### Using Expansion Packs
1467
+
1468
+ 1. **Browse Available Packs**: Check `expansion-packs/` directory
1469
+ 2. **Get Inspiration**: See `docs/expansion-pack-ideas.md` for detailed examples
1470
+ 3. **Install via CLI**:
1471
+ ```bash
1472
+ npx bmad-method install
1473
+ # Select "Install expansion pack" option
1474
+ ```
1475
+ 4. **Use in Your Workflow**: Installed packs integrate seamlessly with existing agents
1476
+
1477
+ ### Creating Custom Expansion Packs
1478
+
1479
+ Use the **expansion-creator** pack to build your own:
1480
+
1481
+ 1. **Define Domain**: What expertise are you capturing?
1482
+ 2. **Design Agents**: Create specialized roles with clear boundaries
1483
+ 3. **Build Resources**: Tasks, templates, checklists for your domain
1484
+ 4. **Test & Share**: Validate with real use cases, share with community
1485
+
1486
+ **Key Principle**: Expansion packs democratize expertise by making specialized knowledge accessible through AI agents.
1487
+
1226
1488
  ## Getting Help
1227
1489
 
1228
1490
  - **Commands**: Use `/help` in any environment to see available commands
1229
1491
  - **Agent Switching**: Use `/switch agent-name` with orchestrator for role changes
1230
1492
  - **Documentation**: Check `docs/` folder for project-specific context
1231
1493
  - **Community**: Discord and GitHub resources available for support
1494
+ - **Contributing**: See `CONTRIBUTING.md` for full guidelines
1232
1495
  ==================== END: data#bmad-kb ====================
1233
1496
 
1234
1497
  ==================== START: utils#workflow-management ====================
@@ -2031,6 +2294,326 @@ Present these numbered options to the user:
2031
2294
  - Plan for iterative refinement based on initial findings
2032
2295
  ==================== END: tasks#create-deep-research-prompt ====================
2033
2296
 
2297
+ ==================== START: tasks#document-project ====================
2298
+ # Document an Existing Project
2299
+
2300
+ ## Purpose
2301
+
2302
+ Generate comprehensive documentation for existing projects optimized for AI development agents. This task creates structured reference materials that enable AI agents to understand project context, conventions, and patterns for effective contribution to any codebase.
2303
+
2304
+ ## Task Instructions
2305
+
2306
+ ### 1. Initial Project Analysis
2307
+
2308
+ [[LLM: First, check if a PRD or requirements document exists in context. If yes, use it to focus your documentation efforts on relevant areas only.
2309
+
2310
+ **IF PRD EXISTS**:
2311
+
2312
+ - Review the PRD to understand what enhancement/feature is planned
2313
+ - Identify which modules, services, or areas will be affected
2314
+ - Focus documentation ONLY on these relevant areas
2315
+ - Skip unrelated parts of the codebase to keep docs lean
2316
+
2317
+ **IF NO PRD EXISTS**:
2318
+ Ask the user:
2319
+
2320
+ "I notice you haven't provided a PRD or requirements document. To create more focused and useful documentation, I recommend one of these options:
2321
+
2322
+ 1. **Create a PRD first** - Would you like me to help create a brownfield PRD before documenting? This helps focus documentation on relevant areas.
2323
+
2324
+ 2. **Provide existing requirements** - Do you have a requirements document, epic, or feature description you can share?
2325
+
2326
+ 3. **Describe the focus** - Can you briefly describe what enhancement or feature you're planning? For example:
2327
+ - 'Adding payment processing to the user service'
2328
+ - 'Refactoring the authentication module'
2329
+ - 'Integrating with a new third-party API'
2330
+
2331
+ 4. **Document everything** - Or should I proceed with comprehensive documentation of the entire codebase? (Note: This may create excessive documentation for large projects)
2332
+
2333
+ Please let me know your preference, or I can proceed with full documentation if you prefer."
2334
+
2335
+ Based on their response:
2336
+
2337
+ - If they choose option 1-3: Use that context to focus documentation
2338
+ - If they choose option 4 or decline: Proceed with comprehensive analysis below
2339
+
2340
+ Begin by conducting analysis of the existing project. Use available tools to:
2341
+
2342
+ 1. **Project Structure Discovery**: Examine the root directory structure, identify main folders, and understand the overall organization
2343
+ 2. **Technology Stack Identification**: Look for package.json, requirements.txt, Cargo.toml, pom.xml, etc. to identify languages, frameworks, and dependencies
2344
+ 3. **Build System Analysis**: Find build scripts, CI/CD configurations, and development commands
2345
+ 4. **Existing Documentation Review**: Check for README files, docs folders, and any existing documentation
2346
+ 5. **Code Pattern Analysis**: Sample key files to understand coding patterns, naming conventions, and architectural approaches
2347
+
2348
+ Ask the user these elicitation questions to better understand their needs:
2349
+
2350
+ - What is the primary purpose of this project?
2351
+ - Are there any specific areas of the codebase that are particularly complex or important for agents to understand?
2352
+ - What types of tasks do you expect AI agents to perform on this project? (e.g., bug fixes, feature additions, refactoring, testing)
2353
+ - Are there any existing documentation standards or formats you prefer?
2354
+ - What level of technical detail should the documentation target? (junior developers, senior developers, mixed team)
2355
+ - Is there a specific feature or enhancement you're planning? (This helps focus documentation)
2356
+ ]]
2357
+
2358
+ ### 2. Deep Codebase Analysis
2359
+
2360
+ [[LLM: Before generating documentation, conduct extensive analysis of the existing codebase:
2361
+
2362
+ 1. **Explore Key Areas**:
2363
+ - Entry points (main files, index files, app initializers)
2364
+ - Configuration files and environment setup
2365
+ - Package dependencies and versions
2366
+ - Build and deployment configurations
2367
+ - Test suites and coverage
2368
+
2369
+ 2. **Ask Clarifying Questions**:
2370
+ - "I see you're using [technology X]. Are there any custom patterns or conventions I should document?"
2371
+ - "What are the most critical/complex parts of this system that developers struggle with?"
2372
+ - "Are there any undocumented 'tribal knowledge' areas I should capture?"
2373
+ - "What technical debt or known issues should I document?"
2374
+ - "Which parts of the codebase change most frequently?"
2375
+
2376
+ 3. **Map the Reality**:
2377
+ - Identify ACTUAL patterns used (not theoretical best practices)
2378
+ - Find where key business logic lives
2379
+ - Locate integration points and external dependencies
2380
+ - Document workarounds and technical debt
2381
+ - Note areas that differ from standard patterns
2382
+
2383
+ **IF PRD PROVIDED**: Also analyze what would need to change for the enhancement]]
2384
+
2385
+ ### 3. Core Documentation Generation
2386
+
2387
+ [[LLM: Generate a comprehensive BROWNFIELD architecture document that reflects the ACTUAL state of the codebase.
2388
+
2389
+ **CRITICAL**: This is NOT an aspirational architecture document. Document what EXISTS, including:
2390
+ - Technical debt and workarounds
2391
+ - Inconsistent patterns between different parts
2392
+ - Legacy code that can't be changed
2393
+ - Integration constraints
2394
+ - Performance bottlenecks
2395
+
2396
+ **Document Structure**:
2397
+
2398
+ # [Project Name] Brownfield Architecture Document
2399
+
2400
+ ## Introduction
2401
+ This document captures the CURRENT STATE of the [Project Name] codebase, including technical debt, workarounds, and real-world patterns. It serves as a reference for AI agents working on enhancements.
2402
+
2403
+ ### Document Scope
2404
+ [If PRD provided: "Focused on areas relevant to: {enhancement description}"]
2405
+ [If no PRD: "Comprehensive documentation of entire system"]
2406
+
2407
+ ### Change Log
2408
+ | Date | Version | Description | Author |
2409
+ |------|---------|-------------|--------|
2410
+ | [Date] | 1.0 | Initial brownfield analysis | [Analyst] |
2411
+
2412
+ ## Quick Reference - Key Files and Entry Points
2413
+
2414
+ ### Critical Files for Understanding the System
2415
+ - **Main Entry**: `src/index.js` (or actual entry point)
2416
+ - **Configuration**: `config/app.config.js`, `.env.example`
2417
+ - **Core Business Logic**: `src/services/`, `src/domain/`
2418
+ - **API Definitions**: `src/routes/` or link to OpenAPI spec
2419
+ - **Database Models**: `src/models/` or link to schema files
2420
+ - **Key Algorithms**: [List specific files with complex logic]
2421
+
2422
+ ### If PRD Provided - Enhancement Impact Areas
2423
+ [Highlight which files/modules will be affected by the planned enhancement]
2424
+
2425
+ ## High Level Architecture
2426
+
2427
+ ### Technical Summary
2428
+ [Real assessment of architecture - mention if it's well-structured or has issues]
2429
+
2430
+ ### Actual Tech Stack (from package.json/requirements.txt)
2431
+ | Category | Technology | Version | Notes |
2432
+ |----------|------------|---------|--------|
2433
+ | Runtime | Node.js | 16.x | [Any constraints] |
2434
+ | Framework | Express | 4.18.2 | [Custom middleware?] |
2435
+ | Database | PostgreSQL | 13 | [Connection pooling setup] |
2436
+ | [etc...] |
2437
+
2438
+ ### Repository Structure Reality Check
2439
+ - Type: [Monorepo/Polyrepo/Hybrid]
2440
+ - Package Manager: [npm/yarn/pnpm]
2441
+ - Notable: [Any unusual structure decisions]
2442
+
2443
+ ## Source Tree and Module Organization
2444
+
2445
+ ### Project Structure (Actual)
2446
+ ```
2447
+ project-root/
2448
+ ├── src/
2449
+ │ ├── controllers/ # HTTP request handlers
2450
+ │ ├── services/ # Business logic (NOTE: inconsistent patterns between user and payment services)
2451
+ │ ├── models/ # Database models (Sequelize)
2452
+ │ ├── utils/ # Mixed bag - needs refactoring
2453
+ │ └── legacy/ # DO NOT MODIFY - old payment system still in use
2454
+ ├── tests/ # Jest tests (60% coverage)
2455
+ ├── scripts/ # Build and deployment scripts
2456
+ └── config/ # Environment configs
2457
+ ```
2458
+
2459
+ ### Key Modules and Their Purpose
2460
+ - **User Management**: `src/services/userService.js` - Handles all user operations
2461
+ - **Authentication**: `src/middleware/auth.js` - JWT-based, custom implementation
2462
+ - **Payment Processing**: `src/legacy/payment.js` - CRITICAL: Do not refactor, tightly coupled
2463
+ - **[List other key modules with their actual files]**
2464
+
2465
+ ## Data Models and APIs
2466
+
2467
+ ### Data Models
2468
+ Instead of duplicating, reference actual model files:
2469
+ - **User Model**: See `src/models/User.js`
2470
+ - **Order Model**: See `src/models/Order.js`
2471
+ - **Related Types**: TypeScript definitions in `src/types/`
2472
+
2473
+ ### API Specifications
2474
+ - **OpenAPI Spec**: `docs/api/openapi.yaml` (if exists)
2475
+ - **Postman Collection**: `docs/api/postman-collection.json`
2476
+ - **Manual Endpoints**: [List any undocumented endpoints discovered]
2477
+
2478
+ ## Technical Debt and Known Issues
2479
+
2480
+ ### Critical Technical Debt
2481
+ 1. **Payment Service**: Legacy code in `src/legacy/payment.js` - tightly coupled, no tests
2482
+ 2. **User Service**: Different pattern than other services, uses callbacks instead of promises
2483
+ 3. **Database Migrations**: Manually tracked, no proper migration tool
2484
+ 4. **[Other significant debt]**
2485
+
2486
+ ### Workarounds and Gotchas
2487
+ - **Environment Variables**: Must set `NODE_ENV=production` even for staging (historical reason)
2488
+ - **Database Connections**: Connection pool hardcoded to 10, changing breaks payment service
2489
+ - **[Other workarounds developers need to know]**
2490
+
2491
+ ## Integration Points and External Dependencies
2492
+
2493
+ ### External Services
2494
+ | Service | Purpose | Integration Type | Key Files |
2495
+ |---------|---------|------------------|-----------|
2496
+ | Stripe | Payments | REST API | `src/integrations/stripe/` |
2497
+ | SendGrid | Emails | SDK | `src/services/emailService.js` |
2498
+ | [etc...] |
2499
+
2500
+ ### Internal Integration Points
2501
+ - **Frontend Communication**: REST API on port 3000, expects specific headers
2502
+ - **Background Jobs**: Redis queue, see `src/workers/`
2503
+ - **[Other integrations]**
2504
+
2505
+ ## Development and Deployment
2506
+
2507
+ ### Local Development Setup
2508
+ 1. Actual steps that work (not ideal steps)
2509
+ 2. Known issues with setup
2510
+ 3. Required environment variables (see `.env.example`)
2511
+
2512
+ ### Build and Deployment Process
2513
+ - **Build Command**: `npm run build` (webpack config in `webpack.config.js`)
2514
+ - **Deployment**: Manual deployment via `scripts/deploy.sh`
2515
+ - **Environments**: Dev, Staging, Prod (see `config/environments/`)
2516
+
2517
+ ## Testing Reality
2518
+
2519
+ ### Current Test Coverage
2520
+ - Unit Tests: 60% coverage (Jest)
2521
+ - Integration Tests: Minimal, in `tests/integration/`
2522
+ - E2E Tests: None
2523
+ - Manual Testing: Primary QA method
2524
+
2525
+ ### Running Tests
2526
+ ```bash
2527
+ npm test # Runs unit tests
2528
+ npm run test:integration # Runs integration tests (requires local DB)
2529
+ ```
2530
+
2531
+ ## If Enhancement PRD Provided - Impact Analysis
2532
+
2533
+ ### Files That Will Need Modification
2534
+ Based on the enhancement requirements, these files will be affected:
2535
+ - `src/services/userService.js` - Add new user fields
2536
+ - `src/models/User.js` - Update schema
2537
+ - `src/routes/userRoutes.js` - New endpoints
2538
+ - [etc...]
2539
+
2540
+ ### New Files/Modules Needed
2541
+ - `src/services/newFeatureService.js` - New business logic
2542
+ - `src/models/NewFeature.js` - New data model
2543
+ - [etc...]
2544
+
2545
+ ### Integration Considerations
2546
+ - Will need to integrate with existing auth middleware
2547
+ - Must follow existing response format in `src/utils/responseFormatter.js`
2548
+ - [Other integration points]
2549
+
2550
+ ## Appendix - Useful Commands and Scripts
2551
+
2552
+ ### Frequently Used Commands
2553
+ ```bash
2554
+ npm run dev # Start development server
2555
+ npm run build # Production build
2556
+ npm run migrate # Run database migrations
2557
+ npm run seed # Seed test data
2558
+ ```
2559
+
2560
+ ### Debugging and Troubleshooting
2561
+ - **Logs**: Check `logs/app.log` for application logs
2562
+ - **Debug Mode**: Set `DEBUG=app:*` for verbose logging
2563
+ - **Common Issues**: See `docs/troubleshooting.md`]]
2564
+
2565
+ ### 4. Document Delivery
2566
+
2567
+ [[LLM: After generating the complete architecture document:
2568
+
2569
+ 1. **In Web UI (Gemini, ChatGPT, Claude)**:
2570
+ - Present the entire document in one response (or multiple if too long)
2571
+ - Tell user to copy and save as `docs/brownfield-architecture.md` or `docs/project-architecture.md`
2572
+ - Mention it can be sharded later in IDE if needed
2573
+
2574
+ 2. **In IDE Environment**:
2575
+ - Create the document as `docs/brownfield-architecture.md`
2576
+ - Inform user this single document contains all architectural information
2577
+ - Can be sharded later using PO agent if desired
2578
+
2579
+ The document should be comprehensive enough that future agents can understand:
2580
+ - The actual state of the system (not idealized)
2581
+ - Where to find key files and logic
2582
+ - What technical debt exists
2583
+ - What constraints must be respected
2584
+ - If PRD provided: What needs to change for the enhancement]]
2585
+
2586
+ ### 5. Quality Assurance
2587
+
2588
+ [[LLM: Before finalizing the document:
2589
+
2590
+ 1. **Accuracy Check**: Verify all technical details match the actual codebase
2591
+ 2. **Completeness Review**: Ensure all major system components are documented
2592
+ 3. **Focus Validation**: If user provided scope, verify relevant areas are emphasized
2593
+ 4. **Clarity Assessment**: Check that explanations are clear for AI agents
2594
+ 5. **Navigation**: Ensure document has clear section structure for easy reference
2595
+
2596
+ Apply the advanced elicitation task after major sections to refine based on user feedback.]]
2597
+
2598
+ ## Success Criteria
2599
+
2600
+ - Single comprehensive brownfield architecture document created
2601
+ - Document reflects REALITY including technical debt and workarounds
2602
+ - Key files and modules are referenced with actual paths
2603
+ - Models/APIs reference source files rather than duplicating content
2604
+ - If PRD provided: Clear impact analysis showing what needs to change
2605
+ - Document enables AI agents to navigate and understand the actual codebase
2606
+ - Technical constraints and "gotchas" are clearly documented
2607
+
2608
+ ## Notes
2609
+
2610
+ - This task creates ONE document that captures the TRUE state of the system
2611
+ - References actual files rather than duplicating content when possible
2612
+ - Documents technical debt, workarounds, and constraints honestly
2613
+ - For brownfield projects with PRD: Provides clear enhancement impact analysis
2614
+ - The goal is PRACTICAL documentation for AI agents doing real work
2615
+ ==================== END: tasks#document-project ====================
2616
+
2034
2617
  ==================== START: templates#project-brief-tmpl ====================
2035
2618
  # Project Brief: {{Project Name}}
2036
2619
 
@@ -3322,9 +3905,27 @@ The LLM will:
3322
3905
  - Create a folder structure to organize the sharded documents
3323
3906
  - Maintain all content integrity including code blocks, diagrams, and markdown formatting
3324
3907
 
3325
- ## Recommended Method: @kayvan/markdown-tree-parser
3908
+ ## Primary Method: Automatic with markdown-tree
3909
+
3910
+ [[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}`.
3326
3911
 
3327
- [[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.]]
3912
+ If the command succeeds, inform the user that the document has been sharded successfully and STOP - do not proceed further.
3913
+
3914
+ 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:
3915
+
3916
+ 1. Install @kayvan/markdown-tree-parser globally with: `npm install -g @kayvan/markdown-tree-parser`
3917
+ 2. Or set markdownExploder to false in bmad-core/core-config.yml
3918
+
3919
+ **IMPORTANT: STOP HERE - do not proceed with manual sharding until one of the above actions is taken.**"
3920
+
3921
+ If markdownExploder is set to false, inform the user: "The markdownExploder setting is currently false. For better performance and reliability, you should:
3922
+
3923
+ 1. Set markdownExploder to true in bmad-core/core-config.yml
3924
+ 2. Install @kayvan/markdown-tree-parser globally with: `npm install -g @kayvan/markdown-tree-parser`
3925
+
3926
+ I will now proceed with the manual sharding process."
3927
+
3928
+ Then proceed with the manual method below ONLY if markdownExploder is false.]]
3328
3929
 
3329
3930
  ### Installation and Usage
3330
3931
 
@@ -3357,19 +3958,19 @@ If the user has @kayvan/markdown-tree-parser installed, use it and skip the manu
3357
3958
 
3358
3959
  ---
3359
3960
 
3360
- ## Manual Method (if @kayvan/markdown-tree-parser is not available)
3961
+ ## Manual Method (if @kayvan/markdown-tree-parser is not available or user indicated manual method)
3361
3962
 
3362
3963
  [[LLM: Only proceed with the manual instructions below if the user cannot or does not want to use @kayvan/markdown-tree-parser.]]
3363
3964
 
3364
3965
  ### Task Instructions
3365
3966
 
3366
- ### 1. Identify Document and Target Location
3967
+ 1. Identify Document and Target Location
3367
3968
 
3368
3969
  - Determine which document to shard (user-provided path)
3369
3970
  - Create a new folder under `docs/` with the same name as the document (without extension)
3370
3971
  - Example: `docs/prd.md` → create folder `docs/prd/`
3371
3972
 
3372
- ### 2. Parse and Extract Sections
3973
+ 2. Parse and Extract Sections
3373
3974
 
3374
3975
  [[LLM: When sharding the document:
3375
3976
 
@@ -3379,7 +3980,7 @@ If the user has @kayvan/markdown-tree-parser installed, use it and skip the manu
3379
3980
  - Extract the section heading and ALL content until the next level 2 section
3380
3981
  - Include all subsections, code blocks, diagrams, lists, tables, etc.
3381
3982
  - Be extremely careful with:
3382
- - Fenced code blocks (```) - ensure you capture the full block including closing backticks
3983
+ - 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
3383
3984
  - Mermaid diagrams - preserve the complete diagram syntax
3384
3985
  - Nested markdown elements
3385
3986
  - Multi-line content that might contain ## inside code blocks
@@ -3398,7 +3999,7 @@ For each extracted section:
3398
3999
 
3399
4000
  2. **Adjust heading levels**:
3400
4001
 
3401
- - The level 2 heading becomes level 1 (# instead of ##)
4002
+ - The level 2 heading becomes level 1 (# instead of ##) in the sharded new document
3402
4003
  - All subsection levels decrease by 1:
3403
4004
 
3404
4005
  ```txt
@@ -4978,398 +5579,6 @@ After presenting this section, apply `tasks#advanced-elicitation` protocol]]
4978
5579
  [[LLM: If a UI/UX checklist exists, run it against this document and report results here.]]
4979
5580
  ==================== END: templates#front-end-spec-tmpl ====================
4980
5581
 
4981
- ==================== START: tasks#document-project ====================
4982
- # Document an Existing Project
4983
-
4984
- ## Purpose
4985
-
4986
- Generate comprehensive documentation for existing projects optimized for AI development agents. This task creates structured reference materials that enable AI agents to understand project context, conventions, and patterns for effective contribution to any codebase.
4987
-
4988
- ## Task Instructions
4989
-
4990
- ### 1. Initial Project Analysis
4991
-
4992
- [[LLM: Begin by conducting a comprehensive analysis of the existing project. Use available tools to:
4993
-
4994
- 1. **Project Structure Discovery**: Examine the root directory structure, identify main folders, and understand the overall organization
4995
- 2. **Technology Stack Identification**: Look for package.json, requirements.txt, Cargo.toml, pom.xml, etc. to identify languages, frameworks, and dependencies
4996
- 3. **Build System Analysis**: Find build scripts, CI/CD configurations, and development commands
4997
- 4. **Existing Documentation Review**: Check for README files, docs folders, and any existing documentation
4998
- 5. **Code Pattern Analysis**: Sample key files to understand coding patterns, naming conventions, and architectural approaches
4999
-
5000
- Ask the user these elicitation questions to better understand their needs:
5001
-
5002
- - What is the primary purpose of this project?
5003
- - Are there any specific areas of the codebase that are particularly complex or important for agents to understand?
5004
- - What types of tasks do you expect AI agents to perform on this project? (e.g., bug fixes, feature additions, refactoring, testing)
5005
- - Are there any existing documentation standards or formats you prefer?
5006
- - What level of technical detail should the documentation target? (junior developers, senior developers, mixed team)
5007
- ]]
5008
-
5009
- ### 2. Core Documentation Generation
5010
-
5011
- [[LLM: Based on your analysis, generate the following core documentation files. Adapt the content and structure to match the specific project type and context you discovered:
5012
-
5013
- **Core Documents (always generate):**
5014
-
5015
- 1. **docs/index.md** - Master documentation index
5016
- 2. **docs/architecture/index.md** - Architecture documentation index
5017
- 3. **docs/architecture/coding-standards.md** - Coding conventions and style guidelines
5018
- 4. **docs/architecture/tech-stack.md** - Technology stack and version constraints
5019
- 5. **docs/architecture/unified-project-structure.md** - Project structure and organization
5020
- 6. **docs/architecture/testing-strategy.md** - Testing approaches and requirements
5021
-
5022
- **Backend Documents (generate for backend/full-stack projects):**
5023
-
5024
- 7. **docs/architecture/backend-architecture.md** - Backend service patterns and structure
5025
- 8. **docs/architecture/rest-api-spec.md** - API endpoint specifications
5026
- 9. **docs/architecture/data-models.md** - Data structures and validation rules
5027
- 10. **docs/architecture/database-schema.md** - Database design and relationships
5028
- 11. **docs/architecture/external-apis.md** - Third-party integrations
5029
-
5030
- **Frontend Documents (generate for frontend/full-stack projects):**
5031
-
5032
- 12. **docs/architecture/frontend-architecture.md** - Frontend patterns and structure
5033
- 13. **docs/architecture/components.md** - UI component specifications
5034
- 14. **docs/architecture/core-workflows.md** - User interaction flows
5035
- 15. **docs/architecture/ui-ux-spec.md** - UI/UX specifications and guidelines
5036
-
5037
- **Additional Documents (generate if applicable):**
5038
-
5039
- 16. **docs/prd.md** - Product requirements document (if not exists)
5040
- 17. **docs/architecture/deployment-guide.md** - Deployment and operations info
5041
- 18. **docs/architecture/security-considerations.md** - Security patterns and requirements
5042
- 19. **docs/architecture/performance-guidelines.md** - Performance optimization patterns
5043
-
5044
- **Optional Enhancement Documents:**
5045
-
5046
- 20. **docs/architecture/troubleshooting-guide.md** - Common issues and solutions
5047
- 21. **docs/architecture/changelog-conventions.md** - Change management practices
5048
- 22. **docs/architecture/code-review-checklist.md** - Review standards and practices
5049
-
5050
- Present each document section by section, using the advanced elicitation task after each major section.]]
5051
-
5052
- ### 3. Document Structure Template
5053
-
5054
- [[LLM: Use this standardized structure for each documentation file, adapting content as needed:
5055
-
5056
- ```markdown
5057
- # {{Document Title}}
5058
-
5059
- ## Overview
5060
-
5061
- {{Brief description of what this document covers and why it's important for AI agents}}
5062
-
5063
- ## Quick Reference
5064
-
5065
- {{Key points, commands, or patterns that agents need most frequently}}
5066
-
5067
- ## Detailed Information
5068
-
5069
- {{Comprehensive information organized into logical sections}}
5070
-
5071
- ## Examples
5072
-
5073
- {{Concrete examples showing proper usage or implementation}}
5074
-
5075
- ## Common Patterns
5076
-
5077
- {{Recurring patterns agents should recognize and follow}}
5078
-
5079
- ## Things to Avoid
5080
-
5081
- {{Anti-patterns, deprecated approaches, or common mistakes}}
5082
-
5083
- ## Related Resources
5084
-
5085
- {{Links to other relevant documentation or external resources}}
5086
- ```
5087
-
5088
- Each document should be:
5089
-
5090
- - **Concrete and actionable** - Focus on what agents need to do, not just concepts
5091
- - **Pattern-focused** - Highlight recurring patterns agents can recognize and replicate
5092
- - **Example-rich** - Include specific code examples and real file references
5093
- - **Context-aware** - Reference actual project files, folders, and conventions
5094
- - **Assumption-free** - Don't assume agents know project history or implicit knowledge
5095
- ]]
5096
-
5097
- ### 4. Content Guidelines for Each Document Type
5098
-
5099
- #### Core Architecture Documents
5100
-
5101
- ##### docs/architecture/index.md
5102
-
5103
- [[LLM: Create a comprehensive index of all architecture documentation:
5104
-
5105
- - List all architecture documents with brief descriptions
5106
- - Group documents by category (backend, frontend, shared)
5107
- - Include quick links to key sections
5108
- - Provide reading order recommendations for different use cases]]
5109
-
5110
- ##### docs/architecture/unified-project-structure.md
5111
-
5112
- [[LLM: Document the complete project structure:
5113
-
5114
- - Root-level directory structure with explanations
5115
- - Where each type of code belongs (backend, frontend, tests, etc.)
5116
- - File naming conventions and patterns
5117
- - Module/package organization
5118
- - Generated vs. source file locations
5119
- - Build output locations]]
5120
-
5121
- ##### docs/architecture/coding-standards.md
5122
-
5123
- [[LLM: Capture project-wide coding conventions:
5124
-
5125
- - Language-specific style guidelines
5126
- - Naming conventions (variables, functions, classes, files)
5127
- - Code organization within files
5128
- - Import/export patterns
5129
- - Comment and documentation standards
5130
- - Linting and formatting tool configurations
5131
- - Git commit message conventions]]
5132
-
5133
- ##### docs/architecture/tech-stack.md
5134
-
5135
- [[LLM: Document all technologies and versions:
5136
-
5137
- - Primary languages and versions
5138
- - Frameworks and major libraries with versions
5139
- - Development tools and their versions
5140
- - Database systems and versions
5141
- - External services and APIs used
5142
- - Browser/runtime requirements]]
5143
-
5144
- ##### docs/architecture/testing-strategy.md
5145
-
5146
- [[LLM: Define testing approaches and requirements:
5147
-
5148
- - Test file locations and naming conventions
5149
- - Unit testing patterns and frameworks
5150
- - Integration testing approaches
5151
- - E2E testing setup (if applicable)
5152
- - Test coverage requirements
5153
- - Mocking strategies
5154
- - Test data management]]
5155
-
5156
- #### Backend Architecture Documents
5157
-
5158
- ##### docs/architecture/backend-architecture.md
5159
-
5160
- [[LLM: Document backend service structure:
5161
-
5162
- - Service layer organization
5163
- - Controller/route patterns
5164
- - Middleware architecture
5165
- - Authentication/authorization patterns
5166
- - Request/response flow
5167
- - Background job processing
5168
- - Service communication patterns]]
5169
-
5170
- ##### docs/architecture/rest-api-spec.md
5171
-
5172
- [[LLM: Specify all API endpoints:
5173
-
5174
- - Base URL and versioning strategy
5175
- - Authentication methods
5176
- - Common headers and parameters
5177
- - Each endpoint with:
5178
- - HTTP method and path
5179
- - Request parameters/body
5180
- - Response format and status codes
5181
- - Error responses
5182
- - Rate limiting and quotas]]
5183
-
5184
- ##### docs/architecture/data-models.md
5185
-
5186
- [[LLM: Define data structures and validation:
5187
-
5188
- - Core business entities
5189
- - Data validation rules
5190
- - Relationships between entities
5191
- - Computed fields and derivations
5192
- - Data transformation patterns
5193
- - Serialization formats]]
5194
-
5195
- ##### docs/architecture/database-schema.md
5196
-
5197
- [[LLM: Document database design:
5198
-
5199
- - Database type and version
5200
- - Table/collection structures
5201
- - Indexes and constraints
5202
- - Relationships and foreign keys
5203
- - Migration patterns
5204
- - Seed data requirements
5205
- - Backup and recovery procedures]]
5206
-
5207
- ##### docs/architecture/external-apis.md
5208
-
5209
- [[LLM: Document third-party integrations:
5210
-
5211
- - List of external services used
5212
- - Authentication methods for each
5213
- - API endpoints and usage patterns
5214
- - Rate limits and quotas
5215
- - Error handling strategies
5216
- - Webhook configurations
5217
- - Data synchronization patterns]]
5218
-
5219
- #### Frontend Architecture Documents
5220
-
5221
- ##### docs/architecture/frontend-architecture.md
5222
-
5223
- [[LLM: Document frontend application structure:
5224
-
5225
- - Component hierarchy and organization
5226
- - State management patterns
5227
- - Routing architecture
5228
- - Data fetching patterns
5229
- - Authentication flow
5230
- - Error boundary strategies
5231
- - Performance optimization patterns]]
5232
-
5233
- ##### docs/architecture/components.md
5234
-
5235
- [[LLM: Specify UI components:
5236
-
5237
- - Component library/design system used
5238
- - Custom component specifications
5239
- - Props and state for each component
5240
- - Component composition patterns
5241
- - Styling approaches
5242
- - Accessibility requirements
5243
- - Component testing patterns]]
5244
-
5245
- ##### docs/architecture/core-workflows.md
5246
-
5247
- [[LLM: Document user interaction flows:
5248
-
5249
- - Major user journeys
5250
- - Screen flow diagrams
5251
- - Form handling patterns
5252
- - Navigation patterns
5253
- - Data flow through workflows
5254
- - Error states and recovery
5255
- - Loading and transition states]]
5256
-
5257
- ##### docs/architecture/ui-ux-spec.md
5258
-
5259
- [[LLM: Define UI/UX guidelines:
5260
-
5261
- - Design system specifications
5262
- - Color palette and typography
5263
- - Spacing and layout grids
5264
- - Responsive breakpoints
5265
- - Animation and transition guidelines
5266
- - Accessibility standards
5267
- - Browser compatibility requirements]]
5268
-
5269
- ### 5. Adaptive Content Strategy
5270
-
5271
- [[LLM: Adapt your documentation approach based on project characteristics:
5272
-
5273
- **For Web Applications:**
5274
-
5275
- - Focus on component patterns, routing, state management
5276
- - Include build processes, asset handling, and deployment
5277
- - Cover API integration patterns and data fetching
5278
-
5279
- **For Backend Services:**
5280
-
5281
- - Emphasize service architecture, data models, and API design
5282
- - Include database interaction patterns and migration strategies
5283
- - Cover authentication, authorization, and security patterns
5284
-
5285
- **For CLI Tools:**
5286
-
5287
- - Focus on command structure, argument parsing, and output formatting
5288
- - Include plugin/extension patterns if applicable
5289
- - Cover configuration file handling and user interaction patterns
5290
-
5291
- **For Libraries/Frameworks:**
5292
-
5293
- - Emphasize public API design and usage patterns
5294
- - Include extension points and customization approaches
5295
- - Cover versioning, compatibility, and migration strategies
5296
-
5297
- **For Mobile Applications:**
5298
-
5299
- - Focus on platform-specific patterns and navigation
5300
- - Include state management and data persistence approaches
5301
- - Cover platform integration and native feature usage
5302
-
5303
- **For Data Science/ML Projects:**
5304
-
5305
- - Emphasize data pipeline patterns and model organization
5306
- - Include experiment tracking and reproducibility approaches
5307
- - Cover data validation and model deployment patterns
5308
- ]]
5309
-
5310
- ### 6. Quality Assurance
5311
-
5312
- [[LLM: Before completing each document:
5313
-
5314
- 1. **Accuracy Check**: Verify all file paths, commands, and code examples work
5315
- 2. **Completeness Review**: Ensure the document covers the most important patterns an agent would encounter
5316
- 3. **Clarity Assessment**: Check that explanations are clear and actionable
5317
- 4. **Consistency Verification**: Ensure terminology and patterns align across all documents
5318
- 5. **Agent Perspective**: Review from the viewpoint of an AI agent that needs to contribute to this project
5319
-
5320
- Ask the user to review each completed document and use the advanced elicitation task to refine based on their feedback.]]
5321
-
5322
- ### 7. Final Integration
5323
-
5324
- [[LLM: After all documents are completed:
5325
-
5326
- 1. Ensure all documents are created in the proper BMAD-expected locations:
5327
-
5328
- - Core docs in `docs/` (index.md, prd.md)
5329
- - Architecture shards in `docs/architecture/` subdirectory
5330
- - Create the `docs/architecture/` directory if it doesn't exist
5331
-
5332
- 2. Create/update the master index documents:
5333
-
5334
- - Update `docs/index.md` to reference all documentation
5335
- - Create `docs/architecture/index.md` listing all architecture shards
5336
-
5337
- 3. Verify document cross-references:
5338
-
5339
- - Ensure all documents link to related documentation
5340
- - Check that file paths match the actual project structure
5341
- - Validate that examples reference real files in the project
5342
-
5343
- 4. Provide maintenance guidance:
5344
-
5345
- - Document update triggers (when to update each doc)
5346
- - Create a simple checklist for keeping docs current
5347
- - Suggest automated validation approaches
5348
-
5349
- 5. Summary report including:
5350
- - List of all documents created with their paths
5351
- - Any gaps or areas needing human review
5352
- - Recommendations for project-specific additions
5353
- - Next steps for maintaining documentation accuracy
5354
-
5355
- Present a summary of what was created and ask if any additional documentation would be helpful for AI agents working on this specific project.]]
5356
-
5357
- ## Success Criteria
5358
-
5359
- - Documentation enables AI agents to understand project context without additional explanation
5360
- - All major architectural patterns and coding conventions are captured
5361
- - Examples reference actual project files and demonstrate real usage
5362
- - Documentation is structured consistently and easy to navigate
5363
- - Content is actionable and focuses on what agents need to do, not just understand
5364
-
5365
- ## Notes
5366
-
5367
- - This task is designed to work with any project type, language, or framework
5368
- - The documentation should reflect the project as it actually is, not as it should be
5369
- - Focus on patterns that agents can recognize and replicate consistently
5370
- - Include both positive examples (what to do) and negative examples (what to avoid)
5371
- ==================== END: tasks#document-project ====================
5372
-
5373
5582
  ==================== START: templates#architecture-tmpl ====================
5374
5583
  # {{Project Name}} Architecture Document
5375
5584
 
@@ -8396,6 +8605,10 @@ Manual Test Steps: [[LLM: Include how if possible the user can manually test the
8396
8605
  [[LLM: (SM Agent) When Drafting Story, leave next prompt in place for dev agent to remove and update - remove this line to the SM]]
8397
8606
  [[LLM: (Dev Agent) Anything the SM needs to know that deviated from the story that might impact drafting the next story.]]
8398
8607
 
8608
+ ### File List
8609
+
8610
+ [[LLM: (Dev Agent) List every new file created, or existing file modified in a bullet list.]]
8611
+
8399
8612
  ### Change Log
8400
8613
 
8401
8614
  [[LLM: (SM Agent) When Drafting Story, leave next prompt in place for dev agent to remove and update- remove this line to the SM]]
@@ -8403,6 +8616,10 @@ Manual Test Steps: [[LLM: Include how if possible the user can manually test the
8403
8616
 
8404
8617
  | Date | Version | Description | Author |
8405
8618
  | :--- | :------ | :---------- | :----- |
8619
+
8620
+ ## QA Results
8621
+
8622
+ [[LLM: QA Agent Results]]
8406
8623
  ==================== END: templates#story-tmpl ====================
8407
8624
 
8408
8625
  ==================== START: checklists#po-master-checklist ====================
@@ -8894,7 +9111,42 @@ workflow:
8894
9111
 
8895
9112
  - workflow_end:
8896
9113
  action: move_to_ide
8897
- notes: "All planning artifacts complete. Move to IDE environment to begin development. Explain to the user the IDE Development Workflow next steps: data#bmad-kb:IDE Development Workflow"
9114
+ notes: |
9115
+ Planning phase complete! Now transition to IDE Development:
9116
+
9117
+ 1. ENSURE DOCUMENTS ARE IN PROJECT:
9118
+ - Copy final prd.md to project's docs/prd.md
9119
+ - Copy final architecture.md to project's docs/architecture.md
9120
+ - All documents must be in the project before proceeding
9121
+
9122
+ 2. SHARD DOCUMENTS (in IDE):
9123
+ - Option A: Use PO agent to shard: @po then ask to shard docs/prd.md
9124
+ - Option B: Manual: Drag shard-doc task + docs/prd.md into chat
9125
+ - This creates docs/prd/ and docs/architecture/ folders with sharded content
9126
+
9127
+ 3. START DEVELOPMENT CYCLE:
9128
+ a. SM Agent (New Chat): @sm → *create
9129
+ - Creates next story from sharded docs
9130
+ - Review and approve story (Draft → Approved)
9131
+
9132
+ b. Dev Agent (New Chat): @dev
9133
+ - Implements approved story
9134
+ - Updates File List with all changes
9135
+ - Marks story as "Review" when complete
9136
+
9137
+ c. QA Agent (New Chat): @qa → review-story
9138
+ - Senior dev review with refactoring ability
9139
+ - Fixes small issues directly
9140
+ - Leaves checklist for remaining items
9141
+ - Updates story status (Review → Done or stays Review)
9142
+
9143
+ d. If QA left unchecked items:
9144
+ - Dev Agent (New Chat): Address remaining items
9145
+ - Return to QA for final approval
9146
+
9147
+ 4. REPEAT: Continue cycle for all epic stories
9148
+
9149
+ Reference: data#bmad-kb:IDE Development Workflow
8898
9150
 
8899
9151
  flow_diagram: |
8900
9152
  ```mermaid
@@ -8975,7 +9227,42 @@ workflow:
8975
9227
 
8976
9228
  - workflow_end:
8977
9229
  action: move_to_ide
8978
- notes: "All planning artifacts complete. Move to IDE environment to begin development. Explain to the user the IDE Development Workflow next steps: data#bmad-kb:IDE Development Workflow"
9230
+ notes: |
9231
+ Planning phase complete! Now transition to IDE Development:
9232
+
9233
+ 1. ENSURE DOCUMENTS ARE IN PROJECT:
9234
+ - Copy final prd.md to project's docs/prd.md
9235
+ - Copy final architecture.md to project's docs/architecture.md
9236
+ - All documents must be in the project before proceeding
9237
+
9238
+ 2. SHARD DOCUMENTS (in IDE):
9239
+ - Option A: Use PO agent to shard: @po then ask to shard docs/prd.md
9240
+ - Option B: Manual: Drag shard-doc task + docs/prd.md into chat
9241
+ - This creates docs/prd/ and docs/architecture/ folders with sharded content
9242
+
9243
+ 3. START DEVELOPMENT CYCLE:
9244
+ a. SM Agent (New Chat): @sm → *create
9245
+ - Creates next story from sharded docs
9246
+ - Review and approve story (Draft → Approved)
9247
+
9248
+ b. Dev Agent (New Chat): @dev
9249
+ - Implements approved story
9250
+ - Updates File List with all changes
9251
+ - Marks story as "Review" when complete
9252
+
9253
+ c. QA Agent (New Chat): @qa → review-story
9254
+ - Senior dev review with refactoring ability
9255
+ - Fixes small issues directly
9256
+ - Leaves checklist for remaining items
9257
+ - Updates story status (Review → Done or stays Review)
9258
+
9259
+ d. If QA left unchecked items:
9260
+ - Dev Agent (New Chat): Address remaining items
9261
+ - Return to QA for final approval
9262
+
9263
+ 4. REPEAT: Continue cycle for all epic stories
9264
+
9265
+ Reference: data#bmad-kb:IDE Development Workflow
8979
9266
 
8980
9267
  flow_diagram: |
8981
9268
  ```mermaid
@@ -9063,7 +9350,42 @@ workflow:
9063
9350
 
9064
9351
  - workflow_end:
9065
9352
  action: move_to_ide
9066
- notes: "All planning artifacts complete. Move to IDE environment to begin development. Explain to the user the IDE Development Workflow next steps: data#bmad-kb:IDE Development Workflow"
9353
+ notes: |
9354
+ Planning phase complete! Now transition to IDE Development:
9355
+
9356
+ 1. ENSURE DOCUMENTS ARE IN PROJECT:
9357
+ - Copy final prd.md to project's docs/prd.md
9358
+ - Copy final architecture.md to project's docs/architecture.md
9359
+ - All documents must be in the project before proceeding
9360
+
9361
+ 2. SHARD DOCUMENTS (in IDE):
9362
+ - Option A: Use PO agent to shard: @po then ask to shard docs/prd.md
9363
+ - Option B: Manual: Drag shard-doc task + docs/prd.md into chat
9364
+ - This creates docs/prd/ and docs/architecture/ folders with sharded content
9365
+
9366
+ 3. START DEVELOPMENT CYCLE:
9367
+ a. SM Agent (New Chat): @sm → *create
9368
+ - Creates next story from sharded docs
9369
+ - Review and approve story (Draft → Approved)
9370
+
9371
+ b. Dev Agent (New Chat): @dev
9372
+ - Implements approved story
9373
+ - Updates File List with all changes
9374
+ - Marks story as "Review" when complete
9375
+
9376
+ c. QA Agent (New Chat): @qa → review-story
9377
+ - Senior dev review with refactoring ability
9378
+ - Fixes small issues directly
9379
+ - Leaves checklist for remaining items
9380
+ - Updates story status (Review → Done or stays Review)
9381
+
9382
+ d. If QA left unchecked items:
9383
+ - Dev Agent (New Chat): Address remaining items
9384
+ - Return to QA for final approval
9385
+
9386
+ 4. REPEAT: Continue cycle for all epic stories
9387
+
9388
+ Reference: data#bmad-kb:IDE Development Workflow
9067
9389
 
9068
9390
  flow_diagram: |
9069
9391
  ```mermaid
@@ -9179,7 +9501,42 @@ workflow:
9179
9501
 
9180
9502
  - workflow_end:
9181
9503
  action: move_to_ide
9182
- notes: "All planning artifacts complete. Move to IDE environment to begin development. Explain to the user the IDE Development Workflow next steps: data#bmad-kb:IDE Development Workflow"
9504
+ notes: |
9505
+ Planning phase complete! Now transition to IDE Development:
9506
+
9507
+ 1. ENSURE DOCUMENTS ARE IN PROJECT:
9508
+ - Copy final prd.md to project's docs/prd.md
9509
+ - Copy final architecture.md to project's docs/architecture.md
9510
+ - All documents must be in the project before proceeding
9511
+
9512
+ 2. SHARD DOCUMENTS (in IDE):
9513
+ - Option A: Use PO agent to shard: @po then ask to shard docs/prd.md
9514
+ - Option B: Manual: Drag shard-doc task + docs/prd.md into chat
9515
+ - This creates docs/prd/ and docs/architecture/ folders with sharded content
9516
+
9517
+ 3. START DEVELOPMENT CYCLE:
9518
+ a. SM Agent (New Chat): @sm → *create
9519
+ - Creates next story from sharded docs
9520
+ - Review and approve story (Draft → Approved)
9521
+
9522
+ b. Dev Agent (New Chat): @dev
9523
+ - Implements approved story
9524
+ - Updates File List with all changes
9525
+ - Marks story as "Review" when complete
9526
+
9527
+ c. QA Agent (New Chat): @qa → review-story
9528
+ - Senior dev review with refactoring ability
9529
+ - Fixes small issues directly
9530
+ - Leaves checklist for remaining items
9531
+ - Updates story status (Review → Done or stays Review)
9532
+
9533
+ d. If QA left unchecked items:
9534
+ - Dev Agent (New Chat): Address remaining items
9535
+ - Return to QA for final approval
9536
+
9537
+ 4. REPEAT: Continue cycle for all epic stories
9538
+
9539
+ Reference: data#bmad-kb:IDE Development Workflow
9183
9540
 
9184
9541
  flow_diagram: |
9185
9542
  ```mermaid
@@ -9289,7 +9646,42 @@ workflow:
9289
9646
 
9290
9647
  - workflow_end:
9291
9648
  action: move_to_ide
9292
- notes: "All planning artifacts complete. Move to IDE environment to begin development. Explain to the user the IDE Development Workflow next steps: data#bmad-kb:IDE Development Workflow"
9649
+ notes: |
9650
+ Planning phase complete! Now transition to IDE Development:
9651
+
9652
+ 1. ENSURE DOCUMENTS ARE IN PROJECT:
9653
+ - Copy final prd.md to project's docs/prd.md
9654
+ - Copy final architecture.md to project's docs/architecture.md
9655
+ - All documents must be in the project before proceeding
9656
+
9657
+ 2. SHARD DOCUMENTS (in IDE):
9658
+ - Option A: Use PO agent to shard: @po then ask to shard docs/prd.md
9659
+ - Option B: Manual: Drag shard-doc task + docs/prd.md into chat
9660
+ - This creates docs/prd/ and docs/architecture/ folders with sharded content
9661
+
9662
+ 3. START DEVELOPMENT CYCLE:
9663
+ a. SM Agent (New Chat): @sm → *create
9664
+ - Creates next story from sharded docs
9665
+ - Review and approve story (Draft → Approved)
9666
+
9667
+ b. Dev Agent (New Chat): @dev
9668
+ - Implements approved story
9669
+ - Updates File List with all changes
9670
+ - Marks story as "Review" when complete
9671
+
9672
+ c. QA Agent (New Chat): @qa → review-story
9673
+ - Senior dev review with refactoring ability
9674
+ - Fixes small issues directly
9675
+ - Leaves checklist for remaining items
9676
+ - Updates story status (Review → Done or stays Review)
9677
+
9678
+ d. If QA left unchecked items:
9679
+ - Dev Agent (New Chat): Address remaining items
9680
+ - Return to QA for final approval
9681
+
9682
+ 4. REPEAT: Continue cycle for all epic stories
9683
+
9684
+ Reference: data#bmad-kb:IDE Development Workflow
9293
9685
 
9294
9686
  flow_diagram: |
9295
9687
  ```mermaid
@@ -9408,7 +9800,42 @@ workflow:
9408
9800
 
9409
9801
  - workflow_end:
9410
9802
  action: move_to_ide
9411
- notes: "All planning artifacts complete. Move to IDE environment to begin development. Explain to the user the IDE Development Workflow next steps: data#bmad-kb:IDE Development Workflow"
9803
+ notes: |
9804
+ Planning phase complete! Now transition to IDE Development:
9805
+
9806
+ 1. ENSURE DOCUMENTS ARE IN PROJECT:
9807
+ - Copy final prd.md to project's docs/prd.md
9808
+ - Copy final architecture.md to project's docs/architecture.md
9809
+ - All documents must be in the project before proceeding
9810
+
9811
+ 2. SHARD DOCUMENTS (in IDE):
9812
+ - Option A: Use PO agent to shard: @po then ask to shard docs/prd.md
9813
+ - Option B: Manual: Drag shard-doc task + docs/prd.md into chat
9814
+ - This creates docs/prd/ and docs/architecture/ folders with sharded content
9815
+
9816
+ 3. START DEVELOPMENT CYCLE:
9817
+ a. SM Agent (New Chat): @sm → *create
9818
+ - Creates next story from sharded docs
9819
+ - Review and approve story (Draft → Approved)
9820
+
9821
+ b. Dev Agent (New Chat): @dev
9822
+ - Implements approved story
9823
+ - Updates File List with all changes
9824
+ - Marks story as "Review" when complete
9825
+
9826
+ c. QA Agent (New Chat): @qa → review-story
9827
+ - Senior dev review with refactoring ability
9828
+ - Fixes small issues directly
9829
+ - Leaves checklist for remaining items
9830
+ - Updates story status (Review → Done or stays Review)
9831
+
9832
+ d. If QA left unchecked items:
9833
+ - Dev Agent (New Chat): Address remaining items
9834
+ - Return to QA for final approval
9835
+
9836
+ 4. REPEAT: Continue cycle for all epic stories
9837
+
9838
+ Reference: data#bmad-kb:IDE Development Workflow
9412
9839
 
9413
9840
  flow_diagram: |
9414
9841
  ```mermaid