brownfield-architecture-tmpl.yaml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. # <!-- Powered by BMAD™ Core -->
  2. template:
  3. id: brownfield-architecture-template-v2
  4. name: Brownfield Enhancement Architecture
  5. version: 2.0
  6. output:
  7. format: markdown
  8. filename: docs/architecture.md
  9. title: "{{project_name}} Brownfield Enhancement Architecture"
  10. workflow:
  11. mode: interactive
  12. elicitation: advanced-elicitation
  13. sections:
  14. - id: introduction
  15. title: Introduction
  16. instruction: |
  17. IMPORTANT - SCOPE AND ASSESSMENT REQUIRED:
  18. This architecture document is for SIGNIFICANT enhancements to existing projects that require comprehensive architectural planning. Before proceeding:
  19. 1. **Verify Complexity**: Confirm this enhancement requires architectural planning. For simple additions, recommend: "For simpler changes that don't require architectural planning, consider using the brownfield-create-epic or brownfield-create-story task with the Product Owner instead."
  20. 2. **REQUIRED INPUTS**:
  21. - Completed brownfield-prd.md
  22. - Existing project technical documentation (from docs folder or user-provided)
  23. - Access to existing project structure (IDE or uploaded files)
  24. 3. **DEEP ANALYSIS MANDATE**: You MUST conduct thorough analysis of the existing codebase, architecture patterns, and technical constraints before making ANY architectural recommendations. Every suggestion must be based on actual project analysis, not assumptions.
  25. 4. **CONTINUOUS VALIDATION**: Throughout this process, explicitly validate your understanding with the user. For every architectural decision, confirm: "Based on my analysis of your existing system, I recommend [decision] because [evidence from actual project]. Does this align with your system's reality?"
  26. If any required inputs are missing, request them before proceeding.
  27. elicit: true
  28. sections:
  29. - id: intro-content
  30. content: |
  31. This document outlines the architectural approach for enhancing {{project_name}} with {{enhancement_description}}. Its primary goal is to serve as the guiding architectural blueprint for AI-driven development of new features while ensuring seamless integration with the existing system.
  32. **Relationship to Existing Architecture:**
  33. This document supplements existing project architecture by defining how new components will integrate with current systems. Where conflicts arise between new and existing patterns, this document provides guidance on maintaining consistency while implementing enhancements.
  34. - id: existing-project-analysis
  35. title: Existing Project Analysis
  36. instruction: |
  37. Analyze the existing project structure and architecture:
  38. 1. Review existing documentation in docs folder
  39. 2. Examine current technology stack and versions
  40. 3. Identify existing architectural patterns and conventions
  41. 4. Note current deployment and infrastructure setup
  42. 5. Document any constraints or limitations
  43. CRITICAL: After your analysis, explicitly validate your findings: "Based on my analysis of your project, I've identified the following about your existing system: [key findings]. Please confirm these observations are accurate before I proceed with architectural recommendations."
  44. elicit: true
  45. sections:
  46. - id: current-state
  47. title: Current Project State
  48. template: |
  49. - **Primary Purpose:** {{existing_project_purpose}}
  50. - **Current Tech Stack:** {{existing_tech_summary}}
  51. - **Architecture Style:** {{existing_architecture_style}}
  52. - **Deployment Method:** {{existing_deployment_approach}}
  53. - id: available-docs
  54. title: Available Documentation
  55. type: bullet-list
  56. template: "- {{existing_docs_summary}}"
  57. - id: constraints
  58. title: Identified Constraints
  59. type: bullet-list
  60. template: "- {{constraint}}"
  61. - id: changelog
  62. title: Change Log
  63. type: table
  64. columns: [Change, Date, Version, Description, Author]
  65. instruction: Track document versions and changes
  66. - id: enhancement-scope
  67. title: Enhancement Scope and Integration Strategy
  68. instruction: |
  69. Define how the enhancement will integrate with the existing system:
  70. 1. Review the brownfield PRD enhancement scope
  71. 2. Identify integration points with existing code
  72. 3. Define boundaries between new and existing functionality
  73. 4. Establish compatibility requirements
  74. VALIDATION CHECKPOINT: Before presenting the integration strategy, confirm: "Based on my analysis, the integration approach I'm proposing takes into account [specific existing system characteristics]. These integration points and boundaries respect your current architecture patterns. Is this assessment accurate?"
  75. elicit: true
  76. sections:
  77. - id: enhancement-overview
  78. title: Enhancement Overview
  79. template: |
  80. **Enhancement Type:** {{enhancement_type}}
  81. **Scope:** {{enhancement_scope}}
  82. **Integration Impact:** {{integration_impact_level}}
  83. - id: integration-approach
  84. title: Integration Approach
  85. template: |
  86. **Code Integration Strategy:** {{code_integration_approach}}
  87. **Database Integration:** {{database_integration_approach}}
  88. **API Integration:** {{api_integration_approach}}
  89. **UI Integration:** {{ui_integration_approach}}
  90. - id: compatibility-requirements
  91. title: Compatibility Requirements
  92. template: |
  93. - **Existing API Compatibility:** {{api_compatibility}}
  94. - **Database Schema Compatibility:** {{db_compatibility}}
  95. - **UI/UX Consistency:** {{ui_compatibility}}
  96. - **Performance Impact:** {{performance_constraints}}
  97. - id: tech-stack
  98. title: Tech Stack
  99. instruction: |
  100. Ensure new components align with existing technology choices:
  101. 1. Use existing technology stack as the foundation
  102. 2. Only introduce new technologies if absolutely necessary
  103. 3. Justify any new additions with clear rationale
  104. 4. Ensure version compatibility with existing dependencies
  105. elicit: true
  106. sections:
  107. - id: existing-stack
  108. title: Existing Technology Stack
  109. type: table
  110. columns: [Category, Current Technology, Version, Usage in Enhancement, Notes]
  111. instruction: Document the current stack that must be maintained or integrated with
  112. - id: new-tech-additions
  113. title: New Technology Additions
  114. condition: Enhancement requires new technologies
  115. type: table
  116. columns: [Technology, Version, Purpose, Rationale, Integration Method]
  117. instruction: Only include if new technologies are required for the enhancement
  118. - id: data-models
  119. title: Data Models and Schema Changes
  120. instruction: |
  121. Define new data models and how they integrate with existing schema:
  122. 1. Identify new entities required for the enhancement
  123. 2. Define relationships with existing data models
  124. 3. Plan database schema changes (additions, modifications)
  125. 4. Ensure backward compatibility
  126. elicit: true
  127. sections:
  128. - id: new-models
  129. title: New Data Models
  130. repeatable: true
  131. sections:
  132. - id: model
  133. title: "{{model_name}}"
  134. template: |
  135. **Purpose:** {{model_purpose}}
  136. **Integration:** {{integration_with_existing}}
  137. **Key Attributes:**
  138. - {{attribute_1}}: {{type_1}} - {{description_1}}
  139. - {{attribute_2}}: {{type_2}} - {{description_2}}
  140. **Relationships:**
  141. - **With Existing:** {{existing_relationships}}
  142. - **With New:** {{new_relationships}}
  143. - id: schema-integration
  144. title: Schema Integration Strategy
  145. template: |
  146. **Database Changes Required:**
  147. - **New Tables:** {{new_tables_list}}
  148. - **Modified Tables:** {{modified_tables_list}}
  149. - **New Indexes:** {{new_indexes_list}}
  150. - **Migration Strategy:** {{migration_approach}}
  151. **Backward Compatibility:**
  152. - {{compatibility_measure_1}}
  153. - {{compatibility_measure_2}}
  154. - id: component-architecture
  155. title: Component Architecture
  156. instruction: |
  157. Define new components and their integration with existing architecture:
  158. 1. Identify new components required for the enhancement
  159. 2. Define interfaces with existing components
  160. 3. Establish clear boundaries and responsibilities
  161. 4. Plan integration points and data flow
  162. MANDATORY VALIDATION: Before presenting component architecture, confirm: "The new components I'm proposing follow the existing architectural patterns I identified in your codebase: [specific patterns]. The integration interfaces respect your current component structure and communication patterns. Does this match your project's reality?"
  163. elicit: true
  164. sections:
  165. - id: new-components
  166. title: New Components
  167. repeatable: true
  168. sections:
  169. - id: component
  170. title: "{{component_name}}"
  171. template: |
  172. **Responsibility:** {{component_description}}
  173. **Integration Points:** {{integration_points}}
  174. **Key Interfaces:**
  175. - {{interface_1}}
  176. - {{interface_2}}
  177. **Dependencies:**
  178. - **Existing Components:** {{existing_dependencies}}
  179. - **New Components:** {{new_dependencies}}
  180. **Technology Stack:** {{component_tech_details}}
  181. - id: interaction-diagram
  182. title: Component Interaction Diagram
  183. type: mermaid
  184. mermaid_type: graph
  185. instruction: Create Mermaid diagram showing how new components interact with existing ones
  186. - id: api-design
  187. title: API Design and Integration
  188. condition: Enhancement requires API changes
  189. instruction: |
  190. Define new API endpoints and integration with existing APIs:
  191. 1. Plan new API endpoints required for the enhancement
  192. 2. Ensure consistency with existing API patterns
  193. 3. Define authentication and authorization integration
  194. 4. Plan versioning strategy if needed
  195. elicit: true
  196. sections:
  197. - id: api-strategy
  198. title: API Integration Strategy
  199. template: |
  200. **API Integration Strategy:** {{api_integration_strategy}}
  201. **Authentication:** {{auth_integration}}
  202. **Versioning:** {{versioning_approach}}
  203. - id: new-endpoints
  204. title: New API Endpoints
  205. repeatable: true
  206. sections:
  207. - id: endpoint
  208. title: "{{endpoint_name}}"
  209. template: |
  210. - **Method:** {{http_method}}
  211. - **Endpoint:** {{endpoint_path}}
  212. - **Purpose:** {{endpoint_purpose}}
  213. - **Integration:** {{integration_with_existing}}
  214. sections:
  215. - id: request
  216. title: Request
  217. type: code
  218. language: json
  219. template: "{{request_schema}}"
  220. - id: response
  221. title: Response
  222. type: code
  223. language: json
  224. template: "{{response_schema}}"
  225. - id: external-api-integration
  226. title: External API Integration
  227. condition: Enhancement requires new external APIs
  228. instruction: Document new external API integrations required for the enhancement
  229. repeatable: true
  230. sections:
  231. - id: external-api
  232. title: "{{api_name}} API"
  233. template: |
  234. - **Purpose:** {{api_purpose}}
  235. - **Documentation:** {{api_docs_url}}
  236. - **Base URL:** {{api_base_url}}
  237. - **Authentication:** {{auth_method}}
  238. - **Integration Method:** {{integration_approach}}
  239. **Key Endpoints Used:**
  240. - `{{method}} {{endpoint_path}}` - {{endpoint_purpose}}
  241. **Error Handling:** {{error_handling_strategy}}
  242. - id: source-tree
  243. title: Source Tree
  244. instruction: |
  245. Define how new code will integrate with existing project structure:
  246. 1. Follow existing project organization patterns
  247. 2. Identify where new files/folders will be placed
  248. 3. Ensure consistency with existing naming conventions
  249. 4. Plan for minimal disruption to existing structure
  250. elicit: true
  251. sections:
  252. - id: existing-structure
  253. title: Existing Project Structure
  254. type: code
  255. language: plaintext
  256. instruction: Document relevant parts of current structure
  257. template: "{{existing_structure_relevant_parts}}"
  258. - id: new-file-organization
  259. title: New File Organization
  260. type: code
  261. language: plaintext
  262. instruction: Show only new additions to existing structure
  263. template: |
  264. {{project-root}}/
  265. ├── {{existing_structure_context}}
  266. │ ├── {{new_folder_1}}/ # {{purpose_1}}
  267. │ │ ├── {{new_file_1}}
  268. │ │ └── {{new_file_2}}
  269. │ ├── {{existing_folder}}/ # Existing folder with additions
  270. │ │ ├── {{existing_file}} # Existing file
  271. │ │ └── {{new_file_3}} # New addition
  272. │ └── {{new_folder_2}}/ # {{purpose_2}}
  273. - id: integration-guidelines
  274. title: Integration Guidelines
  275. template: |
  276. - **File Naming:** {{file_naming_consistency}}
  277. - **Folder Organization:** {{folder_organization_approach}}
  278. - **Import/Export Patterns:** {{import_export_consistency}}
  279. - id: infrastructure-deployment
  280. title: Infrastructure and Deployment Integration
  281. instruction: |
  282. Define how the enhancement will be deployed alongside existing infrastructure:
  283. 1. Use existing deployment pipeline and infrastructure
  284. 2. Identify any infrastructure changes needed
  285. 3. Plan deployment strategy to minimize risk
  286. 4. Define rollback procedures
  287. elicit: true
  288. sections:
  289. - id: existing-infrastructure
  290. title: Existing Infrastructure
  291. template: |
  292. **Current Deployment:** {{existing_deployment_summary}}
  293. **Infrastructure Tools:** {{existing_infrastructure_tools}}
  294. **Environments:** {{existing_environments}}
  295. - id: enhancement-deployment
  296. title: Enhancement Deployment Strategy
  297. template: |
  298. **Deployment Approach:** {{deployment_approach}}
  299. **Infrastructure Changes:** {{infrastructure_changes}}
  300. **Pipeline Integration:** {{pipeline_integration}}
  301. - id: rollback-strategy
  302. title: Rollback Strategy
  303. template: |
  304. **Rollback Method:** {{rollback_method}}
  305. **Risk Mitigation:** {{risk_mitigation}}
  306. **Monitoring:** {{monitoring_approach}}
  307. - id: coding-standards
  308. title: Coding Standards
  309. instruction: |
  310. Ensure new code follows existing project conventions:
  311. 1. Document existing coding standards from project analysis
  312. 2. Identify any enhancement-specific requirements
  313. 3. Ensure consistency with existing codebase patterns
  314. 4. Define standards for new code organization
  315. elicit: true
  316. sections:
  317. - id: existing-standards
  318. title: Existing Standards Compliance
  319. template: |
  320. **Code Style:** {{existing_code_style}}
  321. **Linting Rules:** {{existing_linting}}
  322. **Testing Patterns:** {{existing_test_patterns}}
  323. **Documentation Style:** {{existing_doc_style}}
  324. - id: enhancement-standards
  325. title: Enhancement-Specific Standards
  326. condition: New patterns needed for enhancement
  327. repeatable: true
  328. template: "- **{{standard_name}}:** {{standard_description}}"
  329. - id: integration-rules
  330. title: Critical Integration Rules
  331. template: |
  332. - **Existing API Compatibility:** {{api_compatibility_rule}}
  333. - **Database Integration:** {{db_integration_rule}}
  334. - **Error Handling:** {{error_handling_integration}}
  335. - **Logging Consistency:** {{logging_consistency}}
  336. - id: testing-strategy
  337. title: Testing Strategy
  338. instruction: |
  339. Define testing approach for the enhancement:
  340. 1. Integrate with existing test suite
  341. 2. Ensure existing functionality remains intact
  342. 3. Plan for testing new features
  343. 4. Define integration testing approach
  344. elicit: true
  345. sections:
  346. - id: existing-test-integration
  347. title: Integration with Existing Tests
  348. template: |
  349. **Existing Test Framework:** {{existing_test_framework}}
  350. **Test Organization:** {{existing_test_organization}}
  351. **Coverage Requirements:** {{existing_coverage_requirements}}
  352. - id: new-testing
  353. title: New Testing Requirements
  354. sections:
  355. - id: unit-tests
  356. title: Unit Tests for New Components
  357. template: |
  358. - **Framework:** {{test_framework}}
  359. - **Location:** {{test_location}}
  360. - **Coverage Target:** {{coverage_target}}
  361. - **Integration with Existing:** {{test_integration}}
  362. - id: integration-tests
  363. title: Integration Tests
  364. template: |
  365. - **Scope:** {{integration_test_scope}}
  366. - **Existing System Verification:** {{existing_system_verification}}
  367. - **New Feature Testing:** {{new_feature_testing}}
  368. - id: regression-tests
  369. title: Regression Testing
  370. template: |
  371. - **Existing Feature Verification:** {{regression_test_approach}}
  372. - **Automated Regression Suite:** {{automated_regression}}
  373. - **Manual Testing Requirements:** {{manual_testing_requirements}}
  374. - id: security-integration
  375. title: Security Integration
  376. instruction: |
  377. Ensure security consistency with existing system:
  378. 1. Follow existing security patterns and tools
  379. 2. Ensure new features don't introduce vulnerabilities
  380. 3. Maintain existing security posture
  381. 4. Define security testing for new components
  382. elicit: true
  383. sections:
  384. - id: existing-security
  385. title: Existing Security Measures
  386. template: |
  387. **Authentication:** {{existing_auth}}
  388. **Authorization:** {{existing_authz}}
  389. **Data Protection:** {{existing_data_protection}}
  390. **Security Tools:** {{existing_security_tools}}
  391. - id: enhancement-security
  392. title: Enhancement Security Requirements
  393. template: |
  394. **New Security Measures:** {{new_security_measures}}
  395. **Integration Points:** {{security_integration_points}}
  396. **Compliance Requirements:** {{compliance_requirements}}
  397. - id: security-testing
  398. title: Security Testing
  399. template: |
  400. **Existing Security Tests:** {{existing_security_tests}}
  401. **New Security Test Requirements:** {{new_security_tests}}
  402. **Penetration Testing:** {{pentest_requirements}}
  403. - id: checklist-results
  404. title: Checklist Results Report
  405. instruction: Execute the architect-checklist and populate results here, focusing on brownfield-specific validation
  406. - id: next-steps
  407. title: Next Steps
  408. instruction: |
  409. After completing the brownfield architecture:
  410. 1. Review integration points with existing system
  411. 2. Begin story implementation with Dev agent
  412. 3. Set up deployment pipeline integration
  413. 4. Plan rollback and monitoring procedures
  414. sections:
  415. - id: story-manager-handoff
  416. title: Story Manager Handoff
  417. instruction: |
  418. Create a brief prompt for Story Manager to work with this brownfield enhancement. Include:
  419. - Reference to this architecture document
  420. - Key integration requirements validated with user
  421. - Existing system constraints based on actual project analysis
  422. - First story to implement with clear integration checkpoints
  423. - Emphasis on maintaining existing system integrity throughout implementation
  424. - id: developer-handoff
  425. title: Developer Handoff
  426. instruction: |
  427. Create a brief prompt for developers starting implementation. Include:
  428. - Reference to this architecture and existing coding standards analyzed from actual project
  429. - Integration requirements with existing codebase validated with user
  430. - Key technical decisions based on real project constraints
  431. - Existing system compatibility requirements with specific verification steps
  432. - Clear sequencing of implementation to minimize risk to existing functionality