bmad-method 4.14.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.
@@ -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
@@ -1077,10 +1079,16 @@ This architecture enables seamless operation across environments while maintaini
1077
1079
 
1078
1080
  ## Complete Development Workflow
1079
1081
 
1080
- ### Planning Phase (Web UI Recommended)
1082
+ ### Planning Phase (Web UI Recommended - Especially Gemini!)
1083
+
1084
+ **Ideal for cost efficiency with Gemini's massive context:**
1081
1085
 
1082
- **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
1083
1090
 
1091
+ **For All Projects**:
1084
1092
  1. **Optional Analysis**: `/analyst` - Market research, competitive analysis
1085
1093
  2. **Project Brief**: Create foundation document (Analyst or user)
1086
1094
  3. **PRD Creation**: `/pm create-doc prd` - Comprehensive product requirements
@@ -1184,25 +1192,70 @@ Each status change requires user verification and approval before proceeding.
1184
1192
 
1185
1193
  #### Brownfield Enhancement (Existing Projects)
1186
1194
 
1187
- **Key Concept**: Brownfield development requires generating good documentation for agents to understand your existing project.
1188
-
1189
- **Recommended Approach**:
1190
- 1. **Analysis Phase**: Use Gemini Web or AI Studio with their 1M+ context windows
1191
- 2. **Document Generation**: Ask Architect agent to analyze your project and run `document-project` task
1192
- 3. **PRD Creation**: Even brownfield projects typically need a PRD unless:
1193
- - Very small, focused changes
1194
- - Using `brownfield-create-epic` for single epic without full PRD
1195
- 4. **Architecture Assessment**: Use brownfield-specific templates for complex enhancements
1196
-
1197
- **Brownfield Templates Available**:
1198
- - `brownfield-prd-tmpl.md`: For substantial enhancements requiring multiple stories
1199
- - `brownfield-architecture-tmpl.md`: For complex changes impacting system architecture
1200
- - Both templates emphasize compatibility and integration with existing systems
1201
-
1202
- **When to Skip PRD**:
1203
- - For focused, single-epic work, use `brownfield-create-epic` task with detailed guidance
1204
- - For one-off stories without larger context
1205
- - Note: These tasks will evolve to require some documentation (potentially from `document-project`)
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`
1206
1259
 
1207
1260
  ## Document Creation Best Practices
1208
1261
 
@@ -2173,6 +2226,326 @@ Present these numbered options to the user:
2173
2226
  - Plan for iterative refinement based on initial findings
2174
2227
  ==================== END: tasks#create-deep-research-prompt ====================
2175
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
+
2176
2549
  ==================== START: templates#project-brief-tmpl ====================
2177
2550
  # Project Brief: {{Project Name}}
2178
2551
 
@@ -4668,398 +5041,6 @@ Keep it action-oriented and forward-looking.]]
4668
5041
  None Listed
4669
5042
  ==================== END: data#technical-preferences ====================
4670
5043
 
4671
- ==================== START: tasks#document-project ====================
4672
- # Document an Existing Project
4673
-
4674
- ## Purpose
4675
-
4676
- 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.
4677
-
4678
- ## Task Instructions
4679
-
4680
- ### 1. Initial Project Analysis
4681
-
4682
- [[LLM: Begin by conducting a comprehensive analysis of the existing project. Use available tools to:
4683
-
4684
- 1. **Project Structure Discovery**: Examine the root directory structure, identify main folders, and understand the overall organization
4685
- 2. **Technology Stack Identification**: Look for package.json, requirements.txt, Cargo.toml, pom.xml, etc. to identify languages, frameworks, and dependencies
4686
- 3. **Build System Analysis**: Find build scripts, CI/CD configurations, and development commands
4687
- 4. **Existing Documentation Review**: Check for README files, docs folders, and any existing documentation
4688
- 5. **Code Pattern Analysis**: Sample key files to understand coding patterns, naming conventions, and architectural approaches
4689
-
4690
- Ask the user these elicitation questions to better understand their needs:
4691
-
4692
- - What is the primary purpose of this project?
4693
- - Are there any specific areas of the codebase that are particularly complex or important for agents to understand?
4694
- - What types of tasks do you expect AI agents to perform on this project? (e.g., bug fixes, feature additions, refactoring, testing)
4695
- - Are there any existing documentation standards or formats you prefer?
4696
- - What level of technical detail should the documentation target? (junior developers, senior developers, mixed team)
4697
- ]]
4698
-
4699
- ### 2. Core Documentation Generation
4700
-
4701
- [[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:
4702
-
4703
- **Core Documents (always generate):**
4704
-
4705
- 1. **docs/index.md** - Master documentation index
4706
- 2. **docs/architecture/index.md** - Architecture documentation index
4707
- 3. **docs/architecture/coding-standards.md** - Coding conventions and style guidelines
4708
- 4. **docs/architecture/tech-stack.md** - Technology stack and version constraints
4709
- 5. **docs/architecture/unified-project-structure.md** - Project structure and organization
4710
- 6. **docs/architecture/testing-strategy.md** - Testing approaches and requirements
4711
-
4712
- **Backend Documents (generate for backend/full-stack projects):**
4713
-
4714
- 7. **docs/architecture/backend-architecture.md** - Backend service patterns and structure
4715
- 8. **docs/architecture/rest-api-spec.md** - API endpoint specifications
4716
- 9. **docs/architecture/data-models.md** - Data structures and validation rules
4717
- 10. **docs/architecture/database-schema.md** - Database design and relationships
4718
- 11. **docs/architecture/external-apis.md** - Third-party integrations
4719
-
4720
- **Frontend Documents (generate for frontend/full-stack projects):**
4721
-
4722
- 12. **docs/architecture/frontend-architecture.md** - Frontend patterns and structure
4723
- 13. **docs/architecture/components.md** - UI component specifications
4724
- 14. **docs/architecture/core-workflows.md** - User interaction flows
4725
- 15. **docs/architecture/ui-ux-spec.md** - UI/UX specifications and guidelines
4726
-
4727
- **Additional Documents (generate if applicable):**
4728
-
4729
- 16. **docs/prd.md** - Product requirements document (if not exists)
4730
- 17. **docs/architecture/deployment-guide.md** - Deployment and operations info
4731
- 18. **docs/architecture/security-considerations.md** - Security patterns and requirements
4732
- 19. **docs/architecture/performance-guidelines.md** - Performance optimization patterns
4733
-
4734
- **Optional Enhancement Documents:**
4735
-
4736
- 20. **docs/architecture/troubleshooting-guide.md** - Common issues and solutions
4737
- 21. **docs/architecture/changelog-conventions.md** - Change management practices
4738
- 22. **docs/architecture/code-review-checklist.md** - Review standards and practices
4739
-
4740
- Present each document section by section, using the advanced elicitation task after each major section.]]
4741
-
4742
- ### 3. Document Structure Template
4743
-
4744
- [[LLM: Use this standardized structure for each documentation file, adapting content as needed:
4745
-
4746
- ```markdown
4747
- # {{Document Title}}
4748
-
4749
- ## Overview
4750
-
4751
- {{Brief description of what this document covers and why it's important for AI agents}}
4752
-
4753
- ## Quick Reference
4754
-
4755
- {{Key points, commands, or patterns that agents need most frequently}}
4756
-
4757
- ## Detailed Information
4758
-
4759
- {{Comprehensive information organized into logical sections}}
4760
-
4761
- ## Examples
4762
-
4763
- {{Concrete examples showing proper usage or implementation}}
4764
-
4765
- ## Common Patterns
4766
-
4767
- {{Recurring patterns agents should recognize and follow}}
4768
-
4769
- ## Things to Avoid
4770
-
4771
- {{Anti-patterns, deprecated approaches, or common mistakes}}
4772
-
4773
- ## Related Resources
4774
-
4775
- {{Links to other relevant documentation or external resources}}
4776
- ```
4777
-
4778
- Each document should be:
4779
-
4780
- - **Concrete and actionable** - Focus on what agents need to do, not just concepts
4781
- - **Pattern-focused** - Highlight recurring patterns agents can recognize and replicate
4782
- - **Example-rich** - Include specific code examples and real file references
4783
- - **Context-aware** - Reference actual project files, folders, and conventions
4784
- - **Assumption-free** - Don't assume agents know project history or implicit knowledge
4785
- ]]
4786
-
4787
- ### 4. Content Guidelines for Each Document Type
4788
-
4789
- #### Core Architecture Documents
4790
-
4791
- ##### docs/architecture/index.md
4792
-
4793
- [[LLM: Create a comprehensive index of all architecture documentation:
4794
-
4795
- - List all architecture documents with brief descriptions
4796
- - Group documents by category (backend, frontend, shared)
4797
- - Include quick links to key sections
4798
- - Provide reading order recommendations for different use cases]]
4799
-
4800
- ##### docs/architecture/unified-project-structure.md
4801
-
4802
- [[LLM: Document the complete project structure:
4803
-
4804
- - Root-level directory structure with explanations
4805
- - Where each type of code belongs (backend, frontend, tests, etc.)
4806
- - File naming conventions and patterns
4807
- - Module/package organization
4808
- - Generated vs. source file locations
4809
- - Build output locations]]
4810
-
4811
- ##### docs/architecture/coding-standards.md
4812
-
4813
- [[LLM: Capture project-wide coding conventions:
4814
-
4815
- - Language-specific style guidelines
4816
- - Naming conventions (variables, functions, classes, files)
4817
- - Code organization within files
4818
- - Import/export patterns
4819
- - Comment and documentation standards
4820
- - Linting and formatting tool configurations
4821
- - Git commit message conventions]]
4822
-
4823
- ##### docs/architecture/tech-stack.md
4824
-
4825
- [[LLM: Document all technologies and versions:
4826
-
4827
- - Primary languages and versions
4828
- - Frameworks and major libraries with versions
4829
- - Development tools and their versions
4830
- - Database systems and versions
4831
- - External services and APIs used
4832
- - Browser/runtime requirements]]
4833
-
4834
- ##### docs/architecture/testing-strategy.md
4835
-
4836
- [[LLM: Define testing approaches and requirements:
4837
-
4838
- - Test file locations and naming conventions
4839
- - Unit testing patterns and frameworks
4840
- - Integration testing approaches
4841
- - E2E testing setup (if applicable)
4842
- - Test coverage requirements
4843
- - Mocking strategies
4844
- - Test data management]]
4845
-
4846
- #### Backend Architecture Documents
4847
-
4848
- ##### docs/architecture/backend-architecture.md
4849
-
4850
- [[LLM: Document backend service structure:
4851
-
4852
- - Service layer organization
4853
- - Controller/route patterns
4854
- - Middleware architecture
4855
- - Authentication/authorization patterns
4856
- - Request/response flow
4857
- - Background job processing
4858
- - Service communication patterns]]
4859
-
4860
- ##### docs/architecture/rest-api-spec.md
4861
-
4862
- [[LLM: Specify all API endpoints:
4863
-
4864
- - Base URL and versioning strategy
4865
- - Authentication methods
4866
- - Common headers and parameters
4867
- - Each endpoint with:
4868
- - HTTP method and path
4869
- - Request parameters/body
4870
- - Response format and status codes
4871
- - Error responses
4872
- - Rate limiting and quotas]]
4873
-
4874
- ##### docs/architecture/data-models.md
4875
-
4876
- [[LLM: Define data structures and validation:
4877
-
4878
- - Core business entities
4879
- - Data validation rules
4880
- - Relationships between entities
4881
- - Computed fields and derivations
4882
- - Data transformation patterns
4883
- - Serialization formats]]
4884
-
4885
- ##### docs/architecture/database-schema.md
4886
-
4887
- [[LLM: Document database design:
4888
-
4889
- - Database type and version
4890
- - Table/collection structures
4891
- - Indexes and constraints
4892
- - Relationships and foreign keys
4893
- - Migration patterns
4894
- - Seed data requirements
4895
- - Backup and recovery procedures]]
4896
-
4897
- ##### docs/architecture/external-apis.md
4898
-
4899
- [[LLM: Document third-party integrations:
4900
-
4901
- - List of external services used
4902
- - Authentication methods for each
4903
- - API endpoints and usage patterns
4904
- - Rate limits and quotas
4905
- - Error handling strategies
4906
- - Webhook configurations
4907
- - Data synchronization patterns]]
4908
-
4909
- #### Frontend Architecture Documents
4910
-
4911
- ##### docs/architecture/frontend-architecture.md
4912
-
4913
- [[LLM: Document frontend application structure:
4914
-
4915
- - Component hierarchy and organization
4916
- - State management patterns
4917
- - Routing architecture
4918
- - Data fetching patterns
4919
- - Authentication flow
4920
- - Error boundary strategies
4921
- - Performance optimization patterns]]
4922
-
4923
- ##### docs/architecture/components.md
4924
-
4925
- [[LLM: Specify UI components:
4926
-
4927
- - Component library/design system used
4928
- - Custom component specifications
4929
- - Props and state for each component
4930
- - Component composition patterns
4931
- - Styling approaches
4932
- - Accessibility requirements
4933
- - Component testing patterns]]
4934
-
4935
- ##### docs/architecture/core-workflows.md
4936
-
4937
- [[LLM: Document user interaction flows:
4938
-
4939
- - Major user journeys
4940
- - Screen flow diagrams
4941
- - Form handling patterns
4942
- - Navigation patterns
4943
- - Data flow through workflows
4944
- - Error states and recovery
4945
- - Loading and transition states]]
4946
-
4947
- ##### docs/architecture/ui-ux-spec.md
4948
-
4949
- [[LLM: Define UI/UX guidelines:
4950
-
4951
- - Design system specifications
4952
- - Color palette and typography
4953
- - Spacing and layout grids
4954
- - Responsive breakpoints
4955
- - Animation and transition guidelines
4956
- - Accessibility standards
4957
- - Browser compatibility requirements]]
4958
-
4959
- ### 5. Adaptive Content Strategy
4960
-
4961
- [[LLM: Adapt your documentation approach based on project characteristics:
4962
-
4963
- **For Web Applications:**
4964
-
4965
- - Focus on component patterns, routing, state management
4966
- - Include build processes, asset handling, and deployment
4967
- - Cover API integration patterns and data fetching
4968
-
4969
- **For Backend Services:**
4970
-
4971
- - Emphasize service architecture, data models, and API design
4972
- - Include database interaction patterns and migration strategies
4973
- - Cover authentication, authorization, and security patterns
4974
-
4975
- **For CLI Tools:**
4976
-
4977
- - Focus on command structure, argument parsing, and output formatting
4978
- - Include plugin/extension patterns if applicable
4979
- - Cover configuration file handling and user interaction patterns
4980
-
4981
- **For Libraries/Frameworks:**
4982
-
4983
- - Emphasize public API design and usage patterns
4984
- - Include extension points and customization approaches
4985
- - Cover versioning, compatibility, and migration strategies
4986
-
4987
- **For Mobile Applications:**
4988
-
4989
- - Focus on platform-specific patterns and navigation
4990
- - Include state management and data persistence approaches
4991
- - Cover platform integration and native feature usage
4992
-
4993
- **For Data Science/ML Projects:**
4994
-
4995
- - Emphasize data pipeline patterns and model organization
4996
- - Include experiment tracking and reproducibility approaches
4997
- - Cover data validation and model deployment patterns
4998
- ]]
4999
-
5000
- ### 6. Quality Assurance
5001
-
5002
- [[LLM: Before completing each document:
5003
-
5004
- 1. **Accuracy Check**: Verify all file paths, commands, and code examples work
5005
- 2. **Completeness Review**: Ensure the document covers the most important patterns an agent would encounter
5006
- 3. **Clarity Assessment**: Check that explanations are clear and actionable
5007
- 4. **Consistency Verification**: Ensure terminology and patterns align across all documents
5008
- 5. **Agent Perspective**: Review from the viewpoint of an AI agent that needs to contribute to this project
5009
-
5010
- Ask the user to review each completed document and use the advanced elicitation task to refine based on their feedback.]]
5011
-
5012
- ### 7. Final Integration
5013
-
5014
- [[LLM: After all documents are completed:
5015
-
5016
- 1. Ensure all documents are created in the proper BMAD-expected locations:
5017
-
5018
- - Core docs in `docs/` (index.md, prd.md)
5019
- - Architecture shards in `docs/architecture/` subdirectory
5020
- - Create the `docs/architecture/` directory if it doesn't exist
5021
-
5022
- 2. Create/update the master index documents:
5023
-
5024
- - Update `docs/index.md` to reference all documentation
5025
- - Create `docs/architecture/index.md` listing all architecture shards
5026
-
5027
- 3. Verify document cross-references:
5028
-
5029
- - Ensure all documents link to related documentation
5030
- - Check that file paths match the actual project structure
5031
- - Validate that examples reference real files in the project
5032
-
5033
- 4. Provide maintenance guidance:
5034
-
5035
- - Document update triggers (when to update each doc)
5036
- - Create a simple checklist for keeping docs current
5037
- - Suggest automated validation approaches
5038
-
5039
- 5. Summary report including:
5040
- - List of all documents created with their paths
5041
- - Any gaps or areas needing human review
5042
- - Recommendations for project-specific additions
5043
- - Next steps for maintaining documentation accuracy
5044
-
5045
- Present a summary of what was created and ask if any additional documentation would be helpful for AI agents working on this specific project.]]
5046
-
5047
- ## Success Criteria
5048
-
5049
- - Documentation enables AI agents to understand project context without additional explanation
5050
- - All major architectural patterns and coding conventions are captured
5051
- - Examples reference actual project files and demonstrate real usage
5052
- - Documentation is structured consistently and easy to navigate
5053
- - Content is actionable and focuses on what agents need to do, not just understand
5054
-
5055
- ## Notes
5056
-
5057
- - This task is designed to work with any project type, language, or framework
5058
- - The documentation should reflect the project as it actually is, not as it should be
5059
- - Focus on patterns that agents can recognize and replicate consistently
5060
- - Include both positive examples (what to do) and negative examples (what to avoid)
5061
- ==================== END: tasks#document-project ====================
5062
-
5063
5044
  ==================== START: templates#architecture-tmpl ====================
5064
5045
  # {{Project Name}} Architecture Document
5065
5046