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.
@@ -196,7 +196,7 @@ agent:
196
196
  id: analyst
197
197
  title: Business Analyst
198
198
  icon: 📊
199
- whenToUse: Use for market research, brainstorming, competitive analysis, creating project briefs, and initial project discovery
199
+ whenToUse: Use for market research, brainstorming, competitive analysis, creating project briefs, initial project discovery, and documenting existing projects (brownfield)
200
200
  customization: null
201
201
  persona:
202
202
  role: Insightful Analyst & Strategic Ideation Partner
@@ -224,6 +224,7 @@ commands:
224
224
  - brainstorm {topic}: Facilitate structured brainstorming session
225
225
  - research {topic}: Generate deep research prompt for investigation
226
226
  - elicit: Run advanced elicitation to clarify requirements
227
+ - document-project: Analyze and document existing project structure comprehensively
227
228
  - exit: Say goodbye as the Business Analyst, and then abandon inhabiting this persona
228
229
  dependencies:
229
230
  tasks:
@@ -231,6 +232,7 @@ dependencies:
231
232
  - create-deep-research-prompt
232
233
  - create-doc
233
234
  - advanced-elicitation
235
+ - document-project
234
236
  templates:
235
237
  - project-brief-tmpl
236
238
  - market-research-tmpl
@@ -1301,10 +1303,16 @@ This architecture enables seamless operation across environments while maintaini
1301
1303
 
1302
1304
  ## Complete Development Workflow
1303
1305
 
1304
- ### Planning Phase (Web UI Recommended)
1306
+ ### Planning Phase (Web UI Recommended - Especially Gemini!)
1307
+
1308
+ **Ideal for cost efficiency with Gemini's massive context:**
1305
1309
 
1306
- **Ideal for cost efficiency, especially with Gemini:**
1310
+ **For Brownfield Projects - Start Here!**:
1311
+ 1. **Upload entire project to Gemini Web** (GitHub URL, files, or zip)
1312
+ 2. **Document existing system**: `/analyst` → `*document-project`
1313
+ 3. **Creates comprehensive docs** from entire codebase analysis
1307
1314
 
1315
+ **For All Projects**:
1308
1316
  1. **Optional Analysis**: `/analyst` - Market research, competitive analysis
1309
1317
  2. **Project Brief**: Create foundation document (Analyst or user)
1310
1318
  3. **PRD Creation**: `/pm create-doc prd` - Comprehensive product requirements
@@ -1408,25 +1416,70 @@ Each status change requires user verification and approval before proceeding.
1408
1416
 
1409
1417
  #### Brownfield Enhancement (Existing Projects)
1410
1418
 
1411
- **Key Concept**: Brownfield development requires generating good documentation for agents to understand your existing project.
1412
-
1413
- **Recommended Approach**:
1414
- 1. **Analysis Phase**: Use Gemini Web or AI Studio with their 1M+ context windows
1415
- 2. **Document Generation**: Ask Architect agent to analyze your project and run `document-project` task
1416
- 3. **PRD Creation**: Even brownfield projects typically need a PRD unless:
1417
- - Very small, focused changes
1418
- - Using `brownfield-create-epic` for single epic without full PRD
1419
- 4. **Architecture Assessment**: Use brownfield-specific templates for complex enhancements
1420
-
1421
- **Brownfield Templates Available**:
1422
- - `brownfield-prd-tmpl.md`: For substantial enhancements requiring multiple stories
1423
- - `brownfield-architecture-tmpl.md`: For complex changes impacting system architecture
1424
- - Both templates emphasize compatibility and integration with existing systems
1425
-
1426
- **When to Skip PRD**:
1427
- - For focused, single-epic work, use `brownfield-create-epic` task with detailed guidance
1428
- - For one-off stories without larger context
1429
- - Note: These tasks will evolve to require some documentation (potentially from `document-project`)
1419
+ **Key Concept**: Brownfield development requires comprehensive documentation of your existing project for AI agents to understand context, patterns, and constraints.
1420
+
1421
+ **Complete Brownfield Workflow Options**:
1422
+
1423
+ **Option 1: PRD-First (Recommended for Large Codebases/Monorepos)**:
1424
+ 1. **Upload project to Gemini Web** (GitHub URL, files, or zip)
1425
+ 2. **Create PRD first**: `@pm` → `*create-doc brownfield-prd`
1426
+ 3. **Focused documentation**: `@analyst` → `*document-project`
1427
+ - Analyst asks for focus if no PRD provided
1428
+ - Choose "single document" format for Web UI
1429
+ - Uses PRD to document ONLY relevant areas
1430
+ - Creates one comprehensive markdown file
1431
+ - Avoids bloating docs with unused code
1432
+
1433
+ **Option 2: Document-First (Good for Smaller Projects)**:
1434
+ 1. **Upload project to Gemini Web**
1435
+ 2. **Document everything**: `@analyst` `*document-project`
1436
+ 3. **Then create PRD**: `@pm` `*create-doc brownfield-prd`
1437
+ - More thorough but can create excessive documentation
1438
+
1439
+ 2. **Requirements Gathering**:
1440
+ - **Brownfield PRD**: Use PM agent with `brownfield-prd-tmpl`
1441
+ - **Analyzes**: Existing system, constraints, integration points
1442
+ - **Defines**: Enhancement scope, compatibility requirements, risk assessment
1443
+ - **Creates**: Epic and story structure for changes
1444
+
1445
+ 3. **Architecture Planning**:
1446
+ - **Brownfield Architecture**: Use Architect agent with `brownfield-architecture-tmpl`
1447
+ - **Integration Strategy**: How new features integrate with existing system
1448
+ - **Migration Planning**: Gradual rollout and backwards compatibility
1449
+ - **Risk Mitigation**: Addressing potential breaking changes
1450
+
1451
+ **Brownfield-Specific Resources**:
1452
+
1453
+ **Templates**:
1454
+ - `brownfield-prd-tmpl.md`: Comprehensive enhancement planning with existing system analysis
1455
+ - `brownfield-architecture-tmpl.md`: Integration-focused architecture for existing systems
1456
+
1457
+ **Tasks**:
1458
+ - `document-project`: Generates comprehensive documentation from existing codebase
1459
+ - `brownfield-create-epic`: Creates single epic for focused enhancements (when full PRD is overkill)
1460
+ - `brownfield-create-story`: Creates individual story for small, isolated changes
1461
+
1462
+ **When to Use Each Approach**:
1463
+
1464
+ **Full Brownfield Workflow** (Recommended for):
1465
+ - Major feature additions
1466
+ - System modernization
1467
+ - Complex integrations
1468
+ - Multiple related changes
1469
+
1470
+ **Quick Epic/Story Creation** (Use when):
1471
+ - Single, focused enhancement
1472
+ - Isolated bug fixes
1473
+ - Small feature additions
1474
+ - Well-documented existing system
1475
+
1476
+ **Critical Success Factors**:
1477
+ 1. **Documentation First**: Always run `document-project` if docs are outdated/missing
1478
+ 2. **Context Matters**: Provide agents access to relevant code sections
1479
+ 3. **Integration Focus**: Emphasize compatibility and non-breaking changes
1480
+ 4. **Incremental Approach**: Plan for gradual rollout and testing
1481
+
1482
+ **For detailed guide**: See `docs/working-in-the-brownfield.md`
1430
1483
 
1431
1484
  ## Document Creation Best Practices
1432
1485
 
@@ -2397,6 +2450,326 @@ Present these numbered options to the user:
2397
2450
  - Plan for iterative refinement based on initial findings
2398
2451
  ==================== END: tasks#create-deep-research-prompt ====================
2399
2452
 
2453
+ ==================== START: tasks#document-project ====================
2454
+ # Document an Existing Project
2455
+
2456
+ ## Purpose
2457
+
2458
+ 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.
2459
+
2460
+ ## Task Instructions
2461
+
2462
+ ### 1. Initial Project Analysis
2463
+
2464
+ [[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.
2465
+
2466
+ **IF PRD EXISTS**:
2467
+
2468
+ - Review the PRD to understand what enhancement/feature is planned
2469
+ - Identify which modules, services, or areas will be affected
2470
+ - Focus documentation ONLY on these relevant areas
2471
+ - Skip unrelated parts of the codebase to keep docs lean
2472
+
2473
+ **IF NO PRD EXISTS**:
2474
+ Ask the user:
2475
+
2476
+ "I notice you haven't provided a PRD or requirements document. To create more focused and useful documentation, I recommend one of these options:
2477
+
2478
+ 1. **Create a PRD first** - Would you like me to help create a brownfield PRD before documenting? This helps focus documentation on relevant areas.
2479
+
2480
+ 2. **Provide existing requirements** - Do you have a requirements document, epic, or feature description you can share?
2481
+
2482
+ 3. **Describe the focus** - Can you briefly describe what enhancement or feature you're planning? For example:
2483
+ - 'Adding payment processing to the user service'
2484
+ - 'Refactoring the authentication module'
2485
+ - 'Integrating with a new third-party API'
2486
+
2487
+ 4. **Document everything** - Or should I proceed with comprehensive documentation of the entire codebase? (Note: This may create excessive documentation for large projects)
2488
+
2489
+ Please let me know your preference, or I can proceed with full documentation if you prefer."
2490
+
2491
+ Based on their response:
2492
+
2493
+ - If they choose option 1-3: Use that context to focus documentation
2494
+ - If they choose option 4 or decline: Proceed with comprehensive analysis below
2495
+
2496
+ Begin by conducting analysis of the existing project. Use available tools to:
2497
+
2498
+ 1. **Project Structure Discovery**: Examine the root directory structure, identify main folders, and understand the overall organization
2499
+ 2. **Technology Stack Identification**: Look for package.json, requirements.txt, Cargo.toml, pom.xml, etc. to identify languages, frameworks, and dependencies
2500
+ 3. **Build System Analysis**: Find build scripts, CI/CD configurations, and development commands
2501
+ 4. **Existing Documentation Review**: Check for README files, docs folders, and any existing documentation
2502
+ 5. **Code Pattern Analysis**: Sample key files to understand coding patterns, naming conventions, and architectural approaches
2503
+
2504
+ Ask the user these elicitation questions to better understand their needs:
2505
+
2506
+ - What is the primary purpose of this project?
2507
+ - Are there any specific areas of the codebase that are particularly complex or important for agents to understand?
2508
+ - What types of tasks do you expect AI agents to perform on this project? (e.g., bug fixes, feature additions, refactoring, testing)
2509
+ - Are there any existing documentation standards or formats you prefer?
2510
+ - What level of technical detail should the documentation target? (junior developers, senior developers, mixed team)
2511
+ - Is there a specific feature or enhancement you're planning? (This helps focus documentation)
2512
+ ]]
2513
+
2514
+ ### 2. Deep Codebase Analysis
2515
+
2516
+ [[LLM: Before generating documentation, conduct extensive analysis of the existing codebase:
2517
+
2518
+ 1. **Explore Key Areas**:
2519
+ - Entry points (main files, index files, app initializers)
2520
+ - Configuration files and environment setup
2521
+ - Package dependencies and versions
2522
+ - Build and deployment configurations
2523
+ - Test suites and coverage
2524
+
2525
+ 2. **Ask Clarifying Questions**:
2526
+ - "I see you're using [technology X]. Are there any custom patterns or conventions I should document?"
2527
+ - "What are the most critical/complex parts of this system that developers struggle with?"
2528
+ - "Are there any undocumented 'tribal knowledge' areas I should capture?"
2529
+ - "What technical debt or known issues should I document?"
2530
+ - "Which parts of the codebase change most frequently?"
2531
+
2532
+ 3. **Map the Reality**:
2533
+ - Identify ACTUAL patterns used (not theoretical best practices)
2534
+ - Find where key business logic lives
2535
+ - Locate integration points and external dependencies
2536
+ - Document workarounds and technical debt
2537
+ - Note areas that differ from standard patterns
2538
+
2539
+ **IF PRD PROVIDED**: Also analyze what would need to change for the enhancement]]
2540
+
2541
+ ### 3. Core Documentation Generation
2542
+
2543
+ [[LLM: Generate a comprehensive BROWNFIELD architecture document that reflects the ACTUAL state of the codebase.
2544
+
2545
+ **CRITICAL**: This is NOT an aspirational architecture document. Document what EXISTS, including:
2546
+ - Technical debt and workarounds
2547
+ - Inconsistent patterns between different parts
2548
+ - Legacy code that can't be changed
2549
+ - Integration constraints
2550
+ - Performance bottlenecks
2551
+
2552
+ **Document Structure**:
2553
+
2554
+ # [Project Name] Brownfield Architecture Document
2555
+
2556
+ ## Introduction
2557
+ 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.
2558
+
2559
+ ### Document Scope
2560
+ [If PRD provided: "Focused on areas relevant to: {enhancement description}"]
2561
+ [If no PRD: "Comprehensive documentation of entire system"]
2562
+
2563
+ ### Change Log
2564
+ | Date | Version | Description | Author |
2565
+ |------|---------|-------------|--------|
2566
+ | [Date] | 1.0 | Initial brownfield analysis | [Analyst] |
2567
+
2568
+ ## Quick Reference - Key Files and Entry Points
2569
+
2570
+ ### Critical Files for Understanding the System
2571
+ - **Main Entry**: `src/index.js` (or actual entry point)
2572
+ - **Configuration**: `config/app.config.js`, `.env.example`
2573
+ - **Core Business Logic**: `src/services/`, `src/domain/`
2574
+ - **API Definitions**: `src/routes/` or link to OpenAPI spec
2575
+ - **Database Models**: `src/models/` or link to schema files
2576
+ - **Key Algorithms**: [List specific files with complex logic]
2577
+
2578
+ ### If PRD Provided - Enhancement Impact Areas
2579
+ [Highlight which files/modules will be affected by the planned enhancement]
2580
+
2581
+ ## High Level Architecture
2582
+
2583
+ ### Technical Summary
2584
+ [Real assessment of architecture - mention if it's well-structured or has issues]
2585
+
2586
+ ### Actual Tech Stack (from package.json/requirements.txt)
2587
+ | Category | Technology | Version | Notes |
2588
+ |----------|------------|---------|--------|
2589
+ | Runtime | Node.js | 16.x | [Any constraints] |
2590
+ | Framework | Express | 4.18.2 | [Custom middleware?] |
2591
+ | Database | PostgreSQL | 13 | [Connection pooling setup] |
2592
+ | [etc...] |
2593
+
2594
+ ### Repository Structure Reality Check
2595
+ - Type: [Monorepo/Polyrepo/Hybrid]
2596
+ - Package Manager: [npm/yarn/pnpm]
2597
+ - Notable: [Any unusual structure decisions]
2598
+
2599
+ ## Source Tree and Module Organization
2600
+
2601
+ ### Project Structure (Actual)
2602
+ ```
2603
+ project-root/
2604
+ ├── src/
2605
+ │ ├── controllers/ # HTTP request handlers
2606
+ │ ├── services/ # Business logic (NOTE: inconsistent patterns between user and payment services)
2607
+ │ ├── models/ # Database models (Sequelize)
2608
+ │ ├── utils/ # Mixed bag - needs refactoring
2609
+ │ └── legacy/ # DO NOT MODIFY - old payment system still in use
2610
+ ├── tests/ # Jest tests (60% coverage)
2611
+ ├── scripts/ # Build and deployment scripts
2612
+ └── config/ # Environment configs
2613
+ ```
2614
+
2615
+ ### Key Modules and Their Purpose
2616
+ - **User Management**: `src/services/userService.js` - Handles all user operations
2617
+ - **Authentication**: `src/middleware/auth.js` - JWT-based, custom implementation
2618
+ - **Payment Processing**: `src/legacy/payment.js` - CRITICAL: Do not refactor, tightly coupled
2619
+ - **[List other key modules with their actual files]**
2620
+
2621
+ ## Data Models and APIs
2622
+
2623
+ ### Data Models
2624
+ Instead of duplicating, reference actual model files:
2625
+ - **User Model**: See `src/models/User.js`
2626
+ - **Order Model**: See `src/models/Order.js`
2627
+ - **Related Types**: TypeScript definitions in `src/types/`
2628
+
2629
+ ### API Specifications
2630
+ - **OpenAPI Spec**: `docs/api/openapi.yaml` (if exists)
2631
+ - **Postman Collection**: `docs/api/postman-collection.json`
2632
+ - **Manual Endpoints**: [List any undocumented endpoints discovered]
2633
+
2634
+ ## Technical Debt and Known Issues
2635
+
2636
+ ### Critical Technical Debt
2637
+ 1. **Payment Service**: Legacy code in `src/legacy/payment.js` - tightly coupled, no tests
2638
+ 2. **User Service**: Different pattern than other services, uses callbacks instead of promises
2639
+ 3. **Database Migrations**: Manually tracked, no proper migration tool
2640
+ 4. **[Other significant debt]**
2641
+
2642
+ ### Workarounds and Gotchas
2643
+ - **Environment Variables**: Must set `NODE_ENV=production` even for staging (historical reason)
2644
+ - **Database Connections**: Connection pool hardcoded to 10, changing breaks payment service
2645
+ - **[Other workarounds developers need to know]**
2646
+
2647
+ ## Integration Points and External Dependencies
2648
+
2649
+ ### External Services
2650
+ | Service | Purpose | Integration Type | Key Files |
2651
+ |---------|---------|------------------|-----------|
2652
+ | Stripe | Payments | REST API | `src/integrations/stripe/` |
2653
+ | SendGrid | Emails | SDK | `src/services/emailService.js` |
2654
+ | [etc...] |
2655
+
2656
+ ### Internal Integration Points
2657
+ - **Frontend Communication**: REST API on port 3000, expects specific headers
2658
+ - **Background Jobs**: Redis queue, see `src/workers/`
2659
+ - **[Other integrations]**
2660
+
2661
+ ## Development and Deployment
2662
+
2663
+ ### Local Development Setup
2664
+ 1. Actual steps that work (not ideal steps)
2665
+ 2. Known issues with setup
2666
+ 3. Required environment variables (see `.env.example`)
2667
+
2668
+ ### Build and Deployment Process
2669
+ - **Build Command**: `npm run build` (webpack config in `webpack.config.js`)
2670
+ - **Deployment**: Manual deployment via `scripts/deploy.sh`
2671
+ - **Environments**: Dev, Staging, Prod (see `config/environments/`)
2672
+
2673
+ ## Testing Reality
2674
+
2675
+ ### Current Test Coverage
2676
+ - Unit Tests: 60% coverage (Jest)
2677
+ - Integration Tests: Minimal, in `tests/integration/`
2678
+ - E2E Tests: None
2679
+ - Manual Testing: Primary QA method
2680
+
2681
+ ### Running Tests
2682
+ ```bash
2683
+ npm test # Runs unit tests
2684
+ npm run test:integration # Runs integration tests (requires local DB)
2685
+ ```
2686
+
2687
+ ## If Enhancement PRD Provided - Impact Analysis
2688
+
2689
+ ### Files That Will Need Modification
2690
+ Based on the enhancement requirements, these files will be affected:
2691
+ - `src/services/userService.js` - Add new user fields
2692
+ - `src/models/User.js` - Update schema
2693
+ - `src/routes/userRoutes.js` - New endpoints
2694
+ - [etc...]
2695
+
2696
+ ### New Files/Modules Needed
2697
+ - `src/services/newFeatureService.js` - New business logic
2698
+ - `src/models/NewFeature.js` - New data model
2699
+ - [etc...]
2700
+
2701
+ ### Integration Considerations
2702
+ - Will need to integrate with existing auth middleware
2703
+ - Must follow existing response format in `src/utils/responseFormatter.js`
2704
+ - [Other integration points]
2705
+
2706
+ ## Appendix - Useful Commands and Scripts
2707
+
2708
+ ### Frequently Used Commands
2709
+ ```bash
2710
+ npm run dev # Start development server
2711
+ npm run build # Production build
2712
+ npm run migrate # Run database migrations
2713
+ npm run seed # Seed test data
2714
+ ```
2715
+
2716
+ ### Debugging and Troubleshooting
2717
+ - **Logs**: Check `logs/app.log` for application logs
2718
+ - **Debug Mode**: Set `DEBUG=app:*` for verbose logging
2719
+ - **Common Issues**: See `docs/troubleshooting.md`]]
2720
+
2721
+ ### 4. Document Delivery
2722
+
2723
+ [[LLM: After generating the complete architecture document:
2724
+
2725
+ 1. **In Web UI (Gemini, ChatGPT, Claude)**:
2726
+ - Present the entire document in one response (or multiple if too long)
2727
+ - Tell user to copy and save as `docs/brownfield-architecture.md` or `docs/project-architecture.md`
2728
+ - Mention it can be sharded later in IDE if needed
2729
+
2730
+ 2. **In IDE Environment**:
2731
+ - Create the document as `docs/brownfield-architecture.md`
2732
+ - Inform user this single document contains all architectural information
2733
+ - Can be sharded later using PO agent if desired
2734
+
2735
+ The document should be comprehensive enough that future agents can understand:
2736
+ - The actual state of the system (not idealized)
2737
+ - Where to find key files and logic
2738
+ - What technical debt exists
2739
+ - What constraints must be respected
2740
+ - If PRD provided: What needs to change for the enhancement]]
2741
+
2742
+ ### 5. Quality Assurance
2743
+
2744
+ [[LLM: Before finalizing the document:
2745
+
2746
+ 1. **Accuracy Check**: Verify all technical details match the actual codebase
2747
+ 2. **Completeness Review**: Ensure all major system components are documented
2748
+ 3. **Focus Validation**: If user provided scope, verify relevant areas are emphasized
2749
+ 4. **Clarity Assessment**: Check that explanations are clear for AI agents
2750
+ 5. **Navigation**: Ensure document has clear section structure for easy reference
2751
+
2752
+ Apply the advanced elicitation task after major sections to refine based on user feedback.]]
2753
+
2754
+ ## Success Criteria
2755
+
2756
+ - Single comprehensive brownfield architecture document created
2757
+ - Document reflects REALITY including technical debt and workarounds
2758
+ - Key files and modules are referenced with actual paths
2759
+ - Models/APIs reference source files rather than duplicating content
2760
+ - If PRD provided: Clear impact analysis showing what needs to change
2761
+ - Document enables AI agents to navigate and understand the actual codebase
2762
+ - Technical constraints and "gotchas" are clearly documented
2763
+
2764
+ ## Notes
2765
+
2766
+ - This task creates ONE document that captures the TRUE state of the system
2767
+ - References actual files rather than duplicating content when possible
2768
+ - Documents technical debt, workarounds, and constraints honestly
2769
+ - For brownfield projects with PRD: Provides clear enhancement impact analysis
2770
+ - The goal is PRACTICAL documentation for AI agents doing real work
2771
+ ==================== END: tasks#document-project ====================
2772
+
2400
2773
  ==================== START: templates#project-brief-tmpl ====================
2401
2774
  # Project Brief: {{Project Name}}
2402
2775
 
@@ -3190,398 +3563,6 @@ These replace the standard elicitation options when working on market research d
3190
3563
  These replace the standard elicitation options when working on competitive analysis documents.]]
3191
3564
  ==================== END: templates#competitor-analysis-tmpl ====================
3192
3565
 
3193
- ==================== START: tasks#document-project ====================
3194
- # Document an Existing Project
3195
-
3196
- ## Purpose
3197
-
3198
- 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.
3199
-
3200
- ## Task Instructions
3201
-
3202
- ### 1. Initial Project Analysis
3203
-
3204
- [[LLM: Begin by conducting a comprehensive analysis of the existing project. Use available tools to:
3205
-
3206
- 1. **Project Structure Discovery**: Examine the root directory structure, identify main folders, and understand the overall organization
3207
- 2. **Technology Stack Identification**: Look for package.json, requirements.txt, Cargo.toml, pom.xml, etc. to identify languages, frameworks, and dependencies
3208
- 3. **Build System Analysis**: Find build scripts, CI/CD configurations, and development commands
3209
- 4. **Existing Documentation Review**: Check for README files, docs folders, and any existing documentation
3210
- 5. **Code Pattern Analysis**: Sample key files to understand coding patterns, naming conventions, and architectural approaches
3211
-
3212
- Ask the user these elicitation questions to better understand their needs:
3213
-
3214
- - What is the primary purpose of this project?
3215
- - Are there any specific areas of the codebase that are particularly complex or important for agents to understand?
3216
- - What types of tasks do you expect AI agents to perform on this project? (e.g., bug fixes, feature additions, refactoring, testing)
3217
- - Are there any existing documentation standards or formats you prefer?
3218
- - What level of technical detail should the documentation target? (junior developers, senior developers, mixed team)
3219
- ]]
3220
-
3221
- ### 2. Core Documentation Generation
3222
-
3223
- [[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:
3224
-
3225
- **Core Documents (always generate):**
3226
-
3227
- 1. **docs/index.md** - Master documentation index
3228
- 2. **docs/architecture/index.md** - Architecture documentation index
3229
- 3. **docs/architecture/coding-standards.md** - Coding conventions and style guidelines
3230
- 4. **docs/architecture/tech-stack.md** - Technology stack and version constraints
3231
- 5. **docs/architecture/unified-project-structure.md** - Project structure and organization
3232
- 6. **docs/architecture/testing-strategy.md** - Testing approaches and requirements
3233
-
3234
- **Backend Documents (generate for backend/full-stack projects):**
3235
-
3236
- 7. **docs/architecture/backend-architecture.md** - Backend service patterns and structure
3237
- 8. **docs/architecture/rest-api-spec.md** - API endpoint specifications
3238
- 9. **docs/architecture/data-models.md** - Data structures and validation rules
3239
- 10. **docs/architecture/database-schema.md** - Database design and relationships
3240
- 11. **docs/architecture/external-apis.md** - Third-party integrations
3241
-
3242
- **Frontend Documents (generate for frontend/full-stack projects):**
3243
-
3244
- 12. **docs/architecture/frontend-architecture.md** - Frontend patterns and structure
3245
- 13. **docs/architecture/components.md** - UI component specifications
3246
- 14. **docs/architecture/core-workflows.md** - User interaction flows
3247
- 15. **docs/architecture/ui-ux-spec.md** - UI/UX specifications and guidelines
3248
-
3249
- **Additional Documents (generate if applicable):**
3250
-
3251
- 16. **docs/prd.md** - Product requirements document (if not exists)
3252
- 17. **docs/architecture/deployment-guide.md** - Deployment and operations info
3253
- 18. **docs/architecture/security-considerations.md** - Security patterns and requirements
3254
- 19. **docs/architecture/performance-guidelines.md** - Performance optimization patterns
3255
-
3256
- **Optional Enhancement Documents:**
3257
-
3258
- 20. **docs/architecture/troubleshooting-guide.md** - Common issues and solutions
3259
- 21. **docs/architecture/changelog-conventions.md** - Change management practices
3260
- 22. **docs/architecture/code-review-checklist.md** - Review standards and practices
3261
-
3262
- Present each document section by section, using the advanced elicitation task after each major section.]]
3263
-
3264
- ### 3. Document Structure Template
3265
-
3266
- [[LLM: Use this standardized structure for each documentation file, adapting content as needed:
3267
-
3268
- ```markdown
3269
- # {{Document Title}}
3270
-
3271
- ## Overview
3272
-
3273
- {{Brief description of what this document covers and why it's important for AI agents}}
3274
-
3275
- ## Quick Reference
3276
-
3277
- {{Key points, commands, or patterns that agents need most frequently}}
3278
-
3279
- ## Detailed Information
3280
-
3281
- {{Comprehensive information organized into logical sections}}
3282
-
3283
- ## Examples
3284
-
3285
- {{Concrete examples showing proper usage or implementation}}
3286
-
3287
- ## Common Patterns
3288
-
3289
- {{Recurring patterns agents should recognize and follow}}
3290
-
3291
- ## Things to Avoid
3292
-
3293
- {{Anti-patterns, deprecated approaches, or common mistakes}}
3294
-
3295
- ## Related Resources
3296
-
3297
- {{Links to other relevant documentation or external resources}}
3298
- ```
3299
-
3300
- Each document should be:
3301
-
3302
- - **Concrete and actionable** - Focus on what agents need to do, not just concepts
3303
- - **Pattern-focused** - Highlight recurring patterns agents can recognize and replicate
3304
- - **Example-rich** - Include specific code examples and real file references
3305
- - **Context-aware** - Reference actual project files, folders, and conventions
3306
- - **Assumption-free** - Don't assume agents know project history or implicit knowledge
3307
- ]]
3308
-
3309
- ### 4. Content Guidelines for Each Document Type
3310
-
3311
- #### Core Architecture Documents
3312
-
3313
- ##### docs/architecture/index.md
3314
-
3315
- [[LLM: Create a comprehensive index of all architecture documentation:
3316
-
3317
- - List all architecture documents with brief descriptions
3318
- - Group documents by category (backend, frontend, shared)
3319
- - Include quick links to key sections
3320
- - Provide reading order recommendations for different use cases]]
3321
-
3322
- ##### docs/architecture/unified-project-structure.md
3323
-
3324
- [[LLM: Document the complete project structure:
3325
-
3326
- - Root-level directory structure with explanations
3327
- - Where each type of code belongs (backend, frontend, tests, etc.)
3328
- - File naming conventions and patterns
3329
- - Module/package organization
3330
- - Generated vs. source file locations
3331
- - Build output locations]]
3332
-
3333
- ##### docs/architecture/coding-standards.md
3334
-
3335
- [[LLM: Capture project-wide coding conventions:
3336
-
3337
- - Language-specific style guidelines
3338
- - Naming conventions (variables, functions, classes, files)
3339
- - Code organization within files
3340
- - Import/export patterns
3341
- - Comment and documentation standards
3342
- - Linting and formatting tool configurations
3343
- - Git commit message conventions]]
3344
-
3345
- ##### docs/architecture/tech-stack.md
3346
-
3347
- [[LLM: Document all technologies and versions:
3348
-
3349
- - Primary languages and versions
3350
- - Frameworks and major libraries with versions
3351
- - Development tools and their versions
3352
- - Database systems and versions
3353
- - External services and APIs used
3354
- - Browser/runtime requirements]]
3355
-
3356
- ##### docs/architecture/testing-strategy.md
3357
-
3358
- [[LLM: Define testing approaches and requirements:
3359
-
3360
- - Test file locations and naming conventions
3361
- - Unit testing patterns and frameworks
3362
- - Integration testing approaches
3363
- - E2E testing setup (if applicable)
3364
- - Test coverage requirements
3365
- - Mocking strategies
3366
- - Test data management]]
3367
-
3368
- #### Backend Architecture Documents
3369
-
3370
- ##### docs/architecture/backend-architecture.md
3371
-
3372
- [[LLM: Document backend service structure:
3373
-
3374
- - Service layer organization
3375
- - Controller/route patterns
3376
- - Middleware architecture
3377
- - Authentication/authorization patterns
3378
- - Request/response flow
3379
- - Background job processing
3380
- - Service communication patterns]]
3381
-
3382
- ##### docs/architecture/rest-api-spec.md
3383
-
3384
- [[LLM: Specify all API endpoints:
3385
-
3386
- - Base URL and versioning strategy
3387
- - Authentication methods
3388
- - Common headers and parameters
3389
- - Each endpoint with:
3390
- - HTTP method and path
3391
- - Request parameters/body
3392
- - Response format and status codes
3393
- - Error responses
3394
- - Rate limiting and quotas]]
3395
-
3396
- ##### docs/architecture/data-models.md
3397
-
3398
- [[LLM: Define data structures and validation:
3399
-
3400
- - Core business entities
3401
- - Data validation rules
3402
- - Relationships between entities
3403
- - Computed fields and derivations
3404
- - Data transformation patterns
3405
- - Serialization formats]]
3406
-
3407
- ##### docs/architecture/database-schema.md
3408
-
3409
- [[LLM: Document database design:
3410
-
3411
- - Database type and version
3412
- - Table/collection structures
3413
- - Indexes and constraints
3414
- - Relationships and foreign keys
3415
- - Migration patterns
3416
- - Seed data requirements
3417
- - Backup and recovery procedures]]
3418
-
3419
- ##### docs/architecture/external-apis.md
3420
-
3421
- [[LLM: Document third-party integrations:
3422
-
3423
- - List of external services used
3424
- - Authentication methods for each
3425
- - API endpoints and usage patterns
3426
- - Rate limits and quotas
3427
- - Error handling strategies
3428
- - Webhook configurations
3429
- - Data synchronization patterns]]
3430
-
3431
- #### Frontend Architecture Documents
3432
-
3433
- ##### docs/architecture/frontend-architecture.md
3434
-
3435
- [[LLM: Document frontend application structure:
3436
-
3437
- - Component hierarchy and organization
3438
- - State management patterns
3439
- - Routing architecture
3440
- - Data fetching patterns
3441
- - Authentication flow
3442
- - Error boundary strategies
3443
- - Performance optimization patterns]]
3444
-
3445
- ##### docs/architecture/components.md
3446
-
3447
- [[LLM: Specify UI components:
3448
-
3449
- - Component library/design system used
3450
- - Custom component specifications
3451
- - Props and state for each component
3452
- - Component composition patterns
3453
- - Styling approaches
3454
- - Accessibility requirements
3455
- - Component testing patterns]]
3456
-
3457
- ##### docs/architecture/core-workflows.md
3458
-
3459
- [[LLM: Document user interaction flows:
3460
-
3461
- - Major user journeys
3462
- - Screen flow diagrams
3463
- - Form handling patterns
3464
- - Navigation patterns
3465
- - Data flow through workflows
3466
- - Error states and recovery
3467
- - Loading and transition states]]
3468
-
3469
- ##### docs/architecture/ui-ux-spec.md
3470
-
3471
- [[LLM: Define UI/UX guidelines:
3472
-
3473
- - Design system specifications
3474
- - Color palette and typography
3475
- - Spacing and layout grids
3476
- - Responsive breakpoints
3477
- - Animation and transition guidelines
3478
- - Accessibility standards
3479
- - Browser compatibility requirements]]
3480
-
3481
- ### 5. Adaptive Content Strategy
3482
-
3483
- [[LLM: Adapt your documentation approach based on project characteristics:
3484
-
3485
- **For Web Applications:**
3486
-
3487
- - Focus on component patterns, routing, state management
3488
- - Include build processes, asset handling, and deployment
3489
- - Cover API integration patterns and data fetching
3490
-
3491
- **For Backend Services:**
3492
-
3493
- - Emphasize service architecture, data models, and API design
3494
- - Include database interaction patterns and migration strategies
3495
- - Cover authentication, authorization, and security patterns
3496
-
3497
- **For CLI Tools:**
3498
-
3499
- - Focus on command structure, argument parsing, and output formatting
3500
- - Include plugin/extension patterns if applicable
3501
- - Cover configuration file handling and user interaction patterns
3502
-
3503
- **For Libraries/Frameworks:**
3504
-
3505
- - Emphasize public API design and usage patterns
3506
- - Include extension points and customization approaches
3507
- - Cover versioning, compatibility, and migration strategies
3508
-
3509
- **For Mobile Applications:**
3510
-
3511
- - Focus on platform-specific patterns and navigation
3512
- - Include state management and data persistence approaches
3513
- - Cover platform integration and native feature usage
3514
-
3515
- **For Data Science/ML Projects:**
3516
-
3517
- - Emphasize data pipeline patterns and model organization
3518
- - Include experiment tracking and reproducibility approaches
3519
- - Cover data validation and model deployment patterns
3520
- ]]
3521
-
3522
- ### 6. Quality Assurance
3523
-
3524
- [[LLM: Before completing each document:
3525
-
3526
- 1. **Accuracy Check**: Verify all file paths, commands, and code examples work
3527
- 2. **Completeness Review**: Ensure the document covers the most important patterns an agent would encounter
3528
- 3. **Clarity Assessment**: Check that explanations are clear and actionable
3529
- 4. **Consistency Verification**: Ensure terminology and patterns align across all documents
3530
- 5. **Agent Perspective**: Review from the viewpoint of an AI agent that needs to contribute to this project
3531
-
3532
- Ask the user to review each completed document and use the advanced elicitation task to refine based on their feedback.]]
3533
-
3534
- ### 7. Final Integration
3535
-
3536
- [[LLM: After all documents are completed:
3537
-
3538
- 1. Ensure all documents are created in the proper BMAD-expected locations:
3539
-
3540
- - Core docs in `docs/` (index.md, prd.md)
3541
- - Architecture shards in `docs/architecture/` subdirectory
3542
- - Create the `docs/architecture/` directory if it doesn't exist
3543
-
3544
- 2. Create/update the master index documents:
3545
-
3546
- - Update `docs/index.md` to reference all documentation
3547
- - Create `docs/architecture/index.md` listing all architecture shards
3548
-
3549
- 3. Verify document cross-references:
3550
-
3551
- - Ensure all documents link to related documentation
3552
- - Check that file paths match the actual project structure
3553
- - Validate that examples reference real files in the project
3554
-
3555
- 4. Provide maintenance guidance:
3556
-
3557
- - Document update triggers (when to update each doc)
3558
- - Create a simple checklist for keeping docs current
3559
- - Suggest automated validation approaches
3560
-
3561
- 5. Summary report including:
3562
- - List of all documents created with their paths
3563
- - Any gaps or areas needing human review
3564
- - Recommendations for project-specific additions
3565
- - Next steps for maintaining documentation accuracy
3566
-
3567
- Present a summary of what was created and ask if any additional documentation would be helpful for AI agents working on this specific project.]]
3568
-
3569
- ## Success Criteria
3570
-
3571
- - Documentation enables AI agents to understand project context without additional explanation
3572
- - All major architectural patterns and coding conventions are captured
3573
- - Examples reference actual project files and demonstrate real usage
3574
- - Documentation is structured consistently and easy to navigate
3575
- - Content is actionable and focuses on what agents need to do, not just understand
3576
-
3577
- ## Notes
3578
-
3579
- - This task is designed to work with any project type, language, or framework
3580
- - The documentation should reflect the project as it actually is, not as it should be
3581
- - Focus on patterns that agents can recognize and replicate consistently
3582
- - Include both positive examples (what to do) and negative examples (what to avoid)
3583
- ==================== END: tasks#document-project ====================
3584
-
3585
3566
  ==================== START: tasks#execute-checklist ====================
3586
3567
  # Checklist Validation Task
3587
3568