appiq-solution 1.4.3 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/#Tools/APPIQ-METHOD/.cursor/commands/analyze.md +1 -1
  2. package/#Tools/APPIQ-METHOD/.cursor/commands/appiq.md +1 -1
  3. package/#Tools/APPIQ-METHOD/.cursor/commands/help.md +1 -1
  4. package/#Tools/APPIQ-METHOD/.cursor/commands/story.md +1 -1
  5. package/#Tools/APPIQ-METHOD/bmad-core/agents/init-flow-po.md +219 -0
  6. package/#Tools/APPIQ-METHOD/commands/analyze.md +1 -1
  7. package/#Tools/APPIQ-METHOD/commands/appiq.md +1 -1
  8. package/#Tools/APPIQ-METHOD/commands/help.md +1 -1
  9. package/#Tools/APPIQ-METHOD/commands/story.md +1 -1
  10. package/#Tools/APPIQ-METHOD/package.json +1 -1
  11. package/#Tools/APPIQ-METHOD/tools/setup-ide-commands.js +40 -37
  12. package/#Tools/APPIQ-METHOD/tools/smart-installer.js +16 -13
  13. package/bmad-core/agent-teams/team-all.yaml +14 -0
  14. package/bmad-core/agent-teams/team-flutter-mobile.yaml +114 -0
  15. package/bmad-core/agent-teams/team-fullstack.yaml +28 -0
  16. package/bmad-core/agent-teams/team-ide-minimal.yaml +10 -0
  17. package/bmad-core/agent-teams/team-no-ui.yaml +13 -0
  18. package/bmad-core/agents/analyst.md +85 -0
  19. package/bmad-core/agents/architect.md +90 -0
  20. package/bmad-core/agents/bmad-master.md +108 -0
  21. package/bmad-core/agents/bmad-orchestrator.md +150 -0
  22. package/bmad-core/agents/bmad-smart-launcher.md +170 -0
  23. package/bmad-core/agents/dev.md +95 -0
  24. package/bmad-core/agents/init-flow-po.md +219 -0
  25. package/bmad-core/agents/pm.md +85 -0
  26. package/bmad-core/agents/po.md +76 -0
  27. package/bmad-core/agents/qa.md +86 -0
  28. package/bmad-core/agents/sm.md +67 -0
  29. package/bmad-core/agents/ux-expert.md +71 -0
  30. package/bmad-core/bmad-core/user-guide.md +0 -0
  31. package/bmad-core/checklists/architect-checklist.md +443 -0
  32. package/bmad-core/checklists/change-checklist.md +182 -0
  33. package/bmad-core/checklists/pm-checklist.md +375 -0
  34. package/bmad-core/checklists/po-master-checklist.md +441 -0
  35. package/bmad-core/checklists/security-validation-checklist.md +332 -0
  36. package/bmad-core/checklists/story-dod-checklist.md +101 -0
  37. package/bmad-core/checklists/story-draft-checklist.md +156 -0
  38. package/bmad-core/core-config.yaml +20 -0
  39. package/bmad-core/core-config.yaml.bak +20 -0
  40. package/bmad-core/data/backend-services-integration.md +686 -0
  41. package/bmad-core/data/bmad-kb.md +803 -0
  42. package/bmad-core/data/brainstorming-techniques.md +36 -0
  43. package/bmad-core/data/elicitation-methods.md +134 -0
  44. package/bmad-core/data/shadcn-ui-integration.md +388 -0
  45. package/bmad-core/data/technical-preferences.md +149 -0
  46. package/bmad-core/enhanced-ide-development-workflow.md +43 -0
  47. package/bmad-core/tasks/advanced-elicitation.md +117 -0
  48. package/bmad-core/tasks/brownfield-create-epic.md +160 -0
  49. package/bmad-core/tasks/brownfield-create-story.md +147 -0
  50. package/bmad-core/tasks/correct-course.md +70 -0
  51. package/bmad-core/tasks/create-brownfield-story.md +304 -0
  52. package/bmad-core/tasks/create-deep-research-prompt.md +289 -0
  53. package/bmad-core/tasks/create-flutter-story.md +197 -0
  54. package/bmad-core/tasks/create-next-story.md +112 -0
  55. package/bmad-core/tasks/document-project.md +341 -0
  56. package/bmad-core/tasks/facilitate-brainstorming-session.md +136 -0
  57. package/bmad-core/tasks/generate-ai-frontend-prompt.md +51 -0
  58. package/bmad-core/tasks/index-docs.md +179 -0
  59. package/bmad-core/tasks/intelligent-epic-creation.md +234 -0
  60. package/bmad-core/tasks/kb-mode-interaction.md +75 -0
  61. package/bmad-core/tasks/review-story.md +145 -0
  62. package/bmad-core/tasks/shard-doc.md +187 -0
  63. package/bmad-core/tasks/smart-project-analysis.md +289 -0
  64. package/bmad-core/tasks/validate-next-story.md +134 -0
  65. package/bmad-core/templates/architecture-tmpl.yaml +650 -0
  66. package/bmad-core/templates/brainstorming-output-tmpl.yaml +156 -0
  67. package/bmad-core/templates/brownfield-architecture-tmpl.yaml +476 -0
  68. package/bmad-core/templates/brownfield-prd-tmpl.yaml +280 -0
  69. package/bmad-core/templates/competitor-analysis-tmpl.yaml +293 -0
  70. package/bmad-core/templates/flutter-mobile-prd-tmpl.yaml +330 -0
  71. package/bmad-core/templates/flutter-story-tmpl.yaml +376 -0
  72. package/bmad-core/templates/flutter-ui-spec-tmpl.yaml +415 -0
  73. package/bmad-core/templates/front-end-architecture-tmpl.yaml +206 -0
  74. package/bmad-core/templates/front-end-spec-tmpl.yaml +349 -0
  75. package/bmad-core/templates/fullstack-architecture-tmpl.yaml +812 -0
  76. package/bmad-core/templates/market-research-tmpl.yaml +252 -0
  77. package/bmad-core/templates/prd-tmpl.yaml +202 -0
  78. package/bmad-core/templates/project-brief-tmpl.yaml +221 -0
  79. package/bmad-core/templates/story-tmpl.yaml +137 -0
  80. package/bmad-core/user-guide.md +251 -0
  81. package/bmad-core/workflows/brownfield-fullstack.yaml +311 -0
  82. package/bmad-core/workflows/brownfield-service.yaml +187 -0
  83. package/bmad-core/workflows/brownfield-ui.yaml +197 -0
  84. package/bmad-core/workflows/greenfield-fullstack.yaml +284 -0
  85. package/bmad-core/workflows/greenfield-service.yaml +206 -0
  86. package/bmad-core/workflows/greenfield-ui.yaml +235 -0
  87. package/bmad-core/working-in-the-brownfield.md +373 -0
  88. package/package.json +1 -1
  89. package/tools/setup-ide-commands.js +40 -37
  90. package/tools/smart-installer.js +16 -13
@@ -0,0 +1,197 @@
1
+ # Create Flutter Story Task
2
+
3
+ ## Overview
4
+ This task creates a detailed Flutter development story following Clean Architecture principles with feature-based organization. The story will include all three layers (data/domain/presentation) and comprehensive testing requirements.
5
+
6
+ ## Prerequisites
7
+ - Flutter PRD document available
8
+ - Flutter architecture document (if applicable)
9
+ - Feature requirements clearly defined
10
+ - UI/UX specifications available
11
+
12
+ ## Task Execution
13
+
14
+ ### Step 1: Gather Requirements
15
+ **Action:** Collect and analyze story requirements
16
+ **Process:**
17
+ 1. Read Flutter PRD or feature requirements
18
+ 2. Review UI/UX specifications if available
19
+ 3. Understand user needs and business value
20
+ 4. Identify technical constraints and dependencies
21
+ 5. Determine story scope and complexity
22
+
23
+ **Deliverable:** Clear understanding of feature requirements
24
+
25
+ ### Step 2: Define User Story
26
+ **Action:** Create user story following standard format
27
+ **Process:**
28
+ 1. Identify the user persona and role
29
+ 2. Define the specific functionality/goal
30
+ 3. Articulate the business value/benefit
31
+ 4. Add mobile-specific context and usage scenarios
32
+ 5. Consider offline/online behavior requirements
33
+
34
+ **Template:**
35
+ ```
36
+ As a [type of user]
37
+ I want [goal/functionality]
38
+ So that [benefit/value]
39
+
40
+ Mobile Context:
41
+ - Device usage scenario
42
+ - User interaction patterns
43
+ - Performance expectations
44
+ ```
45
+
46
+ ### Step 3: Create Acceptance Criteria
47
+ **Action:** Define comprehensive, testable acceptance criteria
48
+ **Process:**
49
+ 1. **Functional Criteria:** Define what the feature must do
50
+ 2. **UI/UX Criteria:** Material Design 3, responsive design, accessibility
51
+ 3. **Technical Criteria:** Clean Architecture, state management, error handling
52
+ 4. **Performance Criteria:** Loading times, animations, memory usage
53
+
54
+ **Quality Check:** Each criterion must be:
55
+ - Specific and measurable
56
+ - Testable with clear pass/fail conditions
57
+ - Aligned with user value and business goals
58
+
59
+ ### Step 4: Break Down Flutter Implementation Tasks
60
+ **Action:** Organize tasks by Flutter Clean Architecture layers
61
+ **Process:**
62
+
63
+ #### A. Presentation Layer Tasks
64
+ 1. **UI Implementation:**
65
+ - Create feature pages/screens with Material 3 design
66
+ - Implement custom widgets and components
67
+ - Set up responsive layouts for phone/tablet
68
+ - Add animations and micro-interactions
69
+ - Implement accessibility features
70
+
71
+ 2. **State Management (Cubit):**
72
+ - Create Cubit class with business logic coordination
73
+ - Define State classes with Equatable
74
+ - Implement state transitions and error handling
75
+ - Connect UI to Cubit with BlocBuilder/BlocListener
76
+
77
+ 3. **Navigation & Routing:**
78
+ - Define routes and navigation paths
79
+ - Implement deep linking (if required)
80
+ - Add navigation transitions
81
+
82
+ #### B. Domain Layer Tasks
83
+ 1. **Business Entities:**
84
+ - Create entity classes with Equatable
85
+ - Define entity relationships and properties
86
+ - Add entity validation rules
87
+
88
+ 2. **Use Cases:**
89
+ - Implement use case classes with @injectable
90
+ - Add business logic and validation
91
+ - Define Either<Failure, Success> return types
92
+
93
+ 3. **Repository Interfaces:**
94
+ - Define repository abstract classes
95
+ - Specify method signatures and return types
96
+
97
+ #### C. Data Layer Tasks
98
+ 1. **Data Models:**
99
+ - Create model classes with @freezed annotation
100
+ - Add JSON serialization
101
+ - Implement model to entity conversion methods
102
+
103
+ 2. **Repository Implementations:**
104
+ - Implement concrete repository classes
105
+ - Add error handling and data transformation
106
+
107
+ 3. **Data Sources:**
108
+ - Create remote data source for API calls
109
+ - Implement local data source for caching
110
+ - Add offline-first functionality (if required)
111
+
112
+ #### D. Cross-Cutting Tasks
113
+ 1. **Localization & Theming:**
114
+ - Add all text content to ARB files
115
+ - Implement RTL support
116
+ - Verify dark/light theme compatibility
117
+
118
+ 2. **Testing:**
119
+ - Unit tests for domain layer
120
+ - Unit tests for data layer
121
+ - Widget tests for UI components
122
+ - Cubit/state management tests
123
+ - Integration tests for user flows
124
+
125
+ ### Step 5: Add Technical Implementation Details
126
+ **Action:** Provide technical guidance for developers
127
+ **Process:**
128
+ 1. List required Flutter dependencies
129
+ 2. Define file structure following feature-based architecture
130
+ 3. Specify key implementation patterns
131
+ 4. Include performance considerations
132
+ 5. Add security requirements (if applicable)
133
+
134
+ ### Step 6: Define Testing Requirements
135
+ **Action:** Create comprehensive testing strategy
136
+ **Process:**
137
+ 1. **Unit Tests:** Domain and data layer testing with mocks
138
+ 2. **Widget Tests:** UI component testing in isolation
139
+ 3. **Cubit Tests:** State management testing with bloc_test
140
+ 4. **Integration Tests:** End-to-end user flow testing
141
+ 5. **Accessibility Tests:** Screen reader and semantic testing
142
+
143
+ **Coverage Target:** Minimum 80% code coverage, 100% for business logic
144
+
145
+ ### Step 7: Add Development Notes
146
+ **Action:** Include additional guidance and considerations
147
+ **Process:**
148
+ 1. Performance optimization tips
149
+ 2. Accessibility implementation guidelines
150
+ 3. Localization best practices
151
+ 4. Code quality standards
152
+ 5. Common pitfalls and solutions
153
+
154
+ ### Step 8: Create Definition of Done
155
+ **Action:** Define clear completion criteria
156
+ **Process:**
157
+ 1. **Implementation Complete:** All tasks and layers implemented
158
+ 2. **Code Quality:** Follows Flutter best practices and standards
159
+ 3. **Testing Complete:** All tests written and passing
160
+ 4. **Performance Verified:** Meets performance benchmarks
161
+ 5. **Documentation:** Code documented and file list updated
162
+ 6. **Review Process:** Code review, design review, QA testing completed
163
+
164
+ ## Template Usage
165
+ **Template:** Use `flutter-story-tmpl.yaml` for consistent story structure
166
+
167
+ ## Quality Validation
168
+ Before marking story as complete, verify:
169
+ - [ ] Story follows standard user story format
170
+ - [ ] Acceptance criteria are specific and testable
171
+ - [ ] Tasks cover all Flutter architecture layers
172
+ - [ ] Technical details provide clear implementation guidance
173
+ - [ ] Testing requirements are comprehensive
174
+ - [ ] Performance and accessibility requirements included
175
+ - [ ] Localization requirements specified
176
+ - [ ] Definition of done is complete and measurable
177
+
178
+ ## Handoff Process
179
+ 1. Review story with Product Owner for business value alignment
180
+ 2. Review with Tech Lead for technical feasibility
181
+ 3. Estimate story points with development team
182
+ 4. Ensure all dependencies are identified and available
183
+ 5. Confirm story is ready for development sprint
184
+
185
+ ## Success Criteria
186
+ - Story provides complete implementation guidance for developers
187
+ - All acceptance criteria are testable and measurable
188
+ - Technical approach follows Flutter Clean Architecture principles
189
+ - Story scope is appropriate for single sprint completion
190
+ - Dependencies and integration points are clearly identified
191
+
192
+ ## Notes
193
+ - Keep stories focused on single feature or user flow
194
+ - Ensure story can be completed within one sprint (usually 1-2 weeks)
195
+ - Consider breaking large features into multiple stories
196
+ - Always include mobile-specific considerations (performance, battery, offline)
197
+ - Maintain consistency with existing codebase patterns and standards
@@ -0,0 +1,112 @@
1
+ # Create Next Story Task
2
+
3
+ ## Purpose
4
+
5
+ To identify the next logical story based on project progress and epic definitions, and then to prepare a comprehensive, self-contained, and actionable story file using the `Story Template`. This task ensures the story is enriched with all necessary technical context, requirements, and acceptance criteria, making it ready for efficient implementation by a Developer Agent with minimal need for additional research or finding its own context.
6
+
7
+ ## SEQUENTIAL Task Execution (Do not proceed until current Task is complete)
8
+
9
+ ### 0. Load Core Configuration and Check Workflow
10
+
11
+ - Load `{root}/core-config.yaml` from the project root
12
+ - If the file does not exist, HALT and inform the user: "core-config.yaml not found. This file is required for story creation. You can either: 1) Copy it from GITHUB bmad-core/core-config.yaml and configure it for your project OR 2) Run the BMad installer against your project to upgrade and add the file automatically. Please add and configure core-config.yaml before proceeding."
13
+ - Extract key configurations: `devStoryLocation`, `prd.*`, `architecture.*`, `workflow.*`
14
+
15
+ ### 1. Identify Next Story for Preparation
16
+
17
+ #### 1.1 Locate Epic Files and Review Existing Stories
18
+
19
+ - Based on `prdSharded` from config, locate epic files (sharded location/pattern or monolithic PRD sections)
20
+ - If `devStoryLocation` has story files, load the highest `{epicNum}.{storyNum}.story.md` file
21
+ - **If highest story exists:**
22
+ - Verify status is 'Done'. If not, alert user: "ALERT: Found incomplete story! File: {lastEpicNum}.{lastStoryNum}.story.md Status: [current status] You should fix this story first, but would you like to accept risk & override to create the next story in draft?"
23
+ - If proceeding, select next sequential story in the current epic
24
+ - If epic is complete, prompt user: "Epic {epicNum} Complete: All stories in Epic {epicNum} have been completed. Would you like to: 1) Begin Epic {epicNum + 1} with story 1 2) Select a specific story to work on 3) Cancel story creation"
25
+ - **CRITICAL**: NEVER automatically skip to another epic. User MUST explicitly instruct which story to create.
26
+ - **If no story files exist:** The next story is ALWAYS 1.1 (first story of first epic)
27
+ - Announce the identified story to the user: "Identified next story for preparation: {epicNum}.{storyNum} - {Story Title}"
28
+
29
+ ### 2. Gather Story Requirements and Previous Story Context
30
+
31
+ - Extract story requirements from the identified epic file
32
+ - If previous story exists, review Dev Agent Record sections for:
33
+ - Completion Notes and Debug Log References
34
+ - Implementation deviations and technical decisions
35
+ - Challenges encountered and lessons learned
36
+ - Extract relevant insights that inform the current story's preparation
37
+
38
+ ### 3. Gather Architecture Context
39
+
40
+ #### 3.1 Determine Architecture Reading Strategy
41
+
42
+ - **If `architectureVersion: >= v4` and `architectureSharded: true`**: Read `{architectureShardedLocation}/index.md` then follow structured reading order below
43
+ - **Else**: Use monolithic `architectureFile` for similar sections
44
+
45
+ #### 3.2 Read Architecture Documents Based on Story Type
46
+
47
+ **For ALL Stories:** tech-stack.md, unified-project-structure.md, coding-standards.md, testing-strategy.md
48
+
49
+ **For Backend/API Stories, additionally:** data-models.md, database-schema.md, backend-architecture.md, rest-api-spec.md, external-apis.md
50
+
51
+ **For Frontend/UI Stories, additionally:** frontend-architecture.md, components.md, core-workflows.md, data-models.md
52
+
53
+ **For Full-Stack Stories:** Read both Backend and Frontend sections above
54
+
55
+ #### 3.3 Extract Story-Specific Technical Details
56
+
57
+ Extract ONLY information directly relevant to implementing the current story. Do NOT invent new libraries, patterns, or standards not in the source documents.
58
+
59
+ Extract:
60
+
61
+ - Specific data models, schemas, or structures the story will use
62
+ - API endpoints the story must implement or consume
63
+ - Component specifications for UI elements in the story
64
+ - File paths and naming conventions for new code
65
+ - Testing requirements specific to the story's features
66
+ - Security or performance considerations affecting the story
67
+
68
+ ALWAYS cite source documents: `[Source: architecture/{filename}.md#{section}]`
69
+
70
+ ### 4. Verify Project Structure Alignment
71
+
72
+ - Cross-reference story requirements with Project Structure Guide from `docs/architecture/unified-project-structure.md`
73
+ - Ensure file paths, component locations, or module names align with defined structures
74
+ - Document any structural conflicts in "Project Structure Notes" section within the story draft
75
+
76
+ ### 5. Populate Story Template with Full Context
77
+
78
+ - Create new story file: `{devStoryLocation}/{epicNum}.{storyNum}.story.md` using Story Template
79
+ - Fill in basic story information: Title, Status (Draft), Story statement, Acceptance Criteria from Epic
80
+ - **`Dev Notes` section (CRITICAL):**
81
+ - CRITICAL: This section MUST contain ONLY information extracted from architecture documents. NEVER invent or assume technical details.
82
+ - Include ALL relevant technical details from Steps 2-3, organized by category:
83
+ - **Previous Story Insights**: Key learnings from previous story
84
+ - **Data Models**: Specific schemas, validation rules, relationships [with source references]
85
+ - **API Specifications**: Endpoint details, request/response formats, auth requirements [with source references]
86
+ - **Component Specifications**: UI component details, props, state management [with source references]
87
+ - **File Locations**: Exact paths where new code should be created based on project structure
88
+ - **Testing Requirements**: Specific test cases or strategies from testing-strategy.md
89
+ - **Technical Constraints**: Version requirements, performance considerations, security rules
90
+ - Every technical detail MUST include its source reference: `[Source: architecture/{filename}.md#{section}]`
91
+ - If information for a category is not found in the architecture docs, explicitly state: "No specific guidance found in architecture docs"
92
+ - **`Tasks / Subtasks` section:**
93
+ - Generate detailed, sequential list of technical tasks based ONLY on: Epic Requirements, Story AC, Reviewed Architecture Information
94
+ - Each task must reference relevant architecture documentation
95
+ - Include unit testing as explicit subtasks based on the Testing Strategy
96
+ - Link tasks to ACs where applicable (e.g., `Task 1 (AC: 1, 3)`)
97
+ - Add notes on project structure alignment or discrepancies found in Step 4
98
+
99
+ ### 6. Story Draft Completion and Review
100
+
101
+ - Review all sections for completeness and accuracy
102
+ - Verify all source references are included for technical details
103
+ - Ensure tasks align with both epic requirements and architecture constraints
104
+ - Update status to "Draft" and save the story file
105
+ - Execute `{root}/tasks/execute-checklist` `{root}/checklists/story-draft-checklist`
106
+ - Provide summary to user including:
107
+ - Story created: `{devStoryLocation}/{epicNum}.{storyNum}.story.md`
108
+ - Status: Draft
109
+ - Key technical components included from architecture docs
110
+ - Any deviations or conflicts noted between epic and architecture
111
+ - Checklist Results
112
+ - Next steps: For Complex stories, suggest the user carefully review the story draft and also optionally have the PO run the task `{root}/tasks/validate-next-story`
@@ -0,0 +1,341 @@
1
+ # Document an Existing Project
2
+
3
+ ## Purpose
4
+
5
+ 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.
6
+
7
+ ## Task Instructions
8
+
9
+ ### 1. Initial Project Analysis
10
+
11
+ **CRITICAL:** First, check if a PRD or requirements document exists in context. If yes, use it to focus your documentation efforts on relevant areas only.
12
+
13
+ **IF PRD EXISTS**:
14
+
15
+ - Review the PRD to understand what enhancement/feature is planned
16
+ - Identify which modules, services, or areas will be affected
17
+ - Focus documentation ONLY on these relevant areas
18
+ - Skip unrelated parts of the codebase to keep docs lean
19
+
20
+ **IF NO PRD EXISTS**:
21
+ Ask the user:
22
+
23
+ "I notice you haven't provided a PRD or requirements document. To create more focused and useful documentation, I recommend one of these options:
24
+
25
+ 1. **Create a PRD first** - Would you like me to help create a brownfield PRD before documenting? This helps focus documentation on relevant areas.
26
+
27
+ 2. **Provide existing requirements** - Do you have a requirements document, epic, or feature description you can share?
28
+
29
+ 3. **Describe the focus** - Can you briefly describe what enhancement or feature you're planning? For example:
30
+ - 'Adding payment processing to the user service'
31
+ - 'Refactoring the authentication module'
32
+ - 'Integrating with a new third-party API'
33
+
34
+ 4. **Document everything** - Or should I proceed with comprehensive documentation of the entire codebase? (Note: This may create excessive documentation for large projects)
35
+
36
+ Please let me know your preference, or I can proceed with full documentation if you prefer."
37
+
38
+ Based on their response:
39
+
40
+ - If they choose option 1-3: Use that context to focus documentation
41
+ - If they choose option 4 or decline: Proceed with comprehensive analysis below
42
+
43
+ Begin by conducting analysis of the existing project. Use available tools to:
44
+
45
+ 1. **Project Structure Discovery**: Examine the root directory structure, identify main folders, and understand the overall organization
46
+ 2. **Technology Stack Identification**: Look for package.json, requirements.txt, Cargo.toml, pom.xml, etc. to identify languages, frameworks, and dependencies
47
+ 3. **Build System Analysis**: Find build scripts, CI/CD configurations, and development commands
48
+ 4. **Existing Documentation Review**: Check for README files, docs folders, and any existing documentation
49
+ 5. **Code Pattern Analysis**: Sample key files to understand coding patterns, naming conventions, and architectural approaches
50
+
51
+ Ask the user these elicitation questions to better understand their needs:
52
+
53
+ - What is the primary purpose of this project?
54
+ - Are there any specific areas of the codebase that are particularly complex or important for agents to understand?
55
+ - What types of tasks do you expect AI agents to perform on this project? (e.g., bug fixes, feature additions, refactoring, testing)
56
+ - Are there any existing documentation standards or formats you prefer?
57
+ - What level of technical detail should the documentation target? (junior developers, senior developers, mixed team)
58
+ - Is there a specific feature or enhancement you're planning? (This helps focus documentation)
59
+
60
+ ### 2. Deep Codebase Analysis
61
+
62
+ CRITICAL: Before generating documentation, conduct extensive analysis of the existing codebase:
63
+
64
+ 1. **Explore Key Areas**:
65
+ - Entry points (main files, index files, app initializers)
66
+ - Configuration files and environment setup
67
+ - Package dependencies and versions
68
+ - Build and deployment configurations
69
+ - Test suites and coverage
70
+
71
+ 2. **Ask Clarifying Questions**:
72
+ - "I see you're using [technology X]. Are there any custom patterns or conventions I should document?"
73
+ - "What are the most critical/complex parts of this system that developers struggle with?"
74
+ - "Are there any undocumented 'tribal knowledge' areas I should capture?"
75
+ - "What technical debt or known issues should I document?"
76
+ - "Which parts of the codebase change most frequently?"
77
+
78
+ 3. **Map the Reality**:
79
+ - Identify ACTUAL patterns used (not theoretical best practices)
80
+ - Find where key business logic lives
81
+ - Locate integration points and external dependencies
82
+ - Document workarounds and technical debt
83
+ - Note areas that differ from standard patterns
84
+
85
+ **IF PRD PROVIDED**: Also analyze what would need to change for the enhancement
86
+
87
+ ### 3. Core Documentation Generation
88
+
89
+ [[LLM: Generate a comprehensive BROWNFIELD architecture document that reflects the ACTUAL state of the codebase.
90
+
91
+ **CRITICAL**: This is NOT an aspirational architecture document. Document what EXISTS, including:
92
+
93
+ - Technical debt and workarounds
94
+ - Inconsistent patterns between different parts
95
+ - Legacy code that can't be changed
96
+ - Integration constraints
97
+ - Performance bottlenecks
98
+
99
+ **Document Structure**:
100
+
101
+ # [Project Name] Brownfield Architecture Document
102
+
103
+ ## Introduction
104
+
105
+ 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.
106
+
107
+ ### Document Scope
108
+
109
+ [If PRD provided: "Focused on areas relevant to: {enhancement description}"]
110
+ [If no PRD: "Comprehensive documentation of entire system"]
111
+
112
+ ### Change Log
113
+
114
+ | Date | Version | Description | Author |
115
+ |------|---------|-------------|--------|
116
+ | [Date] | 1.0 | Initial brownfield analysis | [Analyst] |
117
+
118
+ ## Quick Reference - Key Files and Entry Points
119
+
120
+ ### Critical Files for Understanding the System
121
+
122
+ - **Main Entry**: `src/index.js` (or actual entry point)
123
+ - **Configuration**: `config/app.config.js`, `.env.example`
124
+ - **Core Business Logic**: `src/services/`, `src/domain/`
125
+ - **API Definitions**: `src/routes/` or link to OpenAPI spec
126
+ - **Database Models**: `src/models/` or link to schema files
127
+ - **Key Algorithms**: [List specific files with complex logic]
128
+
129
+ ### If PRD Provided - Enhancement Impact Areas
130
+
131
+ [Highlight which files/modules will be affected by the planned enhancement]
132
+
133
+ ## High Level Architecture
134
+
135
+ ### Technical Summary
136
+
137
+ ### Actual Tech Stack (from package.json/requirements.txt)
138
+
139
+ | Category | Technology | Version | Notes |
140
+ |----------|------------|---------|--------|
141
+ | Runtime | Node.js | 16.x | [Any constraints] |
142
+ | Framework | Express | 4.18.2 | [Custom middleware?] |
143
+ | Database | PostgreSQL | 13 | [Connection pooling setup] |
144
+
145
+ etc...
146
+
147
+ ### Repository Structure Reality Check
148
+
149
+ - Type: [Monorepo/Polyrepo/Hybrid]
150
+ - Package Manager: [npm/yarn/pnpm]
151
+ - Notable: [Any unusual structure decisions]
152
+
153
+ ## Source Tree and Module Organization
154
+
155
+ ### Project Structure (Actual)
156
+
157
+ ```text
158
+ project-root/
159
+ ├── src/
160
+ │ ├── controllers/ # HTTP request handlers
161
+ │ ├── services/ # Business logic (NOTE: inconsistent patterns between user and payment services)
162
+ │ ├── models/ # Database models (Sequelize)
163
+ │ ├── utils/ # Mixed bag - needs refactoring
164
+ │ └── legacy/ # DO NOT MODIFY - old payment system still in use
165
+ ├── tests/ # Jest tests (60% coverage)
166
+ ├── scripts/ # Build and deployment scripts
167
+ └── config/ # Environment configs
168
+ ```
169
+
170
+ ### Key Modules and Their Purpose
171
+
172
+ - **User Management**: `src/services/userService.js` - Handles all user operations
173
+ - **Authentication**: `src/middleware/auth.js` - JWT-based, custom implementation
174
+ - **Payment Processing**: `src/legacy/payment.js` - CRITICAL: Do not refactor, tightly coupled
175
+ - **[List other key modules with their actual files]**
176
+
177
+ ## Data Models and APIs
178
+
179
+ ### Data Models
180
+
181
+ Instead of duplicating, reference actual model files:
182
+ - **User Model**: See `src/models/User.js`
183
+ - **Order Model**: See `src/models/Order.js`
184
+ - **Related Types**: TypeScript definitions in `src/types/`
185
+
186
+ ### API Specifications
187
+
188
+ - **OpenAPI Spec**: `docs/api/openapi.yaml` (if exists)
189
+ - **Postman Collection**: `docs/api/postman-collection.json`
190
+ - **Manual Endpoints**: [List any undocumented endpoints discovered]
191
+
192
+ ## Technical Debt and Known Issues
193
+
194
+ ### Critical Technical Debt
195
+
196
+ 1. **Payment Service**: Legacy code in `src/legacy/payment.js` - tightly coupled, no tests
197
+ 2. **User Service**: Different pattern than other services, uses callbacks instead of promises
198
+ 3. **Database Migrations**: Manually tracked, no proper migration tool
199
+ 4. **[Other significant debt]**
200
+
201
+ ### Workarounds and Gotchas
202
+
203
+ - **Environment Variables**: Must set `NODE_ENV=production` even for staging (historical reason)
204
+ - **Database Connections**: Connection pool hardcoded to 10, changing breaks payment service
205
+ - **[Other workarounds developers need to know]**
206
+
207
+ ## Integration Points and External Dependencies
208
+
209
+ ### External Services
210
+
211
+ | Service | Purpose | Integration Type | Key Files |
212
+ |---------|---------|------------------|-----------|
213
+ | Stripe | Payments | REST API | `src/integrations/stripe/` |
214
+ | SendGrid | Emails | SDK | `src/services/emailService.js` |
215
+
216
+ etc...
217
+
218
+ ### Internal Integration Points
219
+
220
+ - **Frontend Communication**: REST API on port 3000, expects specific headers
221
+ - **Background Jobs**: Redis queue, see `src/workers/`
222
+ - **[Other integrations]**
223
+
224
+ ## Development and Deployment
225
+
226
+ ### Local Development Setup
227
+
228
+ 1. Actual steps that work (not ideal steps)
229
+ 2. Known issues with setup
230
+ 3. Required environment variables (see `.env.example`)
231
+
232
+ ### Build and Deployment Process
233
+
234
+ - **Build Command**: `npm run build` (webpack config in `webpack.config.js`)
235
+ - **Deployment**: Manual deployment via `scripts/deploy.sh`
236
+ - **Environments**: Dev, Staging, Prod (see `config/environments/`)
237
+
238
+ ## Testing Reality
239
+
240
+ ### Current Test Coverage
241
+
242
+ - Unit Tests: 60% coverage (Jest)
243
+ - Integration Tests: Minimal, in `tests/integration/`
244
+ - E2E Tests: None
245
+ - Manual Testing: Primary QA method
246
+
247
+ ### Running Tests
248
+
249
+ ```bash
250
+ npm test # Runs unit tests
251
+ npm run test:integration # Runs integration tests (requires local DB)
252
+ ```
253
+
254
+ ## If Enhancement PRD Provided - Impact Analysis
255
+
256
+ ### Files That Will Need Modification
257
+
258
+ Based on the enhancement requirements, these files will be affected:
259
+ - `src/services/userService.js` - Add new user fields
260
+ - `src/models/User.js` - Update schema
261
+ - `src/routes/userRoutes.js` - New endpoints
262
+ - [etc...]
263
+
264
+ ### New Files/Modules Needed
265
+
266
+ - `src/services/newFeatureService.js` - New business logic
267
+ - `src/models/NewFeature.js` - New data model
268
+ - [etc...]
269
+
270
+ ### Integration Considerations
271
+
272
+ - Will need to integrate with existing auth middleware
273
+ - Must follow existing response format in `src/utils/responseFormatter.js`
274
+ - [Other integration points]
275
+
276
+ ## Appendix - Useful Commands and Scripts
277
+
278
+ ### Frequently Used Commands
279
+
280
+ ```bash
281
+ npm run dev # Start development server
282
+ npm run build # Production build
283
+ npm run migrate # Run database migrations
284
+ npm run seed # Seed test data
285
+ ```
286
+
287
+ ### Debugging and Troubleshooting
288
+
289
+ - **Logs**: Check `logs/app.log` for application logs
290
+ - **Debug Mode**: Set `DEBUG=app:*` for verbose logging
291
+ - **Common Issues**: See `docs/troubleshooting.md`]]
292
+
293
+ ### 4. Document Delivery
294
+
295
+ 1. **In Web UI (Gemini, ChatGPT, Claude)**:
296
+ - Present the entire document in one response (or multiple if too long)
297
+ - Tell user to copy and save as `docs/brownfield-architecture.md` or `docs/project-architecture.md`
298
+ - Mention it can be sharded later in IDE if needed
299
+
300
+ 2. **In IDE Environment**:
301
+ - Create the document as `docs/brownfield-architecture.md`
302
+ - Inform user this single document contains all architectural information
303
+ - Can be sharded later using PO agent if desired
304
+
305
+ The document should be comprehensive enough that future agents can understand:
306
+
307
+ - The actual state of the system (not idealized)
308
+ - Where to find key files and logic
309
+ - What technical debt exists
310
+ - What constraints must be respected
311
+ - If PRD provided: What needs to change for the enhancement]]
312
+
313
+ ### 5. Quality Assurance
314
+
315
+ CRITICAL: Before finalizing the document:
316
+
317
+ 1. **Accuracy Check**: Verify all technical details match the actual codebase
318
+ 2. **Completeness Review**: Ensure all major system components are documented
319
+ 3. **Focus Validation**: If user provided scope, verify relevant areas are emphasized
320
+ 4. **Clarity Assessment**: Check that explanations are clear for AI agents
321
+ 5. **Navigation**: Ensure document has clear section structure for easy reference
322
+
323
+ Apply the advanced elicitation task after major sections to refine based on user feedback.
324
+
325
+ ## Success Criteria
326
+
327
+ - Single comprehensive brownfield architecture document created
328
+ - Document reflects REALITY including technical debt and workarounds
329
+ - Key files and modules are referenced with actual paths
330
+ - Models/APIs reference source files rather than duplicating content
331
+ - If PRD provided: Clear impact analysis showing what needs to change
332
+ - Document enables AI agents to navigate and understand the actual codebase
333
+ - Technical constraints and "gotchas" are clearly documented
334
+
335
+ ## Notes
336
+
337
+ - This task creates ONE document that captures the TRUE state of the system
338
+ - References actual files rather than duplicating content when possible
339
+ - Documents technical debt, workarounds, and constraints honestly
340
+ - For brownfield projects with PRD: Provides clear enhancement impact analysis
341
+ - The goal is PRACTICAL documentation for AI agents doing real work