Phase 2: Design architecture and technical approach
Create comprehensive technical architecture design with Mermaid diagrams, module definitions, and evaluated alternatives. Use this after requirements to plan the implementation approach.
/plugin marketplace add kenotron-ms/amplifier-setup/plugin install dev-kit@amplifier-setupnew-feature/Plan the technical solution: architecture, modules, interfaces, and alternatives.
This template MUST be followed when creating 02-design.md.
# Architecture Design: [Feature]
**Based on**: 01-requirements.md
**Created**: YYYY-MM-DD
## Quick Reference
**For quick lookup - full details below.**
- **Approach**: [One sentence summary]
- **Key Modules**: [Module1, Module2, Module3]
- **Key Technologies**: [Libraries/frameworks used]
- **Key Decisions**:
- [Decision 1]: [Why]
- [Decision 2]: [Why]
- [Decision 3]: [Why]
---
## References
- **Requirements**: `[path to requirements doc in target repository]`
- **Related**: [Links to related design docs, ADRs, etc.]
---
## Executive Summary
[2-3 sentence summary of the chosen approach and why]
## Alternatives Considered
### Alternative 1: [Name]
- **Approach**: [Description]
- **Pros**: [benefits]
- **Cons**: [drawbacks]
- **Testability**: [assessment]
- **Complexity**: [Low/Medium/High]
### Alternative 2: [Name]
- **Approach**: [Description]
- **Pros**: [benefits]
- **Cons**: [drawbacks]
- **Testability**: [assessment]
- **Complexity**: [level]
...
## Recommended Approach
**Choice**: Alternative [X]
**Justification**:
- [Reason 1]
- [Reason 2]
- [Reason 3]
**Trade-offs accepted**:
- [Trade-off 1 and why it's acceptable]
- [Trade-off 2 and why it's acceptable]
---
## Architecture Overview
**Quick Reference**: High-level architecture at a glance.
### System Context Diagram
Use Mermaid to show high-level system components:
\`\`\`mermaid
graph LR
Client[Client/User] -->|requests| System[Feature System]
System --> DB[(Database)]
System --> External[External Services]
\`\`\`
### Component Diagram
Show internal modules and relationships:
\`\`\`mermaid
graph TD
ModuleA[Module A] --> ModuleB[Module B]
ModuleA --> ModuleC[Module C]
ModuleB --> DB[(Storage)]
\`\`\`
### Key Flows
Document 1-3 critical flows with sequence diagrams:
\`\`\`mermaid
sequenceDiagram
User->>System: action
System->>Module: process
Module->>DB: store
DB-->>User: result
\`\`\`
### Key Decisions Summary
Bullet list (5-7 items):
- [Technology choice]: [why]
- [Architecture pattern]: [why]
- [Data storage strategy]: [why]
---
## Module Design
### Module: [Name]
- **Purpose**: [Single responsibility]
- **Location**: `path/to/module.py`
- **Inputs**: [What it receives with types]
- **Outputs**: [What it produces with types]
- **Side Effects**: [DB writes, API calls, file operations]
- **Dependencies**: [What it needs]
- **Public Interface**: [Key functions/methods]
### Module: [Name 2]
[Repeat structure]
## Data Models
\`\`\`language
class ModelName:
field1: Type # description
field2: Type # description
\`\`\`
## API Contracts
\`\`\`language
def function_name(input: Type) -> OutputType:
"""Brief description"""
\`\`\`
## Integration Points
### Integration: [System Name]
- **Connection Point**: [Where/how they connect]
- **Data Flow**: [What's exchanged]
- **Dependencies**: [What's required]
## Philosophy Alignment
### Ruthless Simplicity
- Start minimal: [specific examples]
- Avoid future-proofing: [what we're NOT building]
- Clear over clever: [how we keep it simple]
### Modular Design
- Bricks: [self-contained modules]
- Studs: [connection points]
- Regeneratable: [can rebuild from specs]
## Files to Modify
- [ ] `path/to/file1.ext` - [what changes]
- [ ] `path/to/file2.ext` - [what changes]
## Files to Create
### Production Code
- [ ] `path/to/module/__init__.py` - [purpose]
- [ ] `path/to/module/core.py` - [purpose]
### Tests
- [ ] `tests/unit/test_module.py` - [purpose]
- [ ] `tests/integration/test_module.py` - [purpose]
- [ ] `tests/e2e/test_feature.py` - [purpose]
## Design Assumptions
**IMPORTANT**: Document all assumptions made during design.
### Architecture Assumptions
1. [Assumption]
- **Why**: [Reasoning]
- **Impact if wrong**: [What changes]
- **Alternative**: [Other option]
### Integration Assumptions
1. [Assumption]
- **Why**: [Reasoning]
- **Impact if wrong**: [What changes]
### Performance Assumptions
1. [Assumption]
- **Why**: [Reasoning]
- **Impact if wrong**: [What changes]
### Security Assumptions
1. [Assumption]
- **Why**: [Reasoning]
- **Impact if wrong**: [What changes]
**Review all assumptions carefully. Correcting now prevents expensive redesign later.**
---
## Deployment Considerations
**Note**: If feature requires no special deployment, state: "No special deployment needed - standard code deployment applies."
### Configuration Changes
[Environment variables, config files that need updating]
[If none needed, state: "No configuration changes required"]
### Database Migrations
[Migration scripts needed, if any]
[If none needed, state: "No database changes"]
### Deployment Steps
[Any special steps beyond standard deployment]
[If none needed, state: "Standard deployment process applies"]
### Rollback Plan
[How to rollback if issues occur]
[Minimum: "Revert commit [hash]"]
### Monitoring & Verification
[Key metrics to watch post-deployment, verification steps]
[If standard monitoring sufficient, state: "Standard application monitoring applies"]
ai_working/<feature>-<date>/01-requirements.mdprogress.mdUpdate TodoWrite:
- [ ] Codebase analysis complete
- [ ] Architecture designed
- [ ] Design alternatives evaluated
- [ ] Architecture overview created
- [ ] Testability verified
- [ ] Design assumptions documented
- [ ] Design review approved
REQUIRED: Must use Explore agent.
Task Explore: "Analyze the codebase to understand current architecture related
to [feature area]. Identify patterns, conventions, module structure, testing
approaches, and relevant files. thoroughness: medium"
Wait for agent to complete. Document findings.
REQUIRED: Must use zen-architect agent.
Task zen-architect: "Design architecture for [feature] following
@ai_context/IMPLEMENTATION_PHILOSOPHY.md and @ai_context/MODULAR_DESIGN_PHILOSOPHY.md.
Consider multiple alternatives, evaluate tradeoffs, recommend best approach.
Ensure design is testable with clear contracts. Include high-level architecture
overview with Mermaid diagrams."
Wait for agent to complete. Review design proposals.
REQUIRED: Must create 02-design.md following the TEMPLATE section above.
ai_working/<feature>-<date>/02-design.mdSections to complete:
Focus on:
Update progress.md to mark Phase 2 as PENDING APPROVAL:
2. [⏸] Phase 2: Design - PENDING APPROVAL
Update session notes:
Present summary to user highlighting:
WAIT for user response:
Is the design approach approved?
1. Yes, approved - proceed to test planning
2. No, I want to correct some assumptions
3. No, I prefer a different alternative
4. Let me review the full document first
Your choice: _
ONLY after user approves (option 1):
Update progress.md:
2. [✓] Phase 2: Design (100%) - APPROVED
3. [→] Phase 3: Test Planning (0%) - Starting
Update completion: 25%
Then suggest:
✓ Phase 2 approved!
Next: /new-feature:3-tests
ai_working/<feature>-<date>/02-design.md - Complete architecture design with diagrams and assumptionsprogress.md (updated) - Progress trackerAfter design is approved:
/new-feature:3-tests