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.
@@ -200,7 +200,7 @@ agent:
200
200
  id: analyst
201
201
  title: Business Analyst
202
202
  icon: 📊
203
- whenToUse: Use for market research, brainstorming, competitive analysis, creating project briefs, and initial project discovery
203
+ whenToUse: Use for market research, brainstorming, competitive analysis, creating project briefs, initial project discovery, and documenting existing projects (brownfield)
204
204
  customization: null
205
205
  persona:
206
206
  role: Insightful Analyst & Strategic Ideation Partner
@@ -228,6 +228,7 @@ commands:
228
228
  - brainstorm {topic}: Facilitate structured brainstorming session
229
229
  - research {topic}: Generate deep research prompt for investigation
230
230
  - elicit: Run advanced elicitation to clarify requirements
231
+ - document-project: Analyze and document existing project structure comprehensively
231
232
  - exit: Say goodbye as the Business Analyst, and then abandon inhabiting this persona
232
233
  dependencies:
233
234
  tasks:
@@ -235,6 +236,7 @@ dependencies:
235
236
  - create-deep-research-prompt
236
237
  - create-doc
237
238
  - advanced-elicitation
239
+ - document-project
238
240
  templates:
239
241
  - project-brief-tmpl
240
242
  - market-research-tmpl
@@ -1145,10 +1147,16 @@ This architecture enables seamless operation across environments while maintaini
1145
1147
 
1146
1148
  ## Complete Development Workflow
1147
1149
 
1148
- ### Planning Phase (Web UI Recommended)
1150
+ ### Planning Phase (Web UI Recommended - Especially Gemini!)
1151
+
1152
+ **Ideal for cost efficiency with Gemini's massive context:**
1149
1153
 
1150
- **Ideal for cost efficiency, especially with Gemini:**
1154
+ **For Brownfield Projects - Start Here!**:
1155
+ 1. **Upload entire project to Gemini Web** (GitHub URL, files, or zip)
1156
+ 2. **Document existing system**: `/analyst` → `*document-project`
1157
+ 3. **Creates comprehensive docs** from entire codebase analysis
1151
1158
 
1159
+ **For All Projects**:
1152
1160
  1. **Optional Analysis**: `/analyst` - Market research, competitive analysis
1153
1161
  2. **Project Brief**: Create foundation document (Analyst or user)
1154
1162
  3. **PRD Creation**: `/pm create-doc prd` - Comprehensive product requirements
@@ -1252,25 +1260,70 @@ Each status change requires user verification and approval before proceeding.
1252
1260
 
1253
1261
  #### Brownfield Enhancement (Existing Projects)
1254
1262
 
1255
- **Key Concept**: Brownfield development requires generating good documentation for agents to understand your existing project.
1256
-
1257
- **Recommended Approach**:
1258
- 1. **Analysis Phase**: Use Gemini Web or AI Studio with their 1M+ context windows
1259
- 2. **Document Generation**: Ask Architect agent to analyze your project and run `document-project` task
1260
- 3. **PRD Creation**: Even brownfield projects typically need a PRD unless:
1261
- - Very small, focused changes
1262
- - Using `brownfield-create-epic` for single epic without full PRD
1263
- 4. **Architecture Assessment**: Use brownfield-specific templates for complex enhancements
1264
-
1265
- **Brownfield Templates Available**:
1266
- - `brownfield-prd-tmpl.md`: For substantial enhancements requiring multiple stories
1267
- - `brownfield-architecture-tmpl.md`: For complex changes impacting system architecture
1268
- - Both templates emphasize compatibility and integration with existing systems
1269
-
1270
- **When to Skip PRD**:
1271
- - For focused, single-epic work, use `brownfield-create-epic` task with detailed guidance
1272
- - For one-off stories without larger context
1273
- - Note: These tasks will evolve to require some documentation (potentially from `document-project`)
1263
+ **Key Concept**: Brownfield development requires comprehensive documentation of your existing project for AI agents to understand context, patterns, and constraints.
1264
+
1265
+ **Complete Brownfield Workflow Options**:
1266
+
1267
+ **Option 1: PRD-First (Recommended for Large Codebases/Monorepos)**:
1268
+ 1. **Upload project to Gemini Web** (GitHub URL, files, or zip)
1269
+ 2. **Create PRD first**: `@pm` → `*create-doc brownfield-prd`
1270
+ 3. **Focused documentation**: `@analyst` → `*document-project`
1271
+ - Analyst asks for focus if no PRD provided
1272
+ - Choose "single document" format for Web UI
1273
+ - Uses PRD to document ONLY relevant areas
1274
+ - Creates one comprehensive markdown file
1275
+ - Avoids bloating docs with unused code
1276
+
1277
+ **Option 2: Document-First (Good for Smaller Projects)**:
1278
+ 1. **Upload project to Gemini Web**
1279
+ 2. **Document everything**: `@analyst` `*document-project`
1280
+ 3. **Then create PRD**: `@pm` `*create-doc brownfield-prd`
1281
+ - More thorough but can create excessive documentation
1282
+
1283
+ 2. **Requirements Gathering**:
1284
+ - **Brownfield PRD**: Use PM agent with `brownfield-prd-tmpl`
1285
+ - **Analyzes**: Existing system, constraints, integration points
1286
+ - **Defines**: Enhancement scope, compatibility requirements, risk assessment
1287
+ - **Creates**: Epic and story structure for changes
1288
+
1289
+ 3. **Architecture Planning**:
1290
+ - **Brownfield Architecture**: Use Architect agent with `brownfield-architecture-tmpl`
1291
+ - **Integration Strategy**: How new features integrate with existing system
1292
+ - **Migration Planning**: Gradual rollout and backwards compatibility
1293
+ - **Risk Mitigation**: Addressing potential breaking changes
1294
+
1295
+ **Brownfield-Specific Resources**:
1296
+
1297
+ **Templates**:
1298
+ - `brownfield-prd-tmpl.md`: Comprehensive enhancement planning with existing system analysis
1299
+ - `brownfield-architecture-tmpl.md`: Integration-focused architecture for existing systems
1300
+
1301
+ **Tasks**:
1302
+ - `document-project`: Generates comprehensive documentation from existing codebase
1303
+ - `brownfield-create-epic`: Creates single epic for focused enhancements (when full PRD is overkill)
1304
+ - `brownfield-create-story`: Creates individual story for small, isolated changes
1305
+
1306
+ **When to Use Each Approach**:
1307
+
1308
+ **Full Brownfield Workflow** (Recommended for):
1309
+ - Major feature additions
1310
+ - System modernization
1311
+ - Complex integrations
1312
+ - Multiple related changes
1313
+
1314
+ **Quick Epic/Story Creation** (Use when):
1315
+ - Single, focused enhancement
1316
+ - Isolated bug fixes
1317
+ - Small feature additions
1318
+ - Well-documented existing system
1319
+
1320
+ **Critical Success Factors**:
1321
+ 1. **Documentation First**: Always run `document-project` if docs are outdated/missing
1322
+ 2. **Context Matters**: Provide agents access to relevant code sections
1323
+ 3. **Integration Focus**: Emphasize compatibility and non-breaking changes
1324
+ 4. **Incremental Approach**: Plan for gradual rollout and testing
1325
+
1326
+ **For detailed guide**: See `docs/working-in-the-brownfield.md`
1274
1327
 
1275
1328
  ## Document Creation Best Practices
1276
1329
 
@@ -2241,6 +2294,326 @@ Present these numbered options to the user:
2241
2294
  - Plan for iterative refinement based on initial findings
2242
2295
  ==================== END: tasks#create-deep-research-prompt ====================
2243
2296
 
2297
+ ==================== START: tasks#document-project ====================
2298
+ # Document an Existing Project
2299
+
2300
+ ## Purpose
2301
+
2302
+ Generate comprehensive documentation for existing projects optimized for AI development agents. This task creates structured reference materials that enable AI agents to understand project context, conventions, and patterns for effective contribution to any codebase.
2303
+
2304
+ ## Task Instructions
2305
+
2306
+ ### 1. Initial Project Analysis
2307
+
2308
+ [[LLM: First, check if a PRD or requirements document exists in context. If yes, use it to focus your documentation efforts on relevant areas only.
2309
+
2310
+ **IF PRD EXISTS**:
2311
+
2312
+ - Review the PRD to understand what enhancement/feature is planned
2313
+ - Identify which modules, services, or areas will be affected
2314
+ - Focus documentation ONLY on these relevant areas
2315
+ - Skip unrelated parts of the codebase to keep docs lean
2316
+
2317
+ **IF NO PRD EXISTS**:
2318
+ Ask the user:
2319
+
2320
+ "I notice you haven't provided a PRD or requirements document. To create more focused and useful documentation, I recommend one of these options:
2321
+
2322
+ 1. **Create a PRD first** - Would you like me to help create a brownfield PRD before documenting? This helps focus documentation on relevant areas.
2323
+
2324
+ 2. **Provide existing requirements** - Do you have a requirements document, epic, or feature description you can share?
2325
+
2326
+ 3. **Describe the focus** - Can you briefly describe what enhancement or feature you're planning? For example:
2327
+ - 'Adding payment processing to the user service'
2328
+ - 'Refactoring the authentication module'
2329
+ - 'Integrating with a new third-party API'
2330
+
2331
+ 4. **Document everything** - Or should I proceed with comprehensive documentation of the entire codebase? (Note: This may create excessive documentation for large projects)
2332
+
2333
+ Please let me know your preference, or I can proceed with full documentation if you prefer."
2334
+
2335
+ Based on their response:
2336
+
2337
+ - If they choose option 1-3: Use that context to focus documentation
2338
+ - If they choose option 4 or decline: Proceed with comprehensive analysis below
2339
+
2340
+ Begin by conducting analysis of the existing project. Use available tools to:
2341
+
2342
+ 1. **Project Structure Discovery**: Examine the root directory structure, identify main folders, and understand the overall organization
2343
+ 2. **Technology Stack Identification**: Look for package.json, requirements.txt, Cargo.toml, pom.xml, etc. to identify languages, frameworks, and dependencies
2344
+ 3. **Build System Analysis**: Find build scripts, CI/CD configurations, and development commands
2345
+ 4. **Existing Documentation Review**: Check for README files, docs folders, and any existing documentation
2346
+ 5. **Code Pattern Analysis**: Sample key files to understand coding patterns, naming conventions, and architectural approaches
2347
+
2348
+ Ask the user these elicitation questions to better understand their needs:
2349
+
2350
+ - What is the primary purpose of this project?
2351
+ - Are there any specific areas of the codebase that are particularly complex or important for agents to understand?
2352
+ - What types of tasks do you expect AI agents to perform on this project? (e.g., bug fixes, feature additions, refactoring, testing)
2353
+ - Are there any existing documentation standards or formats you prefer?
2354
+ - What level of technical detail should the documentation target? (junior developers, senior developers, mixed team)
2355
+ - Is there a specific feature or enhancement you're planning? (This helps focus documentation)
2356
+ ]]
2357
+
2358
+ ### 2. Deep Codebase Analysis
2359
+
2360
+ [[LLM: Before generating documentation, conduct extensive analysis of the existing codebase:
2361
+
2362
+ 1. **Explore Key Areas**:
2363
+ - Entry points (main files, index files, app initializers)
2364
+ - Configuration files and environment setup
2365
+ - Package dependencies and versions
2366
+ - Build and deployment configurations
2367
+ - Test suites and coverage
2368
+
2369
+ 2. **Ask Clarifying Questions**:
2370
+ - "I see you're using [technology X]. Are there any custom patterns or conventions I should document?"
2371
+ - "What are the most critical/complex parts of this system that developers struggle with?"
2372
+ - "Are there any undocumented 'tribal knowledge' areas I should capture?"
2373
+ - "What technical debt or known issues should I document?"
2374
+ - "Which parts of the codebase change most frequently?"
2375
+
2376
+ 3. **Map the Reality**:
2377
+ - Identify ACTUAL patterns used (not theoretical best practices)
2378
+ - Find where key business logic lives
2379
+ - Locate integration points and external dependencies
2380
+ - Document workarounds and technical debt
2381
+ - Note areas that differ from standard patterns
2382
+
2383
+ **IF PRD PROVIDED**: Also analyze what would need to change for the enhancement]]
2384
+
2385
+ ### 3. Core Documentation Generation
2386
+
2387
+ [[LLM: Generate a comprehensive BROWNFIELD architecture document that reflects the ACTUAL state of the codebase.
2388
+
2389
+ **CRITICAL**: This is NOT an aspirational architecture document. Document what EXISTS, including:
2390
+ - Technical debt and workarounds
2391
+ - Inconsistent patterns between different parts
2392
+ - Legacy code that can't be changed
2393
+ - Integration constraints
2394
+ - Performance bottlenecks
2395
+
2396
+ **Document Structure**:
2397
+
2398
+ # [Project Name] Brownfield Architecture Document
2399
+
2400
+ ## Introduction
2401
+ This document captures the CURRENT STATE of the [Project Name] codebase, including technical debt, workarounds, and real-world patterns. It serves as a reference for AI agents working on enhancements.
2402
+
2403
+ ### Document Scope
2404
+ [If PRD provided: "Focused on areas relevant to: {enhancement description}"]
2405
+ [If no PRD: "Comprehensive documentation of entire system"]
2406
+
2407
+ ### Change Log
2408
+ | Date | Version | Description | Author |
2409
+ |------|---------|-------------|--------|
2410
+ | [Date] | 1.0 | Initial brownfield analysis | [Analyst] |
2411
+
2412
+ ## Quick Reference - Key Files and Entry Points
2413
+
2414
+ ### Critical Files for Understanding the System
2415
+ - **Main Entry**: `src/index.js` (or actual entry point)
2416
+ - **Configuration**: `config/app.config.js`, `.env.example`
2417
+ - **Core Business Logic**: `src/services/`, `src/domain/`
2418
+ - **API Definitions**: `src/routes/` or link to OpenAPI spec
2419
+ - **Database Models**: `src/models/` or link to schema files
2420
+ - **Key Algorithms**: [List specific files with complex logic]
2421
+
2422
+ ### If PRD Provided - Enhancement Impact Areas
2423
+ [Highlight which files/modules will be affected by the planned enhancement]
2424
+
2425
+ ## High Level Architecture
2426
+
2427
+ ### Technical Summary
2428
+ [Real assessment of architecture - mention if it's well-structured or has issues]
2429
+
2430
+ ### Actual Tech Stack (from package.json/requirements.txt)
2431
+ | Category | Technology | Version | Notes |
2432
+ |----------|------------|---------|--------|
2433
+ | Runtime | Node.js | 16.x | [Any constraints] |
2434
+ | Framework | Express | 4.18.2 | [Custom middleware?] |
2435
+ | Database | PostgreSQL | 13 | [Connection pooling setup] |
2436
+ | [etc...] |
2437
+
2438
+ ### Repository Structure Reality Check
2439
+ - Type: [Monorepo/Polyrepo/Hybrid]
2440
+ - Package Manager: [npm/yarn/pnpm]
2441
+ - Notable: [Any unusual structure decisions]
2442
+
2443
+ ## Source Tree and Module Organization
2444
+
2445
+ ### Project Structure (Actual)
2446
+ ```
2447
+ project-root/
2448
+ ├── src/
2449
+ │ ├── controllers/ # HTTP request handlers
2450
+ │ ├── services/ # Business logic (NOTE: inconsistent patterns between user and payment services)
2451
+ │ ├── models/ # Database models (Sequelize)
2452
+ │ ├── utils/ # Mixed bag - needs refactoring
2453
+ │ └── legacy/ # DO NOT MODIFY - old payment system still in use
2454
+ ├── tests/ # Jest tests (60% coverage)
2455
+ ├── scripts/ # Build and deployment scripts
2456
+ └── config/ # Environment configs
2457
+ ```
2458
+
2459
+ ### Key Modules and Their Purpose
2460
+ - **User Management**: `src/services/userService.js` - Handles all user operations
2461
+ - **Authentication**: `src/middleware/auth.js` - JWT-based, custom implementation
2462
+ - **Payment Processing**: `src/legacy/payment.js` - CRITICAL: Do not refactor, tightly coupled
2463
+ - **[List other key modules with their actual files]**
2464
+
2465
+ ## Data Models and APIs
2466
+
2467
+ ### Data Models
2468
+ Instead of duplicating, reference actual model files:
2469
+ - **User Model**: See `src/models/User.js`
2470
+ - **Order Model**: See `src/models/Order.js`
2471
+ - **Related Types**: TypeScript definitions in `src/types/`
2472
+
2473
+ ### API Specifications
2474
+ - **OpenAPI Spec**: `docs/api/openapi.yaml` (if exists)
2475
+ - **Postman Collection**: `docs/api/postman-collection.json`
2476
+ - **Manual Endpoints**: [List any undocumented endpoints discovered]
2477
+
2478
+ ## Technical Debt and Known Issues
2479
+
2480
+ ### Critical Technical Debt
2481
+ 1. **Payment Service**: Legacy code in `src/legacy/payment.js` - tightly coupled, no tests
2482
+ 2. **User Service**: Different pattern than other services, uses callbacks instead of promises
2483
+ 3. **Database Migrations**: Manually tracked, no proper migration tool
2484
+ 4. **[Other significant debt]**
2485
+
2486
+ ### Workarounds and Gotchas
2487
+ - **Environment Variables**: Must set `NODE_ENV=production` even for staging (historical reason)
2488
+ - **Database Connections**: Connection pool hardcoded to 10, changing breaks payment service
2489
+ - **[Other workarounds developers need to know]**
2490
+
2491
+ ## Integration Points and External Dependencies
2492
+
2493
+ ### External Services
2494
+ | Service | Purpose | Integration Type | Key Files |
2495
+ |---------|---------|------------------|-----------|
2496
+ | Stripe | Payments | REST API | `src/integrations/stripe/` |
2497
+ | SendGrid | Emails | SDK | `src/services/emailService.js` |
2498
+ | [etc...] |
2499
+
2500
+ ### Internal Integration Points
2501
+ - **Frontend Communication**: REST API on port 3000, expects specific headers
2502
+ - **Background Jobs**: Redis queue, see `src/workers/`
2503
+ - **[Other integrations]**
2504
+
2505
+ ## Development and Deployment
2506
+
2507
+ ### Local Development Setup
2508
+ 1. Actual steps that work (not ideal steps)
2509
+ 2. Known issues with setup
2510
+ 3. Required environment variables (see `.env.example`)
2511
+
2512
+ ### Build and Deployment Process
2513
+ - **Build Command**: `npm run build` (webpack config in `webpack.config.js`)
2514
+ - **Deployment**: Manual deployment via `scripts/deploy.sh`
2515
+ - **Environments**: Dev, Staging, Prod (see `config/environments/`)
2516
+
2517
+ ## Testing Reality
2518
+
2519
+ ### Current Test Coverage
2520
+ - Unit Tests: 60% coverage (Jest)
2521
+ - Integration Tests: Minimal, in `tests/integration/`
2522
+ - E2E Tests: None
2523
+ - Manual Testing: Primary QA method
2524
+
2525
+ ### Running Tests
2526
+ ```bash
2527
+ npm test # Runs unit tests
2528
+ npm run test:integration # Runs integration tests (requires local DB)
2529
+ ```
2530
+
2531
+ ## If Enhancement PRD Provided - Impact Analysis
2532
+
2533
+ ### Files That Will Need Modification
2534
+ Based on the enhancement requirements, these files will be affected:
2535
+ - `src/services/userService.js` - Add new user fields
2536
+ - `src/models/User.js` - Update schema
2537
+ - `src/routes/userRoutes.js` - New endpoints
2538
+ - [etc...]
2539
+
2540
+ ### New Files/Modules Needed
2541
+ - `src/services/newFeatureService.js` - New business logic
2542
+ - `src/models/NewFeature.js` - New data model
2543
+ - [etc...]
2544
+
2545
+ ### Integration Considerations
2546
+ - Will need to integrate with existing auth middleware
2547
+ - Must follow existing response format in `src/utils/responseFormatter.js`
2548
+ - [Other integration points]
2549
+
2550
+ ## Appendix - Useful Commands and Scripts
2551
+
2552
+ ### Frequently Used Commands
2553
+ ```bash
2554
+ npm run dev # Start development server
2555
+ npm run build # Production build
2556
+ npm run migrate # Run database migrations
2557
+ npm run seed # Seed test data
2558
+ ```
2559
+
2560
+ ### Debugging and Troubleshooting
2561
+ - **Logs**: Check `logs/app.log` for application logs
2562
+ - **Debug Mode**: Set `DEBUG=app:*` for verbose logging
2563
+ - **Common Issues**: See `docs/troubleshooting.md`]]
2564
+
2565
+ ### 4. Document Delivery
2566
+
2567
+ [[LLM: After generating the complete architecture document:
2568
+
2569
+ 1. **In Web UI (Gemini, ChatGPT, Claude)**:
2570
+ - Present the entire document in one response (or multiple if too long)
2571
+ - Tell user to copy and save as `docs/brownfield-architecture.md` or `docs/project-architecture.md`
2572
+ - Mention it can be sharded later in IDE if needed
2573
+
2574
+ 2. **In IDE Environment**:
2575
+ - Create the document as `docs/brownfield-architecture.md`
2576
+ - Inform user this single document contains all architectural information
2577
+ - Can be sharded later using PO agent if desired
2578
+
2579
+ The document should be comprehensive enough that future agents can understand:
2580
+ - The actual state of the system (not idealized)
2581
+ - Where to find key files and logic
2582
+ - What technical debt exists
2583
+ - What constraints must be respected
2584
+ - If PRD provided: What needs to change for the enhancement]]
2585
+
2586
+ ### 5. Quality Assurance
2587
+
2588
+ [[LLM: Before finalizing the document:
2589
+
2590
+ 1. **Accuracy Check**: Verify all technical details match the actual codebase
2591
+ 2. **Completeness Review**: Ensure all major system components are documented
2592
+ 3. **Focus Validation**: If user provided scope, verify relevant areas are emphasized
2593
+ 4. **Clarity Assessment**: Check that explanations are clear for AI agents
2594
+ 5. **Navigation**: Ensure document has clear section structure for easy reference
2595
+
2596
+ Apply the advanced elicitation task after major sections to refine based on user feedback.]]
2597
+
2598
+ ## Success Criteria
2599
+
2600
+ - Single comprehensive brownfield architecture document created
2601
+ - Document reflects REALITY including technical debt and workarounds
2602
+ - Key files and modules are referenced with actual paths
2603
+ - Models/APIs reference source files rather than duplicating content
2604
+ - If PRD provided: Clear impact analysis showing what needs to change
2605
+ - Document enables AI agents to navigate and understand the actual codebase
2606
+ - Technical constraints and "gotchas" are clearly documented
2607
+
2608
+ ## Notes
2609
+
2610
+ - This task creates ONE document that captures the TRUE state of the system
2611
+ - References actual files rather than duplicating content when possible
2612
+ - Documents technical debt, workarounds, and constraints honestly
2613
+ - For brownfield projects with PRD: Provides clear enhancement impact analysis
2614
+ - The goal is PRACTICAL documentation for AI agents doing real work
2615
+ ==================== END: tasks#document-project ====================
2616
+
2244
2617
  ==================== START: templates#project-brief-tmpl ====================
2245
2618
  # Project Brief: {{Project Name}}
2246
2619
 
@@ -5206,398 +5579,6 @@ After presenting this section, apply `tasks#advanced-elicitation` protocol]]
5206
5579
  [[LLM: If a UI/UX checklist exists, run it against this document and report results here.]]
5207
5580
  ==================== END: templates#front-end-spec-tmpl ====================
5208
5581
 
5209
- ==================== START: tasks#document-project ====================
5210
- # Document an Existing Project
5211
-
5212
- ## Purpose
5213
-
5214
- 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.
5215
-
5216
- ## Task Instructions
5217
-
5218
- ### 1. Initial Project Analysis
5219
-
5220
- [[LLM: Begin by conducting a comprehensive analysis of the existing project. Use available tools to:
5221
-
5222
- 1. **Project Structure Discovery**: Examine the root directory structure, identify main folders, and understand the overall organization
5223
- 2. **Technology Stack Identification**: Look for package.json, requirements.txt, Cargo.toml, pom.xml, etc. to identify languages, frameworks, and dependencies
5224
- 3. **Build System Analysis**: Find build scripts, CI/CD configurations, and development commands
5225
- 4. **Existing Documentation Review**: Check for README files, docs folders, and any existing documentation
5226
- 5. **Code Pattern Analysis**: Sample key files to understand coding patterns, naming conventions, and architectural approaches
5227
-
5228
- Ask the user these elicitation questions to better understand their needs:
5229
-
5230
- - What is the primary purpose of this project?
5231
- - Are there any specific areas of the codebase that are particularly complex or important for agents to understand?
5232
- - What types of tasks do you expect AI agents to perform on this project? (e.g., bug fixes, feature additions, refactoring, testing)
5233
- - Are there any existing documentation standards or formats you prefer?
5234
- - What level of technical detail should the documentation target? (junior developers, senior developers, mixed team)
5235
- ]]
5236
-
5237
- ### 2. Core Documentation Generation
5238
-
5239
- [[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:
5240
-
5241
- **Core Documents (always generate):**
5242
-
5243
- 1. **docs/index.md** - Master documentation index
5244
- 2. **docs/architecture/index.md** - Architecture documentation index
5245
- 3. **docs/architecture/coding-standards.md** - Coding conventions and style guidelines
5246
- 4. **docs/architecture/tech-stack.md** - Technology stack and version constraints
5247
- 5. **docs/architecture/unified-project-structure.md** - Project structure and organization
5248
- 6. **docs/architecture/testing-strategy.md** - Testing approaches and requirements
5249
-
5250
- **Backend Documents (generate for backend/full-stack projects):**
5251
-
5252
- 7. **docs/architecture/backend-architecture.md** - Backend service patterns and structure
5253
- 8. **docs/architecture/rest-api-spec.md** - API endpoint specifications
5254
- 9. **docs/architecture/data-models.md** - Data structures and validation rules
5255
- 10. **docs/architecture/database-schema.md** - Database design and relationships
5256
- 11. **docs/architecture/external-apis.md** - Third-party integrations
5257
-
5258
- **Frontend Documents (generate for frontend/full-stack projects):**
5259
-
5260
- 12. **docs/architecture/frontend-architecture.md** - Frontend patterns and structure
5261
- 13. **docs/architecture/components.md** - UI component specifications
5262
- 14. **docs/architecture/core-workflows.md** - User interaction flows
5263
- 15. **docs/architecture/ui-ux-spec.md** - UI/UX specifications and guidelines
5264
-
5265
- **Additional Documents (generate if applicable):**
5266
-
5267
- 16. **docs/prd.md** - Product requirements document (if not exists)
5268
- 17. **docs/architecture/deployment-guide.md** - Deployment and operations info
5269
- 18. **docs/architecture/security-considerations.md** - Security patterns and requirements
5270
- 19. **docs/architecture/performance-guidelines.md** - Performance optimization patterns
5271
-
5272
- **Optional Enhancement Documents:**
5273
-
5274
- 20. **docs/architecture/troubleshooting-guide.md** - Common issues and solutions
5275
- 21. **docs/architecture/changelog-conventions.md** - Change management practices
5276
- 22. **docs/architecture/code-review-checklist.md** - Review standards and practices
5277
-
5278
- Present each document section by section, using the advanced elicitation task after each major section.]]
5279
-
5280
- ### 3. Document Structure Template
5281
-
5282
- [[LLM: Use this standardized structure for each documentation file, adapting content as needed:
5283
-
5284
- ```markdown
5285
- # {{Document Title}}
5286
-
5287
- ## Overview
5288
-
5289
- {{Brief description of what this document covers and why it's important for AI agents}}
5290
-
5291
- ## Quick Reference
5292
-
5293
- {{Key points, commands, or patterns that agents need most frequently}}
5294
-
5295
- ## Detailed Information
5296
-
5297
- {{Comprehensive information organized into logical sections}}
5298
-
5299
- ## Examples
5300
-
5301
- {{Concrete examples showing proper usage or implementation}}
5302
-
5303
- ## Common Patterns
5304
-
5305
- {{Recurring patterns agents should recognize and follow}}
5306
-
5307
- ## Things to Avoid
5308
-
5309
- {{Anti-patterns, deprecated approaches, or common mistakes}}
5310
-
5311
- ## Related Resources
5312
-
5313
- {{Links to other relevant documentation or external resources}}
5314
- ```
5315
-
5316
- Each document should be:
5317
-
5318
- - **Concrete and actionable** - Focus on what agents need to do, not just concepts
5319
- - **Pattern-focused** - Highlight recurring patterns agents can recognize and replicate
5320
- - **Example-rich** - Include specific code examples and real file references
5321
- - **Context-aware** - Reference actual project files, folders, and conventions
5322
- - **Assumption-free** - Don't assume agents know project history or implicit knowledge
5323
- ]]
5324
-
5325
- ### 4. Content Guidelines for Each Document Type
5326
-
5327
- #### Core Architecture Documents
5328
-
5329
- ##### docs/architecture/index.md
5330
-
5331
- [[LLM: Create a comprehensive index of all architecture documentation:
5332
-
5333
- - List all architecture documents with brief descriptions
5334
- - Group documents by category (backend, frontend, shared)
5335
- - Include quick links to key sections
5336
- - Provide reading order recommendations for different use cases]]
5337
-
5338
- ##### docs/architecture/unified-project-structure.md
5339
-
5340
- [[LLM: Document the complete project structure:
5341
-
5342
- - Root-level directory structure with explanations
5343
- - Where each type of code belongs (backend, frontend, tests, etc.)
5344
- - File naming conventions and patterns
5345
- - Module/package organization
5346
- - Generated vs. source file locations
5347
- - Build output locations]]
5348
-
5349
- ##### docs/architecture/coding-standards.md
5350
-
5351
- [[LLM: Capture project-wide coding conventions:
5352
-
5353
- - Language-specific style guidelines
5354
- - Naming conventions (variables, functions, classes, files)
5355
- - Code organization within files
5356
- - Import/export patterns
5357
- - Comment and documentation standards
5358
- - Linting and formatting tool configurations
5359
- - Git commit message conventions]]
5360
-
5361
- ##### docs/architecture/tech-stack.md
5362
-
5363
- [[LLM: Document all technologies and versions:
5364
-
5365
- - Primary languages and versions
5366
- - Frameworks and major libraries with versions
5367
- - Development tools and their versions
5368
- - Database systems and versions
5369
- - External services and APIs used
5370
- - Browser/runtime requirements]]
5371
-
5372
- ##### docs/architecture/testing-strategy.md
5373
-
5374
- [[LLM: Define testing approaches and requirements:
5375
-
5376
- - Test file locations and naming conventions
5377
- - Unit testing patterns and frameworks
5378
- - Integration testing approaches
5379
- - E2E testing setup (if applicable)
5380
- - Test coverage requirements
5381
- - Mocking strategies
5382
- - Test data management]]
5383
-
5384
- #### Backend Architecture Documents
5385
-
5386
- ##### docs/architecture/backend-architecture.md
5387
-
5388
- [[LLM: Document backend service structure:
5389
-
5390
- - Service layer organization
5391
- - Controller/route patterns
5392
- - Middleware architecture
5393
- - Authentication/authorization patterns
5394
- - Request/response flow
5395
- - Background job processing
5396
- - Service communication patterns]]
5397
-
5398
- ##### docs/architecture/rest-api-spec.md
5399
-
5400
- [[LLM: Specify all API endpoints:
5401
-
5402
- - Base URL and versioning strategy
5403
- - Authentication methods
5404
- - Common headers and parameters
5405
- - Each endpoint with:
5406
- - HTTP method and path
5407
- - Request parameters/body
5408
- - Response format and status codes
5409
- - Error responses
5410
- - Rate limiting and quotas]]
5411
-
5412
- ##### docs/architecture/data-models.md
5413
-
5414
- [[LLM: Define data structures and validation:
5415
-
5416
- - Core business entities
5417
- - Data validation rules
5418
- - Relationships between entities
5419
- - Computed fields and derivations
5420
- - Data transformation patterns
5421
- - Serialization formats]]
5422
-
5423
- ##### docs/architecture/database-schema.md
5424
-
5425
- [[LLM: Document database design:
5426
-
5427
- - Database type and version
5428
- - Table/collection structures
5429
- - Indexes and constraints
5430
- - Relationships and foreign keys
5431
- - Migration patterns
5432
- - Seed data requirements
5433
- - Backup and recovery procedures]]
5434
-
5435
- ##### docs/architecture/external-apis.md
5436
-
5437
- [[LLM: Document third-party integrations:
5438
-
5439
- - List of external services used
5440
- - Authentication methods for each
5441
- - API endpoints and usage patterns
5442
- - Rate limits and quotas
5443
- - Error handling strategies
5444
- - Webhook configurations
5445
- - Data synchronization patterns]]
5446
-
5447
- #### Frontend Architecture Documents
5448
-
5449
- ##### docs/architecture/frontend-architecture.md
5450
-
5451
- [[LLM: Document frontend application structure:
5452
-
5453
- - Component hierarchy and organization
5454
- - State management patterns
5455
- - Routing architecture
5456
- - Data fetching patterns
5457
- - Authentication flow
5458
- - Error boundary strategies
5459
- - Performance optimization patterns]]
5460
-
5461
- ##### docs/architecture/components.md
5462
-
5463
- [[LLM: Specify UI components:
5464
-
5465
- - Component library/design system used
5466
- - Custom component specifications
5467
- - Props and state for each component
5468
- - Component composition patterns
5469
- - Styling approaches
5470
- - Accessibility requirements
5471
- - Component testing patterns]]
5472
-
5473
- ##### docs/architecture/core-workflows.md
5474
-
5475
- [[LLM: Document user interaction flows:
5476
-
5477
- - Major user journeys
5478
- - Screen flow diagrams
5479
- - Form handling patterns
5480
- - Navigation patterns
5481
- - Data flow through workflows
5482
- - Error states and recovery
5483
- - Loading and transition states]]
5484
-
5485
- ##### docs/architecture/ui-ux-spec.md
5486
-
5487
- [[LLM: Define UI/UX guidelines:
5488
-
5489
- - Design system specifications
5490
- - Color palette and typography
5491
- - Spacing and layout grids
5492
- - Responsive breakpoints
5493
- - Animation and transition guidelines
5494
- - Accessibility standards
5495
- - Browser compatibility requirements]]
5496
-
5497
- ### 5. Adaptive Content Strategy
5498
-
5499
- [[LLM: Adapt your documentation approach based on project characteristics:
5500
-
5501
- **For Web Applications:**
5502
-
5503
- - Focus on component patterns, routing, state management
5504
- - Include build processes, asset handling, and deployment
5505
- - Cover API integration patterns and data fetching
5506
-
5507
- **For Backend Services:**
5508
-
5509
- - Emphasize service architecture, data models, and API design
5510
- - Include database interaction patterns and migration strategies
5511
- - Cover authentication, authorization, and security patterns
5512
-
5513
- **For CLI Tools:**
5514
-
5515
- - Focus on command structure, argument parsing, and output formatting
5516
- - Include plugin/extension patterns if applicable
5517
- - Cover configuration file handling and user interaction patterns
5518
-
5519
- **For Libraries/Frameworks:**
5520
-
5521
- - Emphasize public API design and usage patterns
5522
- - Include extension points and customization approaches
5523
- - Cover versioning, compatibility, and migration strategies
5524
-
5525
- **For Mobile Applications:**
5526
-
5527
- - Focus on platform-specific patterns and navigation
5528
- - Include state management and data persistence approaches
5529
- - Cover platform integration and native feature usage
5530
-
5531
- **For Data Science/ML Projects:**
5532
-
5533
- - Emphasize data pipeline patterns and model organization
5534
- - Include experiment tracking and reproducibility approaches
5535
- - Cover data validation and model deployment patterns
5536
- ]]
5537
-
5538
- ### 6. Quality Assurance
5539
-
5540
- [[LLM: Before completing each document:
5541
-
5542
- 1. **Accuracy Check**: Verify all file paths, commands, and code examples work
5543
- 2. **Completeness Review**: Ensure the document covers the most important patterns an agent would encounter
5544
- 3. **Clarity Assessment**: Check that explanations are clear and actionable
5545
- 4. **Consistency Verification**: Ensure terminology and patterns align across all documents
5546
- 5. **Agent Perspective**: Review from the viewpoint of an AI agent that needs to contribute to this project
5547
-
5548
- Ask the user to review each completed document and use the advanced elicitation task to refine based on their feedback.]]
5549
-
5550
- ### 7. Final Integration
5551
-
5552
- [[LLM: After all documents are completed:
5553
-
5554
- 1. Ensure all documents are created in the proper BMAD-expected locations:
5555
-
5556
- - Core docs in `docs/` (index.md, prd.md)
5557
- - Architecture shards in `docs/architecture/` subdirectory
5558
- - Create the `docs/architecture/` directory if it doesn't exist
5559
-
5560
- 2. Create/update the master index documents:
5561
-
5562
- - Update `docs/index.md` to reference all documentation
5563
- - Create `docs/architecture/index.md` listing all architecture shards
5564
-
5565
- 3. Verify document cross-references:
5566
-
5567
- - Ensure all documents link to related documentation
5568
- - Check that file paths match the actual project structure
5569
- - Validate that examples reference real files in the project
5570
-
5571
- 4. Provide maintenance guidance:
5572
-
5573
- - Document update triggers (when to update each doc)
5574
- - Create a simple checklist for keeping docs current
5575
- - Suggest automated validation approaches
5576
-
5577
- 5. Summary report including:
5578
- - List of all documents created with their paths
5579
- - Any gaps or areas needing human review
5580
- - Recommendations for project-specific additions
5581
- - Next steps for maintaining documentation accuracy
5582
-
5583
- Present a summary of what was created and ask if any additional documentation would be helpful for AI agents working on this specific project.]]
5584
-
5585
- ## Success Criteria
5586
-
5587
- - Documentation enables AI agents to understand project context without additional explanation
5588
- - All major architectural patterns and coding conventions are captured
5589
- - Examples reference actual project files and demonstrate real usage
5590
- - Documentation is structured consistently and easy to navigate
5591
- - Content is actionable and focuses on what agents need to do, not just understand
5592
-
5593
- ## Notes
5594
-
5595
- - This task is designed to work with any project type, language, or framework
5596
- - The documentation should reflect the project as it actually is, not as it should be
5597
- - Focus on patterns that agents can recognize and replicate consistently
5598
- - Include both positive examples (what to do) and negative examples (what to avoid)
5599
- ==================== END: tasks#document-project ====================
5600
-
5601
5582
  ==================== START: templates#architecture-tmpl ====================
5602
5583
  # {{Project Name}} Architecture Document
5603
5584