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
@@ -195,7 +195,7 @@ agent:
195
195
  id: analyst
196
196
  title: Business Analyst
197
197
  icon: 📊
198
- whenToUse: Use for market research, brainstorming, competitive analysis, creating project briefs, and initial project discovery
198
+ whenToUse: Use for market research, brainstorming, competitive analysis, creating project briefs, initial project discovery, and documenting existing projects (brownfield)
199
199
  customization: null
200
200
  persona:
201
201
  role: Insightful Analyst & Strategic Ideation Partner
@@ -223,6 +223,7 @@ commands:
223
223
  - brainstorm {topic}: Facilitate structured brainstorming session
224
224
  - research {topic}: Generate deep research prompt for investigation
225
225
  - elicit: Run advanced elicitation to clarify requirements
226
+ - document-project: Analyze and document existing project structure comprehensively
226
227
  - exit: Say goodbye as the Business Analyst, and then abandon inhabiting this persona
227
228
  dependencies:
228
229
  tasks:
@@ -230,6 +231,7 @@ dependencies:
230
231
  - create-deep-research-prompt
231
232
  - create-doc
232
233
  - advanced-elicitation
234
+ - document-project
233
235
  templates:
234
236
  - project-brief-tmpl
235
237
  - market-research-tmpl
@@ -697,6 +699,50 @@ BMAD-METHOD (Breakthrough Method of Agile AI-driven Development) is a framework
697
699
  - **Quality Assurance**: Structured testing and validation
698
700
  - **Documentation**: Professional PRDs, architecture docs, user stories
699
701
 
702
+ ## How BMAD Works
703
+
704
+ ### The Core Method
705
+
706
+ BMAD transforms you into a "Vibe CEO" - directing a team of specialized AI agents through structured workflows. Here's how:
707
+
708
+ 1. **You Direct, AI Executes**: You provide vision and decisions; agents handle implementation details
709
+ 2. **Specialized Agents**: Each agent masters one role (PM, Developer, Architect, etc.)
710
+ 3. **Structured Workflows**: Proven patterns guide you from idea to deployed code
711
+ 4. **Clean Handoffs**: Fresh context windows ensure agents stay focused and effective
712
+
713
+ ### The Two-Phase Approach
714
+
715
+ **Phase 1: Planning (Web UI - Cost Effective)**
716
+ - Use large context windows (Gemini's 1M tokens)
717
+ - Generate comprehensive documents (PRD, Architecture)
718
+ - Leverage multiple agents for brainstorming
719
+ - Create once, use throughout development
720
+
721
+ **Phase 2: Development (IDE - Implementation)**
722
+ - Shard documents into manageable pieces
723
+ - Execute focused SM → Dev cycles
724
+ - One story at a time, sequential progress
725
+ - Real-time file operations and testing
726
+
727
+ ### The Development Loop
728
+
729
+ ```text
730
+ 1. SM Agent (New Chat) → Creates next story from sharded docs
731
+ 2. You → Review and approve story
732
+ 3. Dev Agent (New Chat) → Implements approved story
733
+ 4. QA Agent (New Chat) → Reviews and refactors code
734
+ 5. You → Verify completion
735
+ 6. Repeat until epic complete
736
+ ```
737
+
738
+ ### Why This Works
739
+
740
+ - **Context Optimization**: Clean chats = better AI performance
741
+ - **Role Clarity**: Agents don't context-switch = higher quality
742
+ - **Incremental Progress**: Small stories = manageable complexity
743
+ - **Human Oversight**: You validate each step = quality control
744
+ - **Document-Driven**: Specs guide everything = consistency
745
+
700
746
  ## Getting Started
701
747
 
702
748
  ### Quick Start Options
@@ -711,7 +757,7 @@ BMAD-METHOD (Breakthrough Method of Agile AI-driven Development) is a framework
711
757
  5. Type `/help` to see available commands
712
758
 
713
759
  #### Option 2: IDE Integration
714
- **Best for**: Cursor, Claude Code, Windsurf, VS Code users
760
+ **Best for**: Cursor, Claude Code, Windsurf, Cline, Roo Code users
715
761
 
716
762
  ```bash
717
763
  # Interactive installation (recommended)
@@ -720,13 +766,22 @@ npx bmad-method install
720
766
 
721
767
  **Installation Steps**:
722
768
  - Choose "Complete installation"
723
- - Select your IDE (Cursor, Claude Code, Windsurf, or Roo Code)
769
+ - Select your IDE from supported options:
770
+ - **Cursor**: Native AI integration
771
+ - **Claude Code**: Anthropic's official IDE
772
+ - **Windsurf**: Built-in AI capabilities
773
+ - **Cline**: VS Code extension with AI features
774
+ - **Roo Code**: Web-based IDE with agent support
775
+
776
+ **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.
724
777
 
725
778
  **Verify Installation**:
726
779
  - `.bmad-core/` folder created with all agents
727
780
  - IDE-specific integration files created
728
781
  - All agent commands/rules/modes available
729
782
 
783
+ **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
784
+
730
785
  ### Environment Selection Guide
731
786
 
732
787
  **Use Web UI for**:
@@ -743,6 +798,47 @@ npx bmad-method install
743
798
 
744
799
  **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.
745
800
 
801
+ ### IDE-Only Workflow Considerations
802
+
803
+ **Can you do everything in IDE?** Yes, but understand the tradeoffs:
804
+
805
+ **Pros of IDE-Only**:
806
+ - Single environment workflow
807
+ - Direct file operations from start
808
+ - No copy/paste between environments
809
+ - Immediate project integration
810
+
811
+ **Cons of IDE-Only**:
812
+ - Higher token costs for large document creation
813
+ - Smaller context windows (varies by IDE/model)
814
+ - May hit limits during planning phases
815
+ - Less cost-effective for brainstorming
816
+
817
+ **Using Web Agents in IDE**:
818
+ - **NOT RECOMMENDED**: Web agents (PM, Architect) have rich dependencies designed for large contexts
819
+ - **Why it matters**: Dev agents are kept lean to maximize coding context
820
+ - **The principle**: "Dev agents code, planning agents plan" - mixing breaks this optimization
821
+
822
+ **About bmad-master and bmad-orchestrator**:
823
+ - **bmad-master**: CAN do any task without switching agents, BUT...
824
+ - **Still use specialized agents for planning**: PM, Architect, and UX Expert have tuned personas that produce better results
825
+ - **Why specialization matters**: Each agent's personality and focus creates higher quality outputs
826
+ - **If using bmad-master/orchestrator**: Fine for planning phases, but...
827
+
828
+ **CRITICAL RULE for Development**:
829
+ - **ALWAYS use SM agent for story creation** - Never use bmad-master/orchestrator
830
+ - **ALWAYS use Dev agent for implementation** - Never use bmad-master/orchestrator
831
+ - **Why this matters**: SM and Dev agents are specifically optimized for the development workflow
832
+ - **No exceptions**: Even if using bmad-master for everything else, switch to SM → Dev for implementation
833
+
834
+ **Best Practice for IDE-Only**:
835
+ 1. Use PM/Architect/UX agents for planning (better than bmad-master)
836
+ 2. Create documents directly in project
837
+ 3. Shard immediately after creation
838
+ 4. **MUST switch to SM agent** for story creation
839
+ 5. **MUST switch to Dev agent** for implementation
840
+ 6. Keep planning and coding in separate chat sessions
841
+
746
842
  ## Core Configuration (core-config.yml)
747
843
 
748
844
  **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.
@@ -983,10 +1079,16 @@ This architecture enables seamless operation across environments while maintaini
983
1079
 
984
1080
  ## Complete Development Workflow
985
1081
 
986
- ### Planning Phase (Web UI Recommended)
1082
+ ### Planning Phase (Web UI Recommended - Especially Gemini!)
1083
+
1084
+ **Ideal for cost efficiency with Gemini's massive context:**
987
1085
 
988
- **Ideal for cost efficiency, especially with Gemini:**
1086
+ **For Brownfield Projects - Start Here!**:
1087
+ 1. **Upload entire project to Gemini Web** (GitHub URL, files, or zip)
1088
+ 2. **Document existing system**: `/analyst` → `*document-project`
1089
+ 3. **Creates comprehensive docs** from entire codebase analysis
989
1090
 
1091
+ **For All Projects**:
990
1092
  1. **Optional Analysis**: `/analyst` - Market research, competitive analysis
991
1093
  2. **Project Brief**: Create foundation document (Analyst or user)
992
1094
  3. **PRD Creation**: `/pm create-doc prd` - Comprehensive product requirements
@@ -1020,10 +1122,14 @@ that can handle [specific requirements]."
1020
1122
 
1021
1123
  **Prerequisites**: Planning documents must exist in `docs/` folder
1022
1124
 
1023
- 1. **Document Sharding**:
1024
- - `@bmad-master` or `@po` shard `docs/prd.md` to `docs/prd/` folder
1025
- - If architecture exists, shard to `docs/architecture/` folder
1026
- - Results in multiple manageable documents and epic files
1125
+ 1. **Document Sharding** (CRITICAL STEP):
1126
+ - Documents created by PM/Architect (in Web or IDE) MUST be sharded for development
1127
+ - Two methods to shard:
1128
+ a) **Manual**: Drag `shard-doc` task + document file into chat
1129
+ b) **Agent**: Ask `@bmad-master` or `@po` to shard documents
1130
+ - Shards `docs/prd.md` → `docs/prd/` folder
1131
+ - Shards `docs/architecture.md` → `docs/architecture/` folder
1132
+ - **WARNING**: Do NOT shard in Web UI - copying many small files is painful!
1027
1133
 
1028
1134
  2. **Verify Sharded Content**:
1029
1135
  - At least one `epic-n.md` file in `docs/prd/` with stories in development order
@@ -1037,19 +1143,34 @@ that can handle [specific requirements]."
1037
1143
 
1038
1144
  3. **Development Cycle** (Sequential, one story at a time):
1039
1145
 
1040
- **Step 1 - Story Creation**: New chat window → `@sm` → `*create`
1146
+ **CRITICAL CONTEXT MANAGEMENT**:
1147
+ - **Context windows matter!** Always use fresh, clean context windows
1148
+ - **Model selection matters!** Use most powerful thinking model for SM story creation
1149
+ - **ALWAYS start new chat between SM, Dev, and QA work**
1150
+
1151
+ **Step 1 - Story Creation**:
1152
+ - **NEW CLEAN CHAT** → Select powerful model → `@sm` → `*create`
1041
1153
  - SM executes create-next-story task
1042
1154
  - Review generated story in `docs/stories/`
1043
1155
  - Update status from "Draft" to "Approved"
1044
1156
 
1045
- **Step 2 - Story Implementation**: New chat window → `@dev`
1157
+ **Step 2 - Story Implementation**:
1158
+ - **NEW CLEAN CHAT** → `@dev`
1046
1159
  - Agent asks which story to implement
1047
1160
  - Include story file content to save dev agent lookup time
1048
1161
  - Dev follows tasks/subtasks, marking completion
1049
- - Dev leaves notes for SM about any deviations
1050
- - Update status to "Done"
1162
+ - Dev maintains File List of all changes
1163
+ - Dev marks story as "Review" when complete with all tests passing
1164
+
1165
+ **Step 3 - Senior QA Review**:
1166
+ - **NEW CLEAN CHAT** → `@qa` → execute review-story task
1167
+ - QA performs senior developer code review
1168
+ - QA can refactor and improve code directly
1169
+ - QA appends results to story's QA Results section
1170
+ - If approved: Status → "Done"
1171
+ - If changes needed: Status stays "Review" with unchecked items for dev
1051
1172
 
1052
- **Step 3 - Repeat**: Continue SM → Dev cycle until all epic stories complete
1173
+ **Step 4 - Repeat**: Continue SM → Dev → QA cycle until all epic stories complete
1053
1174
 
1054
1175
  **Important**: Only 1 story in progress at a time, worked sequentially until all epic stories complete.
1055
1176
 
@@ -1069,12 +1190,72 @@ Each status change requires user verification and approval before proceeding.
1069
1190
  - Development execution
1070
1191
  - Testing and deployment
1071
1192
 
1072
- #### Brownfield Enhancement
1073
- - Current system analysis
1074
- - Enhancement planning
1075
- - Impact assessment
1076
- - Incremental development
1077
- - Integration testing
1193
+ #### Brownfield Enhancement (Existing Projects)
1194
+
1195
+ **Key Concept**: Brownfield development requires comprehensive documentation of your existing project for AI agents to understand context, patterns, and constraints.
1196
+
1197
+ **Complete Brownfield Workflow Options**:
1198
+
1199
+ **Option 1: PRD-First (Recommended for Large Codebases/Monorepos)**:
1200
+ 1. **Upload project to Gemini Web** (GitHub URL, files, or zip)
1201
+ 2. **Create PRD first**: `@pm` → `*create-doc brownfield-prd`
1202
+ 3. **Focused documentation**: `@analyst` → `*document-project`
1203
+ - Analyst asks for focus if no PRD provided
1204
+ - Choose "single document" format for Web UI
1205
+ - Uses PRD to document ONLY relevant areas
1206
+ - Creates one comprehensive markdown file
1207
+ - Avoids bloating docs with unused code
1208
+
1209
+ **Option 2: Document-First (Good for Smaller Projects)**:
1210
+ 1. **Upload project to Gemini Web**
1211
+ 2. **Document everything**: `@analyst` → `*document-project`
1212
+ 3. **Then create PRD**: `@pm` → `*create-doc brownfield-prd`
1213
+ - More thorough but can create excessive documentation
1214
+
1215
+ 2. **Requirements Gathering**:
1216
+ - **Brownfield PRD**: Use PM agent with `brownfield-prd-tmpl`
1217
+ - **Analyzes**: Existing system, constraints, integration points
1218
+ - **Defines**: Enhancement scope, compatibility requirements, risk assessment
1219
+ - **Creates**: Epic and story structure for changes
1220
+
1221
+ 3. **Architecture Planning**:
1222
+ - **Brownfield Architecture**: Use Architect agent with `brownfield-architecture-tmpl`
1223
+ - **Integration Strategy**: How new features integrate with existing system
1224
+ - **Migration Planning**: Gradual rollout and backwards compatibility
1225
+ - **Risk Mitigation**: Addressing potential breaking changes
1226
+
1227
+ **Brownfield-Specific Resources**:
1228
+
1229
+ **Templates**:
1230
+ - `brownfield-prd-tmpl.md`: Comprehensive enhancement planning with existing system analysis
1231
+ - `brownfield-architecture-tmpl.md`: Integration-focused architecture for existing systems
1232
+
1233
+ **Tasks**:
1234
+ - `document-project`: Generates comprehensive documentation from existing codebase
1235
+ - `brownfield-create-epic`: Creates single epic for focused enhancements (when full PRD is overkill)
1236
+ - `brownfield-create-story`: Creates individual story for small, isolated changes
1237
+
1238
+ **When to Use Each Approach**:
1239
+
1240
+ **Full Brownfield Workflow** (Recommended for):
1241
+ - Major feature additions
1242
+ - System modernization
1243
+ - Complex integrations
1244
+ - Multiple related changes
1245
+
1246
+ **Quick Epic/Story Creation** (Use when):
1247
+ - Single, focused enhancement
1248
+ - Isolated bug fixes
1249
+ - Small feature additions
1250
+ - Well-documented existing system
1251
+
1252
+ **Critical Success Factors**:
1253
+ 1. **Documentation First**: Always run `document-project` if docs are outdated/missing
1254
+ 2. **Context Matters**: Provide agents access to relevant code sections
1255
+ 3. **Integration Focus**: Emphasize compatibility and non-breaking changes
1256
+ 4. **Incremental Approach**: Plan for gradual rollout and testing
1257
+
1258
+ **For detailed guide**: See `docs/working-in-the-brownfield.md`
1078
1259
 
1079
1260
  ## Document Creation Best Practices
1080
1261
 
@@ -1155,12 +1336,94 @@ Use the `shard-doc` task or `@kayvan/markdown-tree-parser` tool for automatic sh
1155
1336
  - **Keep conversations focused** - One agent, one task per conversation
1156
1337
  - **Review everything** - Always review and approve before marking complete
1157
1338
 
1339
+ ## Contributing to BMAD-METHOD
1340
+
1341
+ ### Quick Contribution Guidelines
1342
+
1343
+ For full details, see `CONTRIBUTING.md`. Key points:
1344
+
1345
+ **Fork Workflow**:
1346
+ 1. Fork the repository
1347
+ 2. Create feature branches
1348
+ 3. Submit PRs to `next` branch (default) or `main` for critical fixes only
1349
+ 4. Keep PRs small: 200-400 lines ideal, 800 lines maximum
1350
+ 5. One feature/fix per PR
1351
+
1352
+ **PR Requirements**:
1353
+ - Clear descriptions (max 200 words) with What/Why/How/Testing
1354
+ - Use conventional commits (feat:, fix:, docs:)
1355
+ - Atomic commits - one logical change per commit
1356
+ - Must align with guiding principles
1357
+
1358
+ **Core Principles** (from GUIDING-PRINCIPLES.md):
1359
+ - **Dev Agents Must Be Lean**: Minimize dependencies, save context for code
1360
+ - **Natural Language First**: Everything in markdown, no code in core
1361
+ - **Core vs Expansion Packs**: Core for universal needs, packs for specialized domains
1362
+ - **Design Philosophy**: "Dev agents code, planning agents plan"
1363
+
1364
+ ## Expansion Packs
1365
+
1366
+ ### What Are Expansion Packs?
1367
+
1368
+ 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.
1369
+
1370
+ ### Why Use Expansion Packs?
1371
+
1372
+ 1. **Keep Core Lean**: Dev agents maintain maximum context for coding
1373
+ 2. **Domain Expertise**: Deep, specialized knowledge without bloating core
1374
+ 3. **Community Innovation**: Anyone can create and share packs
1375
+ 4. **Modular Design**: Install only what you need
1376
+
1377
+ ### Available Expansion Packs
1378
+
1379
+ **Technical Packs**:
1380
+ - **Infrastructure/DevOps**: Cloud architects, SRE experts, security specialists
1381
+ - **Game Development**: Game designers, level designers, narrative writers
1382
+ - **Mobile Development**: iOS/Android specialists, mobile UX experts
1383
+ - **Data Science**: ML engineers, data scientists, visualization experts
1384
+
1385
+ **Non-Technical Packs**:
1386
+ - **Business Strategy**: Consultants, financial analysts, marketing strategists
1387
+ - **Creative Writing**: Plot architects, character developers, world builders
1388
+ - **Health & Wellness**: Fitness trainers, nutritionists, habit engineers
1389
+ - **Education**: Curriculum designers, assessment specialists
1390
+ - **Legal Support**: Contract analysts, compliance checkers
1391
+
1392
+ **Specialty Packs**:
1393
+ - **Expansion Creator**: Tools to build your own expansion packs
1394
+ - **RPG Game Master**: Tabletop gaming assistance
1395
+ - **Life Event Planning**: Wedding planners, event coordinators
1396
+ - **Scientific Research**: Literature reviewers, methodology designers
1397
+
1398
+ ### Using Expansion Packs
1399
+
1400
+ 1. **Browse Available Packs**: Check `expansion-packs/` directory
1401
+ 2. **Get Inspiration**: See `docs/expansion-pack-ideas.md` for detailed examples
1402
+ 3. **Install via CLI**:
1403
+ ```bash
1404
+ npx bmad-method install
1405
+ # Select "Install expansion pack" option
1406
+ ```
1407
+ 4. **Use in Your Workflow**: Installed packs integrate seamlessly with existing agents
1408
+
1409
+ ### Creating Custom Expansion Packs
1410
+
1411
+ Use the **expansion-creator** pack to build your own:
1412
+
1413
+ 1. **Define Domain**: What expertise are you capturing?
1414
+ 2. **Design Agents**: Create specialized roles with clear boundaries
1415
+ 3. **Build Resources**: Tasks, templates, checklists for your domain
1416
+ 4. **Test & Share**: Validate with real use cases, share with community
1417
+
1418
+ **Key Principle**: Expansion packs democratize expertise by making specialized knowledge accessible through AI agents.
1419
+
1158
1420
  ## Getting Help
1159
1421
 
1160
1422
  - **Commands**: Use `/help` in any environment to see available commands
1161
1423
  - **Agent Switching**: Use `/switch agent-name` with orchestrator for role changes
1162
1424
  - **Documentation**: Check `docs/` folder for project-specific context
1163
1425
  - **Community**: Discord and GitHub resources available for support
1426
+ - **Contributing**: See `CONTRIBUTING.md` for full guidelines
1164
1427
  ==================== END: data#bmad-kb ====================
1165
1428
 
1166
1429
  ==================== START: utils#workflow-management ====================
@@ -1963,6 +2226,326 @@ Present these numbered options to the user:
1963
2226
  - Plan for iterative refinement based on initial findings
1964
2227
  ==================== END: tasks#create-deep-research-prompt ====================
1965
2228
 
2229
+ ==================== START: tasks#document-project ====================
2230
+ # Document an Existing Project
2231
+
2232
+ ## Purpose
2233
+
2234
+ 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.
2235
+
2236
+ ## Task Instructions
2237
+
2238
+ ### 1. Initial Project Analysis
2239
+
2240
+ [[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.
2241
+
2242
+ **IF PRD EXISTS**:
2243
+
2244
+ - Review the PRD to understand what enhancement/feature is planned
2245
+ - Identify which modules, services, or areas will be affected
2246
+ - Focus documentation ONLY on these relevant areas
2247
+ - Skip unrelated parts of the codebase to keep docs lean
2248
+
2249
+ **IF NO PRD EXISTS**:
2250
+ Ask the user:
2251
+
2252
+ "I notice you haven't provided a PRD or requirements document. To create more focused and useful documentation, I recommend one of these options:
2253
+
2254
+ 1. **Create a PRD first** - Would you like me to help create a brownfield PRD before documenting? This helps focus documentation on relevant areas.
2255
+
2256
+ 2. **Provide existing requirements** - Do you have a requirements document, epic, or feature description you can share?
2257
+
2258
+ 3. **Describe the focus** - Can you briefly describe what enhancement or feature you're planning? For example:
2259
+ - 'Adding payment processing to the user service'
2260
+ - 'Refactoring the authentication module'
2261
+ - 'Integrating with a new third-party API'
2262
+
2263
+ 4. **Document everything** - Or should I proceed with comprehensive documentation of the entire codebase? (Note: This may create excessive documentation for large projects)
2264
+
2265
+ Please let me know your preference, or I can proceed with full documentation if you prefer."
2266
+
2267
+ Based on their response:
2268
+
2269
+ - If they choose option 1-3: Use that context to focus documentation
2270
+ - If they choose option 4 or decline: Proceed with comprehensive analysis below
2271
+
2272
+ Begin by conducting analysis of the existing project. Use available tools to:
2273
+
2274
+ 1. **Project Structure Discovery**: Examine the root directory structure, identify main folders, and understand the overall organization
2275
+ 2. **Technology Stack Identification**: Look for package.json, requirements.txt, Cargo.toml, pom.xml, etc. to identify languages, frameworks, and dependencies
2276
+ 3. **Build System Analysis**: Find build scripts, CI/CD configurations, and development commands
2277
+ 4. **Existing Documentation Review**: Check for README files, docs folders, and any existing documentation
2278
+ 5. **Code Pattern Analysis**: Sample key files to understand coding patterns, naming conventions, and architectural approaches
2279
+
2280
+ Ask the user these elicitation questions to better understand their needs:
2281
+
2282
+ - What is the primary purpose of this project?
2283
+ - Are there any specific areas of the codebase that are particularly complex or important for agents to understand?
2284
+ - What types of tasks do you expect AI agents to perform on this project? (e.g., bug fixes, feature additions, refactoring, testing)
2285
+ - Are there any existing documentation standards or formats you prefer?
2286
+ - What level of technical detail should the documentation target? (junior developers, senior developers, mixed team)
2287
+ - Is there a specific feature or enhancement you're planning? (This helps focus documentation)
2288
+ ]]
2289
+
2290
+ ### 2. Deep Codebase Analysis
2291
+
2292
+ [[LLM: Before generating documentation, conduct extensive analysis of the existing codebase:
2293
+
2294
+ 1. **Explore Key Areas**:
2295
+ - Entry points (main files, index files, app initializers)
2296
+ - Configuration files and environment setup
2297
+ - Package dependencies and versions
2298
+ - Build and deployment configurations
2299
+ - Test suites and coverage
2300
+
2301
+ 2. **Ask Clarifying Questions**:
2302
+ - "I see you're using [technology X]. Are there any custom patterns or conventions I should document?"
2303
+ - "What are the most critical/complex parts of this system that developers struggle with?"
2304
+ - "Are there any undocumented 'tribal knowledge' areas I should capture?"
2305
+ - "What technical debt or known issues should I document?"
2306
+ - "Which parts of the codebase change most frequently?"
2307
+
2308
+ 3. **Map the Reality**:
2309
+ - Identify ACTUAL patterns used (not theoretical best practices)
2310
+ - Find where key business logic lives
2311
+ - Locate integration points and external dependencies
2312
+ - Document workarounds and technical debt
2313
+ - Note areas that differ from standard patterns
2314
+
2315
+ **IF PRD PROVIDED**: Also analyze what would need to change for the enhancement]]
2316
+
2317
+ ### 3. Core Documentation Generation
2318
+
2319
+ [[LLM: Generate a comprehensive BROWNFIELD architecture document that reflects the ACTUAL state of the codebase.
2320
+
2321
+ **CRITICAL**: This is NOT an aspirational architecture document. Document what EXISTS, including:
2322
+ - Technical debt and workarounds
2323
+ - Inconsistent patterns between different parts
2324
+ - Legacy code that can't be changed
2325
+ - Integration constraints
2326
+ - Performance bottlenecks
2327
+
2328
+ **Document Structure**:
2329
+
2330
+ # [Project Name] Brownfield Architecture Document
2331
+
2332
+ ## Introduction
2333
+ 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.
2334
+
2335
+ ### Document Scope
2336
+ [If PRD provided: "Focused on areas relevant to: {enhancement description}"]
2337
+ [If no PRD: "Comprehensive documentation of entire system"]
2338
+
2339
+ ### Change Log
2340
+ | Date | Version | Description | Author |
2341
+ |------|---------|-------------|--------|
2342
+ | [Date] | 1.0 | Initial brownfield analysis | [Analyst] |
2343
+
2344
+ ## Quick Reference - Key Files and Entry Points
2345
+
2346
+ ### Critical Files for Understanding the System
2347
+ - **Main Entry**: `src/index.js` (or actual entry point)
2348
+ - **Configuration**: `config/app.config.js`, `.env.example`
2349
+ - **Core Business Logic**: `src/services/`, `src/domain/`
2350
+ - **API Definitions**: `src/routes/` or link to OpenAPI spec
2351
+ - **Database Models**: `src/models/` or link to schema files
2352
+ - **Key Algorithms**: [List specific files with complex logic]
2353
+
2354
+ ### If PRD Provided - Enhancement Impact Areas
2355
+ [Highlight which files/modules will be affected by the planned enhancement]
2356
+
2357
+ ## High Level Architecture
2358
+
2359
+ ### Technical Summary
2360
+ [Real assessment of architecture - mention if it's well-structured or has issues]
2361
+
2362
+ ### Actual Tech Stack (from package.json/requirements.txt)
2363
+ | Category | Technology | Version | Notes |
2364
+ |----------|------------|---------|--------|
2365
+ | Runtime | Node.js | 16.x | [Any constraints] |
2366
+ | Framework | Express | 4.18.2 | [Custom middleware?] |
2367
+ | Database | PostgreSQL | 13 | [Connection pooling setup] |
2368
+ | [etc...] |
2369
+
2370
+ ### Repository Structure Reality Check
2371
+ - Type: [Monorepo/Polyrepo/Hybrid]
2372
+ - Package Manager: [npm/yarn/pnpm]
2373
+ - Notable: [Any unusual structure decisions]
2374
+
2375
+ ## Source Tree and Module Organization
2376
+
2377
+ ### Project Structure (Actual)
2378
+ ```
2379
+ project-root/
2380
+ ├── src/
2381
+ │ ├── controllers/ # HTTP request handlers
2382
+ │ ├── services/ # Business logic (NOTE: inconsistent patterns between user and payment services)
2383
+ │ ├── models/ # Database models (Sequelize)
2384
+ │ ├── utils/ # Mixed bag - needs refactoring
2385
+ │ └── legacy/ # DO NOT MODIFY - old payment system still in use
2386
+ ├── tests/ # Jest tests (60% coverage)
2387
+ ├── scripts/ # Build and deployment scripts
2388
+ └── config/ # Environment configs
2389
+ ```
2390
+
2391
+ ### Key Modules and Their Purpose
2392
+ - **User Management**: `src/services/userService.js` - Handles all user operations
2393
+ - **Authentication**: `src/middleware/auth.js` - JWT-based, custom implementation
2394
+ - **Payment Processing**: `src/legacy/payment.js` - CRITICAL: Do not refactor, tightly coupled
2395
+ - **[List other key modules with their actual files]**
2396
+
2397
+ ## Data Models and APIs
2398
+
2399
+ ### Data Models
2400
+ Instead of duplicating, reference actual model files:
2401
+ - **User Model**: See `src/models/User.js`
2402
+ - **Order Model**: See `src/models/Order.js`
2403
+ - **Related Types**: TypeScript definitions in `src/types/`
2404
+
2405
+ ### API Specifications
2406
+ - **OpenAPI Spec**: `docs/api/openapi.yaml` (if exists)
2407
+ - **Postman Collection**: `docs/api/postman-collection.json`
2408
+ - **Manual Endpoints**: [List any undocumented endpoints discovered]
2409
+
2410
+ ## Technical Debt and Known Issues
2411
+
2412
+ ### Critical Technical Debt
2413
+ 1. **Payment Service**: Legacy code in `src/legacy/payment.js` - tightly coupled, no tests
2414
+ 2. **User Service**: Different pattern than other services, uses callbacks instead of promises
2415
+ 3. **Database Migrations**: Manually tracked, no proper migration tool
2416
+ 4. **[Other significant debt]**
2417
+
2418
+ ### Workarounds and Gotchas
2419
+ - **Environment Variables**: Must set `NODE_ENV=production` even for staging (historical reason)
2420
+ - **Database Connections**: Connection pool hardcoded to 10, changing breaks payment service
2421
+ - **[Other workarounds developers need to know]**
2422
+
2423
+ ## Integration Points and External Dependencies
2424
+
2425
+ ### External Services
2426
+ | Service | Purpose | Integration Type | Key Files |
2427
+ |---------|---------|------------------|-----------|
2428
+ | Stripe | Payments | REST API | `src/integrations/stripe/` |
2429
+ | SendGrid | Emails | SDK | `src/services/emailService.js` |
2430
+ | [etc...] |
2431
+
2432
+ ### Internal Integration Points
2433
+ - **Frontend Communication**: REST API on port 3000, expects specific headers
2434
+ - **Background Jobs**: Redis queue, see `src/workers/`
2435
+ - **[Other integrations]**
2436
+
2437
+ ## Development and Deployment
2438
+
2439
+ ### Local Development Setup
2440
+ 1. Actual steps that work (not ideal steps)
2441
+ 2. Known issues with setup
2442
+ 3. Required environment variables (see `.env.example`)
2443
+
2444
+ ### Build and Deployment Process
2445
+ - **Build Command**: `npm run build` (webpack config in `webpack.config.js`)
2446
+ - **Deployment**: Manual deployment via `scripts/deploy.sh`
2447
+ - **Environments**: Dev, Staging, Prod (see `config/environments/`)
2448
+
2449
+ ## Testing Reality
2450
+
2451
+ ### Current Test Coverage
2452
+ - Unit Tests: 60% coverage (Jest)
2453
+ - Integration Tests: Minimal, in `tests/integration/`
2454
+ - E2E Tests: None
2455
+ - Manual Testing: Primary QA method
2456
+
2457
+ ### Running Tests
2458
+ ```bash
2459
+ npm test # Runs unit tests
2460
+ npm run test:integration # Runs integration tests (requires local DB)
2461
+ ```
2462
+
2463
+ ## If Enhancement PRD Provided - Impact Analysis
2464
+
2465
+ ### Files That Will Need Modification
2466
+ Based on the enhancement requirements, these files will be affected:
2467
+ - `src/services/userService.js` - Add new user fields
2468
+ - `src/models/User.js` - Update schema
2469
+ - `src/routes/userRoutes.js` - New endpoints
2470
+ - [etc...]
2471
+
2472
+ ### New Files/Modules Needed
2473
+ - `src/services/newFeatureService.js` - New business logic
2474
+ - `src/models/NewFeature.js` - New data model
2475
+ - [etc...]
2476
+
2477
+ ### Integration Considerations
2478
+ - Will need to integrate with existing auth middleware
2479
+ - Must follow existing response format in `src/utils/responseFormatter.js`
2480
+ - [Other integration points]
2481
+
2482
+ ## Appendix - Useful Commands and Scripts
2483
+
2484
+ ### Frequently Used Commands
2485
+ ```bash
2486
+ npm run dev # Start development server
2487
+ npm run build # Production build
2488
+ npm run migrate # Run database migrations
2489
+ npm run seed # Seed test data
2490
+ ```
2491
+
2492
+ ### Debugging and Troubleshooting
2493
+ - **Logs**: Check `logs/app.log` for application logs
2494
+ - **Debug Mode**: Set `DEBUG=app:*` for verbose logging
2495
+ - **Common Issues**: See `docs/troubleshooting.md`]]
2496
+
2497
+ ### 4. Document Delivery
2498
+
2499
+ [[LLM: After generating the complete architecture document:
2500
+
2501
+ 1. **In Web UI (Gemini, ChatGPT, Claude)**:
2502
+ - Present the entire document in one response (or multiple if too long)
2503
+ - Tell user to copy and save as `docs/brownfield-architecture.md` or `docs/project-architecture.md`
2504
+ - Mention it can be sharded later in IDE if needed
2505
+
2506
+ 2. **In IDE Environment**:
2507
+ - Create the document as `docs/brownfield-architecture.md`
2508
+ - Inform user this single document contains all architectural information
2509
+ - Can be sharded later using PO agent if desired
2510
+
2511
+ The document should be comprehensive enough that future agents can understand:
2512
+ - The actual state of the system (not idealized)
2513
+ - Where to find key files and logic
2514
+ - What technical debt exists
2515
+ - What constraints must be respected
2516
+ - If PRD provided: What needs to change for the enhancement]]
2517
+
2518
+ ### 5. Quality Assurance
2519
+
2520
+ [[LLM: Before finalizing the document:
2521
+
2522
+ 1. **Accuracy Check**: Verify all technical details match the actual codebase
2523
+ 2. **Completeness Review**: Ensure all major system components are documented
2524
+ 3. **Focus Validation**: If user provided scope, verify relevant areas are emphasized
2525
+ 4. **Clarity Assessment**: Check that explanations are clear for AI agents
2526
+ 5. **Navigation**: Ensure document has clear section structure for easy reference
2527
+
2528
+ Apply the advanced elicitation task after major sections to refine based on user feedback.]]
2529
+
2530
+ ## Success Criteria
2531
+
2532
+ - Single comprehensive brownfield architecture document created
2533
+ - Document reflects REALITY including technical debt and workarounds
2534
+ - Key files and modules are referenced with actual paths
2535
+ - Models/APIs reference source files rather than duplicating content
2536
+ - If PRD provided: Clear impact analysis showing what needs to change
2537
+ - Document enables AI agents to navigate and understand the actual codebase
2538
+ - Technical constraints and "gotchas" are clearly documented
2539
+
2540
+ ## Notes
2541
+
2542
+ - This task creates ONE document that captures the TRUE state of the system
2543
+ - References actual files rather than duplicating content when possible
2544
+ - Documents technical debt, workarounds, and constraints honestly
2545
+ - For brownfield projects with PRD: Provides clear enhancement impact analysis
2546
+ - The goal is PRACTICAL documentation for AI agents doing real work
2547
+ ==================== END: tasks#document-project ====================
2548
+
1966
2549
  ==================== START: templates#project-brief-tmpl ====================
1967
2550
  # Project Brief: {{Project Name}}
1968
2551
 
@@ -3254,9 +3837,27 @@ The LLM will:
3254
3837
  - Create a folder structure to organize the sharded documents
3255
3838
  - Maintain all content integrity including code blocks, diagrams, and markdown formatting
3256
3839
 
3257
- ## Recommended Method: @kayvan/markdown-tree-parser
3840
+ ## Primary Method: Automatic with markdown-tree
3841
+
3842
+ [[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}`.
3258
3843
 
3259
- [[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.]]
3844
+ If the command succeeds, inform the user that the document has been sharded successfully and STOP - do not proceed further.
3845
+
3846
+ 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:
3847
+
3848
+ 1. Install @kayvan/markdown-tree-parser globally with: `npm install -g @kayvan/markdown-tree-parser`
3849
+ 2. Or set markdownExploder to false in bmad-core/core-config.yml
3850
+
3851
+ **IMPORTANT: STOP HERE - do not proceed with manual sharding until one of the above actions is taken.**"
3852
+
3853
+ If markdownExploder is set to false, inform the user: "The markdownExploder setting is currently false. For better performance and reliability, you should:
3854
+
3855
+ 1. Set markdownExploder to true in bmad-core/core-config.yml
3856
+ 2. Install @kayvan/markdown-tree-parser globally with: `npm install -g @kayvan/markdown-tree-parser`
3857
+
3858
+ I will now proceed with the manual sharding process."
3859
+
3860
+ Then proceed with the manual method below ONLY if markdownExploder is false.]]
3260
3861
 
3261
3862
  ### Installation and Usage
3262
3863
 
@@ -3289,19 +3890,19 @@ If the user has @kayvan/markdown-tree-parser installed, use it and skip the manu
3289
3890
 
3290
3891
  ---
3291
3892
 
3292
- ## Manual Method (if @kayvan/markdown-tree-parser is not available)
3893
+ ## Manual Method (if @kayvan/markdown-tree-parser is not available or user indicated manual method)
3293
3894
 
3294
3895
  [[LLM: Only proceed with the manual instructions below if the user cannot or does not want to use @kayvan/markdown-tree-parser.]]
3295
3896
 
3296
3897
  ### Task Instructions
3297
3898
 
3298
- ### 1. Identify Document and Target Location
3899
+ 1. Identify Document and Target Location
3299
3900
 
3300
3901
  - Determine which document to shard (user-provided path)
3301
3902
  - Create a new folder under `docs/` with the same name as the document (without extension)
3302
3903
  - Example: `docs/prd.md` → create folder `docs/prd/`
3303
3904
 
3304
- ### 2. Parse and Extract Sections
3905
+ 2. Parse and Extract Sections
3305
3906
 
3306
3907
  [[LLM: When sharding the document:
3307
3908
 
@@ -3311,7 +3912,7 @@ If the user has @kayvan/markdown-tree-parser installed, use it and skip the manu
3311
3912
  - Extract the section heading and ALL content until the next level 2 section
3312
3913
  - Include all subsections, code blocks, diagrams, lists, tables, etc.
3313
3914
  - Be extremely careful with:
3314
- - Fenced code blocks (```) - ensure you capture the full block including closing backticks
3915
+ - 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
3315
3916
  - Mermaid diagrams - preserve the complete diagram syntax
3316
3917
  - Nested markdown elements
3317
3918
  - Multi-line content that might contain ## inside code blocks
@@ -3330,7 +3931,7 @@ For each extracted section:
3330
3931
 
3331
3932
  2. **Adjust heading levels**:
3332
3933
 
3333
- - The level 2 heading becomes level 1 (# instead of ##)
3934
+ - The level 2 heading becomes level 1 (# instead of ##) in the sharded new document
3334
3935
  - All subsection levels decrease by 1:
3335
3936
 
3336
3937
  ```txt
@@ -4440,398 +5041,6 @@ Keep it action-oriented and forward-looking.]]
4440
5041
  None Listed
4441
5042
  ==================== END: data#technical-preferences ====================
4442
5043
 
4443
- ==================== START: tasks#document-project ====================
4444
- # Document an Existing Project
4445
-
4446
- ## Purpose
4447
-
4448
- 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.
4449
-
4450
- ## Task Instructions
4451
-
4452
- ### 1. Initial Project Analysis
4453
-
4454
- [[LLM: Begin by conducting a comprehensive analysis of the existing project. Use available tools to:
4455
-
4456
- 1. **Project Structure Discovery**: Examine the root directory structure, identify main folders, and understand the overall organization
4457
- 2. **Technology Stack Identification**: Look for package.json, requirements.txt, Cargo.toml, pom.xml, etc. to identify languages, frameworks, and dependencies
4458
- 3. **Build System Analysis**: Find build scripts, CI/CD configurations, and development commands
4459
- 4. **Existing Documentation Review**: Check for README files, docs folders, and any existing documentation
4460
- 5. **Code Pattern Analysis**: Sample key files to understand coding patterns, naming conventions, and architectural approaches
4461
-
4462
- Ask the user these elicitation questions to better understand their needs:
4463
-
4464
- - What is the primary purpose of this project?
4465
- - Are there any specific areas of the codebase that are particularly complex or important for agents to understand?
4466
- - What types of tasks do you expect AI agents to perform on this project? (e.g., bug fixes, feature additions, refactoring, testing)
4467
- - Are there any existing documentation standards or formats you prefer?
4468
- - What level of technical detail should the documentation target? (junior developers, senior developers, mixed team)
4469
- ]]
4470
-
4471
- ### 2. Core Documentation Generation
4472
-
4473
- [[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:
4474
-
4475
- **Core Documents (always generate):**
4476
-
4477
- 1. **docs/index.md** - Master documentation index
4478
- 2. **docs/architecture/index.md** - Architecture documentation index
4479
- 3. **docs/architecture/coding-standards.md** - Coding conventions and style guidelines
4480
- 4. **docs/architecture/tech-stack.md** - Technology stack and version constraints
4481
- 5. **docs/architecture/unified-project-structure.md** - Project structure and organization
4482
- 6. **docs/architecture/testing-strategy.md** - Testing approaches and requirements
4483
-
4484
- **Backend Documents (generate for backend/full-stack projects):**
4485
-
4486
- 7. **docs/architecture/backend-architecture.md** - Backend service patterns and structure
4487
- 8. **docs/architecture/rest-api-spec.md** - API endpoint specifications
4488
- 9. **docs/architecture/data-models.md** - Data structures and validation rules
4489
- 10. **docs/architecture/database-schema.md** - Database design and relationships
4490
- 11. **docs/architecture/external-apis.md** - Third-party integrations
4491
-
4492
- **Frontend Documents (generate for frontend/full-stack projects):**
4493
-
4494
- 12. **docs/architecture/frontend-architecture.md** - Frontend patterns and structure
4495
- 13. **docs/architecture/components.md** - UI component specifications
4496
- 14. **docs/architecture/core-workflows.md** - User interaction flows
4497
- 15. **docs/architecture/ui-ux-spec.md** - UI/UX specifications and guidelines
4498
-
4499
- **Additional Documents (generate if applicable):**
4500
-
4501
- 16. **docs/prd.md** - Product requirements document (if not exists)
4502
- 17. **docs/architecture/deployment-guide.md** - Deployment and operations info
4503
- 18. **docs/architecture/security-considerations.md** - Security patterns and requirements
4504
- 19. **docs/architecture/performance-guidelines.md** - Performance optimization patterns
4505
-
4506
- **Optional Enhancement Documents:**
4507
-
4508
- 20. **docs/architecture/troubleshooting-guide.md** - Common issues and solutions
4509
- 21. **docs/architecture/changelog-conventions.md** - Change management practices
4510
- 22. **docs/architecture/code-review-checklist.md** - Review standards and practices
4511
-
4512
- Present each document section by section, using the advanced elicitation task after each major section.]]
4513
-
4514
- ### 3. Document Structure Template
4515
-
4516
- [[LLM: Use this standardized structure for each documentation file, adapting content as needed:
4517
-
4518
- ```markdown
4519
- # {{Document Title}}
4520
-
4521
- ## Overview
4522
-
4523
- {{Brief description of what this document covers and why it's important for AI agents}}
4524
-
4525
- ## Quick Reference
4526
-
4527
- {{Key points, commands, or patterns that agents need most frequently}}
4528
-
4529
- ## Detailed Information
4530
-
4531
- {{Comprehensive information organized into logical sections}}
4532
-
4533
- ## Examples
4534
-
4535
- {{Concrete examples showing proper usage or implementation}}
4536
-
4537
- ## Common Patterns
4538
-
4539
- {{Recurring patterns agents should recognize and follow}}
4540
-
4541
- ## Things to Avoid
4542
-
4543
- {{Anti-patterns, deprecated approaches, or common mistakes}}
4544
-
4545
- ## Related Resources
4546
-
4547
- {{Links to other relevant documentation or external resources}}
4548
- ```
4549
-
4550
- Each document should be:
4551
-
4552
- - **Concrete and actionable** - Focus on what agents need to do, not just concepts
4553
- - **Pattern-focused** - Highlight recurring patterns agents can recognize and replicate
4554
- - **Example-rich** - Include specific code examples and real file references
4555
- - **Context-aware** - Reference actual project files, folders, and conventions
4556
- - **Assumption-free** - Don't assume agents know project history or implicit knowledge
4557
- ]]
4558
-
4559
- ### 4. Content Guidelines for Each Document Type
4560
-
4561
- #### Core Architecture Documents
4562
-
4563
- ##### docs/architecture/index.md
4564
-
4565
- [[LLM: Create a comprehensive index of all architecture documentation:
4566
-
4567
- - List all architecture documents with brief descriptions
4568
- - Group documents by category (backend, frontend, shared)
4569
- - Include quick links to key sections
4570
- - Provide reading order recommendations for different use cases]]
4571
-
4572
- ##### docs/architecture/unified-project-structure.md
4573
-
4574
- [[LLM: Document the complete project structure:
4575
-
4576
- - Root-level directory structure with explanations
4577
- - Where each type of code belongs (backend, frontend, tests, etc.)
4578
- - File naming conventions and patterns
4579
- - Module/package organization
4580
- - Generated vs. source file locations
4581
- - Build output locations]]
4582
-
4583
- ##### docs/architecture/coding-standards.md
4584
-
4585
- [[LLM: Capture project-wide coding conventions:
4586
-
4587
- - Language-specific style guidelines
4588
- - Naming conventions (variables, functions, classes, files)
4589
- - Code organization within files
4590
- - Import/export patterns
4591
- - Comment and documentation standards
4592
- - Linting and formatting tool configurations
4593
- - Git commit message conventions]]
4594
-
4595
- ##### docs/architecture/tech-stack.md
4596
-
4597
- [[LLM: Document all technologies and versions:
4598
-
4599
- - Primary languages and versions
4600
- - Frameworks and major libraries with versions
4601
- - Development tools and their versions
4602
- - Database systems and versions
4603
- - External services and APIs used
4604
- - Browser/runtime requirements]]
4605
-
4606
- ##### docs/architecture/testing-strategy.md
4607
-
4608
- [[LLM: Define testing approaches and requirements:
4609
-
4610
- - Test file locations and naming conventions
4611
- - Unit testing patterns and frameworks
4612
- - Integration testing approaches
4613
- - E2E testing setup (if applicable)
4614
- - Test coverage requirements
4615
- - Mocking strategies
4616
- - Test data management]]
4617
-
4618
- #### Backend Architecture Documents
4619
-
4620
- ##### docs/architecture/backend-architecture.md
4621
-
4622
- [[LLM: Document backend service structure:
4623
-
4624
- - Service layer organization
4625
- - Controller/route patterns
4626
- - Middleware architecture
4627
- - Authentication/authorization patterns
4628
- - Request/response flow
4629
- - Background job processing
4630
- - Service communication patterns]]
4631
-
4632
- ##### docs/architecture/rest-api-spec.md
4633
-
4634
- [[LLM: Specify all API endpoints:
4635
-
4636
- - Base URL and versioning strategy
4637
- - Authentication methods
4638
- - Common headers and parameters
4639
- - Each endpoint with:
4640
- - HTTP method and path
4641
- - Request parameters/body
4642
- - Response format and status codes
4643
- - Error responses
4644
- - Rate limiting and quotas]]
4645
-
4646
- ##### docs/architecture/data-models.md
4647
-
4648
- [[LLM: Define data structures and validation:
4649
-
4650
- - Core business entities
4651
- - Data validation rules
4652
- - Relationships between entities
4653
- - Computed fields and derivations
4654
- - Data transformation patterns
4655
- - Serialization formats]]
4656
-
4657
- ##### docs/architecture/database-schema.md
4658
-
4659
- [[LLM: Document database design:
4660
-
4661
- - Database type and version
4662
- - Table/collection structures
4663
- - Indexes and constraints
4664
- - Relationships and foreign keys
4665
- - Migration patterns
4666
- - Seed data requirements
4667
- - Backup and recovery procedures]]
4668
-
4669
- ##### docs/architecture/external-apis.md
4670
-
4671
- [[LLM: Document third-party integrations:
4672
-
4673
- - List of external services used
4674
- - Authentication methods for each
4675
- - API endpoints and usage patterns
4676
- - Rate limits and quotas
4677
- - Error handling strategies
4678
- - Webhook configurations
4679
- - Data synchronization patterns]]
4680
-
4681
- #### Frontend Architecture Documents
4682
-
4683
- ##### docs/architecture/frontend-architecture.md
4684
-
4685
- [[LLM: Document frontend application structure:
4686
-
4687
- - Component hierarchy and organization
4688
- - State management patterns
4689
- - Routing architecture
4690
- - Data fetching patterns
4691
- - Authentication flow
4692
- - Error boundary strategies
4693
- - Performance optimization patterns]]
4694
-
4695
- ##### docs/architecture/components.md
4696
-
4697
- [[LLM: Specify UI components:
4698
-
4699
- - Component library/design system used
4700
- - Custom component specifications
4701
- - Props and state for each component
4702
- - Component composition patterns
4703
- - Styling approaches
4704
- - Accessibility requirements
4705
- - Component testing patterns]]
4706
-
4707
- ##### docs/architecture/core-workflows.md
4708
-
4709
- [[LLM: Document user interaction flows:
4710
-
4711
- - Major user journeys
4712
- - Screen flow diagrams
4713
- - Form handling patterns
4714
- - Navigation patterns
4715
- - Data flow through workflows
4716
- - Error states and recovery
4717
- - Loading and transition states]]
4718
-
4719
- ##### docs/architecture/ui-ux-spec.md
4720
-
4721
- [[LLM: Define UI/UX guidelines:
4722
-
4723
- - Design system specifications
4724
- - Color palette and typography
4725
- - Spacing and layout grids
4726
- - Responsive breakpoints
4727
- - Animation and transition guidelines
4728
- - Accessibility standards
4729
- - Browser compatibility requirements]]
4730
-
4731
- ### 5. Adaptive Content Strategy
4732
-
4733
- [[LLM: Adapt your documentation approach based on project characteristics:
4734
-
4735
- **For Web Applications:**
4736
-
4737
- - Focus on component patterns, routing, state management
4738
- - Include build processes, asset handling, and deployment
4739
- - Cover API integration patterns and data fetching
4740
-
4741
- **For Backend Services:**
4742
-
4743
- - Emphasize service architecture, data models, and API design
4744
- - Include database interaction patterns and migration strategies
4745
- - Cover authentication, authorization, and security patterns
4746
-
4747
- **For CLI Tools:**
4748
-
4749
- - Focus on command structure, argument parsing, and output formatting
4750
- - Include plugin/extension patterns if applicable
4751
- - Cover configuration file handling and user interaction patterns
4752
-
4753
- **For Libraries/Frameworks:**
4754
-
4755
- - Emphasize public API design and usage patterns
4756
- - Include extension points and customization approaches
4757
- - Cover versioning, compatibility, and migration strategies
4758
-
4759
- **For Mobile Applications:**
4760
-
4761
- - Focus on platform-specific patterns and navigation
4762
- - Include state management and data persistence approaches
4763
- - Cover platform integration and native feature usage
4764
-
4765
- **For Data Science/ML Projects:**
4766
-
4767
- - Emphasize data pipeline patterns and model organization
4768
- - Include experiment tracking and reproducibility approaches
4769
- - Cover data validation and model deployment patterns
4770
- ]]
4771
-
4772
- ### 6. Quality Assurance
4773
-
4774
- [[LLM: Before completing each document:
4775
-
4776
- 1. **Accuracy Check**: Verify all file paths, commands, and code examples work
4777
- 2. **Completeness Review**: Ensure the document covers the most important patterns an agent would encounter
4778
- 3. **Clarity Assessment**: Check that explanations are clear and actionable
4779
- 4. **Consistency Verification**: Ensure terminology and patterns align across all documents
4780
- 5. **Agent Perspective**: Review from the viewpoint of an AI agent that needs to contribute to this project
4781
-
4782
- Ask the user to review each completed document and use the advanced elicitation task to refine based on their feedback.]]
4783
-
4784
- ### 7. Final Integration
4785
-
4786
- [[LLM: After all documents are completed:
4787
-
4788
- 1. Ensure all documents are created in the proper BMAD-expected locations:
4789
-
4790
- - Core docs in `docs/` (index.md, prd.md)
4791
- - Architecture shards in `docs/architecture/` subdirectory
4792
- - Create the `docs/architecture/` directory if it doesn't exist
4793
-
4794
- 2. Create/update the master index documents:
4795
-
4796
- - Update `docs/index.md` to reference all documentation
4797
- - Create `docs/architecture/index.md` listing all architecture shards
4798
-
4799
- 3. Verify document cross-references:
4800
-
4801
- - Ensure all documents link to related documentation
4802
- - Check that file paths match the actual project structure
4803
- - Validate that examples reference real files in the project
4804
-
4805
- 4. Provide maintenance guidance:
4806
-
4807
- - Document update triggers (when to update each doc)
4808
- - Create a simple checklist for keeping docs current
4809
- - Suggest automated validation approaches
4810
-
4811
- 5. Summary report including:
4812
- - List of all documents created with their paths
4813
- - Any gaps or areas needing human review
4814
- - Recommendations for project-specific additions
4815
- - Next steps for maintaining documentation accuracy
4816
-
4817
- Present a summary of what was created and ask if any additional documentation would be helpful for AI agents working on this specific project.]]
4818
-
4819
- ## Success Criteria
4820
-
4821
- - Documentation enables AI agents to understand project context without additional explanation
4822
- - All major architectural patterns and coding conventions are captured
4823
- - Examples reference actual project files and demonstrate real usage
4824
- - Documentation is structured consistently and easy to navigate
4825
- - Content is actionable and focuses on what agents need to do, not just understand
4826
-
4827
- ## Notes
4828
-
4829
- - This task is designed to work with any project type, language, or framework
4830
- - The documentation should reflect the project as it actually is, not as it should be
4831
- - Focus on patterns that agents can recognize and replicate consistently
4832
- - Include both positive examples (what to do) and negative examples (what to avoid)
4833
- ==================== END: tasks#document-project ====================
4834
-
4835
5044
  ==================== START: templates#architecture-tmpl ====================
4836
5045
  # {{Project Name}} Architecture Document
4837
5046
 
@@ -7858,6 +8067,10 @@ Manual Test Steps: [[LLM: Include how if possible the user can manually test the
7858
8067
  [[LLM: (SM Agent) When Drafting Story, leave next prompt in place for dev agent to remove and update - remove this line to the SM]]
7859
8068
  [[LLM: (Dev Agent) Anything the SM needs to know that deviated from the story that might impact drafting the next story.]]
7860
8069
 
8070
+ ### File List
8071
+
8072
+ [[LLM: (Dev Agent) List every new file created, or existing file modified in a bullet list.]]
8073
+
7861
8074
  ### Change Log
7862
8075
 
7863
8076
  [[LLM: (SM Agent) When Drafting Story, leave next prompt in place for dev agent to remove and update- remove this line to the SM]]
@@ -7865,6 +8078,10 @@ Manual Test Steps: [[LLM: Include how if possible the user can manually test the
7865
8078
 
7866
8079
  | Date | Version | Description | Author |
7867
8080
  | :--- | :------ | :---------- | :----- |
8081
+
8082
+ ## QA Results
8083
+
8084
+ [[LLM: QA Agent Results]]
7868
8085
  ==================== END: templates#story-tmpl ====================
7869
8086
 
7870
8087
  ==================== START: checklists#po-master-checklist ====================
@@ -8365,7 +8582,42 @@ workflow:
8365
8582
 
8366
8583
  - workflow_end:
8367
8584
  action: move_to_ide
8368
- 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"
8585
+ notes: |
8586
+ Planning phase complete! Now transition to IDE Development:
8587
+
8588
+ 1. ENSURE DOCUMENTS ARE IN PROJECT:
8589
+ - Copy final prd.md to project's docs/prd.md
8590
+ - Copy final architecture.md to project's docs/architecture.md
8591
+ - All documents must be in the project before proceeding
8592
+
8593
+ 2. SHARD DOCUMENTS (in IDE):
8594
+ - Option A: Use PO agent to shard: @po then ask to shard docs/prd.md
8595
+ - Option B: Manual: Drag shard-doc task + docs/prd.md into chat
8596
+ - This creates docs/prd/ and docs/architecture/ folders with sharded content
8597
+
8598
+ 3. START DEVELOPMENT CYCLE:
8599
+ a. SM Agent (New Chat): @sm → *create
8600
+ - Creates next story from sharded docs
8601
+ - Review and approve story (Draft → Approved)
8602
+
8603
+ b. Dev Agent (New Chat): @dev
8604
+ - Implements approved story
8605
+ - Updates File List with all changes
8606
+ - Marks story as "Review" when complete
8607
+
8608
+ c. QA Agent (New Chat): @qa → review-story
8609
+ - Senior dev review with refactoring ability
8610
+ - Fixes small issues directly
8611
+ - Leaves checklist for remaining items
8612
+ - Updates story status (Review → Done or stays Review)
8613
+
8614
+ d. If QA left unchecked items:
8615
+ - Dev Agent (New Chat): Address remaining items
8616
+ - Return to QA for final approval
8617
+
8618
+ 4. REPEAT: Continue cycle for all epic stories
8619
+
8620
+ Reference: data#bmad-kb:IDE Development Workflow
8369
8621
 
8370
8622
  flow_diagram: |
8371
8623
  ```mermaid
@@ -8457,7 +8709,42 @@ workflow:
8457
8709
 
8458
8710
  - workflow_end:
8459
8711
  action: move_to_ide
8460
- 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"
8712
+ notes: |
8713
+ Planning phase complete! Now transition to IDE Development:
8714
+
8715
+ 1. ENSURE DOCUMENTS ARE IN PROJECT:
8716
+ - Copy final prd.md to project's docs/prd.md
8717
+ - Copy final architecture.md to project's docs/architecture.md
8718
+ - All documents must be in the project before proceeding
8719
+
8720
+ 2. SHARD DOCUMENTS (in IDE):
8721
+ - Option A: Use PO agent to shard: @po then ask to shard docs/prd.md
8722
+ - Option B: Manual: Drag shard-doc task + docs/prd.md into chat
8723
+ - This creates docs/prd/ and docs/architecture/ folders with sharded content
8724
+
8725
+ 3. START DEVELOPMENT CYCLE:
8726
+ a. SM Agent (New Chat): @sm → *create
8727
+ - Creates next story from sharded docs
8728
+ - Review and approve story (Draft → Approved)
8729
+
8730
+ b. Dev Agent (New Chat): @dev
8731
+ - Implements approved story
8732
+ - Updates File List with all changes
8733
+ - Marks story as "Review" when complete
8734
+
8735
+ c. QA Agent (New Chat): @qa → review-story
8736
+ - Senior dev review with refactoring ability
8737
+ - Fixes small issues directly
8738
+ - Leaves checklist for remaining items
8739
+ - Updates story status (Review → Done or stays Review)
8740
+
8741
+ d. If QA left unchecked items:
8742
+ - Dev Agent (New Chat): Address remaining items
8743
+ - Return to QA for final approval
8744
+
8745
+ 4. REPEAT: Continue cycle for all epic stories
8746
+
8747
+ Reference: data#bmad-kb:IDE Development Workflow
8461
8748
 
8462
8749
  flow_diagram: |
8463
8750
  ```mermaid