| ํญ๋ชฉ | ๋ด์ฉ |
|---|---|
| Invoke | /architecture |
/architecture โ ์์คํ ์ค๊ณ๋ ๊ทธ๋ฆฌ๊ธฐ#
ํ๋ง๋๋ก#
๊ฑด๋ฌผ์ ์ง๊ธฐ ์ ์ ๊ฑด์ถ๊ฐ๊ฐ ์ค๊ณ๋๋ฉด์ ๊ทธ๋ฆฌ๋ ๊ฒ๊ณผ ๊ฐ์ต๋๋ค. ๋ฌด์์(์๊ตฌ์ฌํญ) ์ด๋ค ๊ธฐ์ ๊ณผ ๊ตฌ์กฐ๋ก ๋ง๋ค์ง, ๋นํ์์ด ํ ๋ฌธ์๋ก ์ ๋ฆฌํด ์ค๋๋ค.
๋๊ฐยท์ธ์ ์ฐ๋์#
- ๋ง๋ค ๊ฒ์ด ๋ฌด์์ธ์ง(์๊ตฌ์ฌํญ ๋ฌธ์, PRD)๋ ์ ํด์ก๊ณ , ์ด์ "์ด๋ป๊ฒ ๋ง๋ค์ง"๋ฅผ ์ ํด์ผ ํ ๋
- ์ด๋ ์ ๋ ๊ท๋ชจ ์๋ ํ๋ก์ ํธ(BMAD Level 2 ์ด์)๋ฅผ ์์ํ๊ธฐ ์
- ๊ธฐํ๊ณผ ์ค์ ๊ฐ๋ฐ ์ฌ์ด, ๋ค๋ฆฌ๋ฅผ ๋๋ ๋จ๊ณ(์ ์ฒด ํ๋ฆ์ 3๋จ๊ณ "Solutioning")
- ์์ ์ ๋งก๋ ์ญํ ์ System Architect(์์คํ ์ค๊ณ์), ๋ณดํต 60~120๋ถ ์ ๋ ๊ฑธ๋ฆฝ๋๋ค.
๋ฌด์์ ํด์ฃผ๋์#
.bmad/architecture-(ํ๋ก์ ํธ์ด๋ฆ)-(๋ ์ง).md ๋ผ๋ ์ค๊ณ ๋ฌธ์ ํ ๊ฐ๊ฐ ๋ง๋ค์ด์ง๋๋ค. ๊ทธ ์์๋:
- ์ ์ฒด ๊ตฌ์กฐ โ ์ด๋ค ํฐ ๊ทธ๋ฆผ(ํจํด)์ผ๋ก ๋ง๋ค์ง, ์ฃผ์ ๋ถํ๋ค์ด ์ด๋ป๊ฒ ์ฐ๊ฒฐ๋๋์ง
- ๊ธฐ์ ์ ํ โ ํ๋ฉดยท์๋ฒยท๋ฐ์ดํฐ๋ฒ ์ด์คยท์ธํ๋ผ๋ฅผ ๋ฌด์์ผ๋ก ์ธ์ง, ๊ทธ๋ฆฌ๊ณ ๊ทธ ์ด์ ์ ์ฅ๋จ์
- ๋ฐ์ดํฐยทAPI ์ค๊ณ โ ์ด๋ค ์ ๋ณด๋ฅผ ์ด๋ป๊ฒ ๋ค๋ฃจ๊ณ , ์ธ๋ถ์ ์ด๋ค ์ฐฝ๊ตฌ๋ก ์ฃผ๊ณ ๋ฐ๋์ง
- ํ์ง ๋ณด์ฅ ๋ฐฉ์ โ ์๋, ๋ณด์, ํ์ฅ์ฑ, ์์ ์ฑ์ ์ด๋ป๊ฒ ์ถฉ์กฑ์ํฌ์ง
- ์ถ์ ํ โ ์๊ตฌ์ฌํญ ํ๋ํ๋๊ฐ ์ด๋ ๋ถํ์์ ์ฒ๋ฆฌ๋๋์ง ํ๋ก ์ ๋ฆฌ
- ๋ง์ง๋ง์ ๋น ์ง ๊ฒ ์๋์ง ์ฒดํฌ๋ฆฌ์คํธ๋ก ์ ๊ฒํ ๋ค ๋ค์ ๋จ๊ณ๋ฅผ ์๋ดํฉ๋๋ค.
์ด๋ป๊ฒ ์ฐ๋์#
# ์ค๊ณ ๋จ๊ณ ์คํ
/architecture
๋ณ๋์ ์ต์ ์์ด ์คํํ๋ฉด, ์์คํ ์ค๊ณ์ ์ญํ ์ด ๋์ด ์๊ตฌ์ฌํญ ๋ฌธ์(PRD ๋๋ tech-spec)๋ฅผ ์ฝ๊ณ ์ง๋ฌธ์ ๋์ ธ ๊ฐ๋ฉฐ ํจ๊ป ์ค๊ณ๋๋ฅผ ์์ฑํด ๋๊ฐ๋๋ค.
์์์ ๋ฌด์จ ์ผ์ด ๋ฒ์ด์ง๋์#
์ค๋น ์์ ์ ํ ๋ค, ์ค๊ณ๋ฅผ 12๊ฐ ๋ถ๋ถ์ผ๋ก ๋๋ ์ฐจ๋ก์ฐจ๋ก ์ฑ์ ๊ฐ๋๋ค.
- ์ฌ์ ์ค๋น โ ์๊ตฌ์ฌํญ ๋ฌธ์(PRD/tech-spec)๋ฅผ ์ฝ์ด ๊ธฐ๋ฅยทํ์ง ์๊ตฌ์ฌํญ์ ๋ชจ๋ ์ถ๋ ค๋ ๋๋ค.
- ํต์ฌ ์ ์ฝ ํ์ โ ์๋ยท๋ณด์ยทํ์ฅ์ฑ์ฒ๋ผ ์ค๊ณ๋ฅผ ํฌ๊ฒ ์ข์ฐํ๋ ์กฐ๊ฑด์ ๋จผ์ ์ฐพ์ต๋๋ค.
- ํฐ ๊ทธ๋ฆผ ์ ํ๊ธฐ โ ์ ์ฒด ๊ตฌ์กฐ ํจํด๊ณผ ์ฃผ์ ๋ถํ, ๋ฐ์ดํฐ ํ๋ฆ์ ์ก์ต๋๋ค.
- ๊ธฐ์ ๊ณ ๋ฅด๊ธฐ โ ํ๋ฉดยท์๋ฒยทDBยท์ธํ๋ผยท์ธ๋ถ ์๋น์ค๋ฅผ ์ด์ ์ ์ฅ๋จ์ ๊น์ง ํจ๊ป ์ ํํฉ๋๋ค.
- ๋ถํยท๋ฐ์ดํฐยทAPI ์ค๊ณ โ ๊ฐ ๋ถํ์ ์ญํ , ๋ฐ์ดํฐ ๋ชจ๋ธ, ์ธ๋ถ์ ์ฃผ๊ณ ๋ฐ๋ ์ฐฝ๊ตฌ๋ฅผ ์ ์ํฉ๋๋ค.
- ํ์ง ์ฑ๊ธฐ๊ธฐ โ ๋ณด์, ํ์ฅ์ฑยท์ฑ๋ฅ, ์์ ์ฑยท๋ณต๊ตฌ, ๊ฐ๋ฐยท๋ฐฐํฌ ๋ฐฉ์์ ํ๋์ฉ ์ค๊ณํฉ๋๋ค.
- ์ถ์ ยท์ ๋ฆฌ โ ์๊ตฌ์ฌํญ๊ณผ ์ค๊ณ๋ฅผ ํ๋ก ์ฐ๊ฒฐํ๊ณ , ์ ํ์ ์ฅ๋จ์ ์ ๊ธฐ๋กํฉ๋๋ค.
- ๋ฌธ์ ์์ฑยท๊ฒ์ฆ โ ๋ชจ๋ ๋ด์ฉ์ ํ ํ๋ฆฟ์ ์ฑ์ ํ ๋ฌธ์๋ก ๋ง๋ค๊ณ , ์ฒดํฌ๋ฆฌ์คํธ๋ก ๋น ์ง ๊ณณ์ ์ ๊ฒํฉ๋๋ค.
๋๋๋ฉด ์ํ๊ฐ ๊ฐฑ์ ๋๊ณ , ๋ค์ ๋จ๊ณ์ธ ์คํ๋ฆฐํธ ๊ณํ(/sprint-planning) ์ผ๋ก ์๋ดํฉ๋๋ค.
โ๏ธ ์์ธ ์ต์ ยท์คํ ๋ช ์ธ (๊ฐ๋ฐ์ / AI ์์ด์ ํธ์ฉ)
Workflow Overview#
Goal: Design system architecture that satisfies all functional and non-functional requirements
Phase: 3 - Solutioning
Agent: System Architect
Inputs: PRD or tech-spec, architectural drivers analysis
Output: .bmad/architecture-{project-name}-{date}.md
Duration: 60-120 minutes
Required for: Level 2+ projects
Pre-Flight#
- Load context per
helpers.md#Combined-Config-Load - Check status per
helpers.md#Load-Workflow-Status - Load requirements document:
- Check for PRD:
.bmad/prd-*.md - If no PRD, check for tech-spec:
.bmad/tech-spec-*.md - Read and extract ALL FRs and NFRs
- Check for PRD:
- Load template per
helpers.md#Load-Template(architecture.md)
Architecture Design Process#
Use TodoWrite to track: Pre-flight โ Drivers โ Overview โ Stack โ Components โ Data โ API โ NFRs โ Generate โ Validate โ Update
Approach: Thoughtful, principled, detail-oriented.
Part 1: Identify Architectural Drivers#
Architectural drivers are requirements that heavily influence design decisions.
Review all NFRs, identify those requiring significant architectural consideration:
- Performance requirements (response time, throughput)
- Scalability requirements (concurrent users, data volume)
- Security requirements (compliance, encryption, auth)
- Availability requirements (uptime, DR)
- Integration requirements (external systems)
Ask user: "Which of these NFRs are most critical for your architecture?"
Format:
**Architectural Drivers:**
1. NFR-001: 99.9% availability โ Requires redundancy, failover
2. NFR-002: < 200ms API response โ Requires caching, optimization
3. NFR-003: 10,000 concurrent users โ Requires horizontal scalingStore as: {{architectural_drivers}}
Part 2: High-Level Architecture#
Explain to user:
"Let's start with the big picture. What's the overall architecture pattern?"
Based on project level and requirements, suggest:
Level 2 (5-15 stories):
- Modular Monolith: Simple deployment, clear boundaries, easy to start
- Layered Architecture: Traditional, proven, good for CRUD apps
Level 3-4 (12+ stories):
- Microservices: Independent scaling, team autonomy, complex coordination
- Event-Driven: Asynchronous, loosely coupled, good for workflows
- Hybrid: Mix of patterns where appropriate
Ask user: "Which pattern fits best? Or do you have a preference?"
Describe:
- Main system components (3-7 major components)
- How they interact
- Data flow overview
Format:
**Pattern:** Modular Monolith with API Gateway
**Components:**
1. API Gateway (entry point, auth, routing)
2. Application Core (business logic modules)
3. Data Layer (ORM, repositories)
4. External Integrations (3rd party APIs)
5. Background Jobs (async processing)
**Interaction:**
Client โ API Gateway โ Application Core โ Data Layer โ DatabaseStore as: {{architectural_pattern}}, {{pattern_rationale}}, {{high_level_architecture}}
Architecture Diagram:
Ask user: "Do you want a text-based diagram or will you create one separately?"
If text: Provide ASCII/mermaid format
Store as: {{architecture_diagram}}
Part 3: Technology Stack#
Systematic selection with justification.
Frontend: Ask: "What frontend technology?"
- React, Vue, Angular, Svelte, etc.
- Consider: NFR requirements (SEO, performance, accessibility) Justify: Why this choice over alternatives?
Backend: Ask: "What backend framework?"
- Based on team skills, performance needs, ecosystem
- Consider: Scalability, developer productivity, library support Justify: Why this choice?
Database: Ask: "What database(s)?"
- Relational (PostgreSQL, MySQL) vs. NoSQL (MongoDB, DynamoDB)
- Consider: Data model complexity, query patterns, consistency needs Justify: Why this choice?
Infrastructure: Ask: "Where will this run?"
- Cloud (AWS, Azure, GCP) vs. On-prem
- Containerization (Docker, K8s)
- Serverless vs. VMs Justify: Why this approach?
Third-Party Services: Ask: "Any external services needed?"
- Auth (Auth0, Cognito)
- Payments (Stripe, PayPal)
- Email (SendGrid, SES)
- Analytics, monitoring, etc.
Development & Deployment:
- Version control (Git)
- CI/CD (GitHub Actions, GitLab CI, Jenkins)
- Testing frameworks
- Monitoring/logging (Datadog, CloudWatch, ELK)
For each technology:
### {Category}
**Choice:** {Technology}
**Rationale:** {Why this over alternatives, addresses which NFRs}
**Trade-offs:** {What we gain, what we lose}Store as: {{frontend_stack}}, {{backend_stack}}, {{database_stack}}, etc.
Part 4: System Components#
Define 3-10 major components (based on project level).
For each component:
- Name and purpose
- Responsibilities (what it does)
- Interfaces (how it's accessed)
- Dependencies (what it depends on)
- FRs addressed (which requirements it satisfies)
Format:
### Component: API Gateway
**Purpose:** Single entry point for all client requests
**Responsibilities:**
- Request routing
- Authentication/authorization
- Rate limiting
- API versioning
**Interfaces:**
- REST API (HTTPS, port 443)
- WebSocket (for real-time features)
**Dependencies:**
- Auth Service (for token validation)
- Backend Services (routing targets)
**FRs Addressed:** FR-001, FR-003, FR-008Store as: {{system_components}}
Part 5: Data Architecture#
Data Model: Ask: "What are the core data entities?"
For each entity:
- Entity name
- Key attributes
- Relationships
- Cardinality
Format:
**Entities:**
1. User (id, email, name, created_at)
- Has many: Posts, Comments
2. Post (id, title, content, user_id, created_at)
- Belongs to: User
- Has many: Comments
3. Comment (id, content, user_id, post_id, created_at)
- Belongs to: User, PostDatabase Design:
- Schema design (tables, indexes)
- Normalization level
- Partitioning strategy (if applicable)
Data Flow:
- How data moves through system
- Read vs. write paths
- Caching layers
Store as: {{data_model}}, {{database_design}}, {{data_flow}}
Part 6: API Design#
API Architecture:
- REST, GraphQL, gRPC, or hybrid?
- Versioning strategy
- Authentication method (JWT, OAuth, API keys)
- Response formats (JSON, Protocol Buffers)
Key Endpoints: List 10-20 most important API endpoints.
Format:
### User Management
- POST /api/v1/auth/register - Register new user
- POST /api/v1/auth/login - User login (returns JWT)
- GET /api/v1/users/{id} - Get user by ID
- PATCH /api/v1/users/{id} - Update user
### Posts
- GET /api/v1/posts - List posts (paginated)
- POST /api/v1/posts - Create post
- GET /api/v1/posts/{id} - Get post by ID
- DELETE /api/v1/posts/{id} - Delete post
[Continue for all major resources...]Authentication & Authorization:
- How users authenticate
- How permissions are enforced
- Token management
- Session handling
Store as: {{api_architecture}}, {{api_endpoints}}, {{api_auth}}
Part 7: NFR Coverage (Systematic)#
For EACH NFR from PRD/tech-spec, document how architecture addresses it.
Template per NFR:
### NFR-{ID}: {NFR Name}
**Requirement:** {Original NFR text with measurable target}
**Architecture Solution:**
{Specific architectural decisions that address this NFR}
**Implementation Notes:**
{Guidance for developers}
**Validation:**
{How to verify this NFR is met}Examples:
NFR-001: Performance
**Requirement:** API response time < 200ms for 95% of requests
**Solution:**
- Redis caching layer for frequent queries
- Database indexing on common query fields
- CDN for static assets
- Connection pooling to reduce latency
**Implementation Notes:**
- Cache TTL: 5 minutes for user data, 1 hour for static content
- Implement cache invalidation on writes
**Validation:**
- Monitor p95 response time in production
- Load testing: 1000 RPS with < 200ms p95Typical NFR count: 5-12 NFRs to address
Store as: {{nfr_001_name}}, {{nfr_001_requirement}}, {{nfr_001_solution}}, etc.
Store additional: {{additional_nfrs}}
Part 8: Security Architecture#
Authentication:
- Method (JWT, OAuth 2.0, SAML)
- Token lifetime and refresh
- Multi-factor authentication (if required)
Authorization:
- RBAC (Role-Based Access Control) or ABAC (Attribute-Based)
- Permission model
- How permissions are enforced
Data Encryption:
- At rest: Database encryption, file storage encryption
- In transit: TLS 1.3, HTTPS everywhere
- Key management (AWS KMS, Azure Key Vault)
Security Best Practices:
- Input validation
- SQL injection prevention
- XSS prevention
- CSRF protection
- Rate limiting
- Security headers
Store as: {{auth_design}}, {{authz_design}}, {{encryption_design}}, {{security_practices}}
Part 9: Scalability & Performance#
Scaling Strategy:
- Horizontal scaling (add more instances)
- Vertical scaling (bigger instances)
- Auto-scaling triggers and limits
- Database scaling (read replicas, sharding)
Performance Optimization:
- Query optimization
- N+1 query prevention
- Lazy loading strategies
- Compression
Caching Strategy:
- What to cache (hot data, computed results)
- Cache invalidation strategy
- Cache hierarchy (CDN, app cache, DB cache)
Load Balancing:
- Load balancer type (ALB, NLB, nginx)
- Algorithm (round-robin, least connections)
- Health checks
Store as: {{scaling_strategy}}, {{performance_optimization}}, {{caching_strategy}}, {{load_balancing}}
Part 10: Reliability & Availability#
High Availability:
- Multi-AZ deployment
- Redundancy (no single points of failure)
- Failover mechanisms
- Circuit breakers
Disaster Recovery:
- RPO (Recovery Point Objective)
- RTO (Recovery Time Objective)
- Backup frequency
- Restore procedures
Monitoring & Alerting:
- Metrics to track (latency, error rate, saturation)
- Logging strategy (structured logging, log aggregation)
- Alerting thresholds and escalation
Store as: {{ha_design}}, {{dr_design}}, {{backup_strategy}}, {{monitoring_alerting}}
Part 11: Development & Deployment#
Code Organization:
- Project structure
- Module boundaries
- Naming conventions
Testing Strategy:
- Unit testing (coverage target: 80%+)
- Integration testing
- E2E testing
- Performance testing
CI/CD Pipeline:
- Build โ Test โ Deploy stages
- Automated testing gates
- Deployment strategy (blue-green, canary, rolling)
Environments:
- Development, staging, production
- Environment parity
- Configuration management
Store as: {{code_organization}}, {{testing_strategy}}, {{cicd_pipeline}}, {{environments}}, {{deployment_strategy}}
Part 12: Traceability & Trade-offs#
FR Traceability: Create table mapping each FR to components that implement it:
| FR ID | FR Name | Components | Notes |
|-------|---------|------------|-------|
| FR-001 | User registration | API Gateway, User Service, Database | Standard CRUD |
| FR-002 | Email verification | User Service, Email Service, Queue | Async processing |NFR Traceability: Map each NFR to architectural solutions:
| NFR ID | NFR Name | Solution | Validation |
|--------|----------|----------|------------|
| NFR-001 | 99.9% uptime | Multi-AZ, health checks | Monitor uptime |
| NFR-002 | < 200ms latency | Caching, CDN, indexing | P95 metrics |Trade-offs: Document major trade-offs:
**Decision:** Use microservices architecture
**Trade-off:**
- โ Gain: Independent scaling, team autonomy
- โ Lose: Deployment complexity, distributed transactions harder
**Rationale:** Benefits outweigh costs for Level 3 project scaleStore as: {{fr_traceability}}, {{nfr_traceability}}, {{tradeoffs}}
Generate Document#
- Load template from
${CLAUDE_PLUGIN_ROOT}/references/templates/architecture.md - Substitute variables per
helpers.md#Apply-Variables-to-Template(40+ variables) - Determine output path:
{output_folder}/architecture-{project-name}-{date}.md - Write document using Write tool
- Display summary:
โ Architecture Created! Summary: - Pattern: {pattern} - Components: {count} - Tech Stack: {stack summary} - FRs Addressed: {fr_count}/{total_frs} - NFRs Addressed: {nfr_count}/{total_nfrs} - Pages: ~{page_count}
Validation#
โ Checklist:
- [ ] All FRs have component assignments
- [ ] All NFRs have architectural solutions
- [ ] Technology choices are justified
- [ ] Trade-offs are documented
- [ ] Security is addressed comprehensively
- [ ] Scalability path is clear
- [ ] Data model is defined
- [ ] API contracts are specified
- [ ] Testing strategy is defined
- [ ] Deployment approach is clearAsk user: "Please review the architecture. Does it address all requirements?"
Update Status#
Per helpers.md#Update-Workflow-Status:
- Update
architecturestatus to file path - Save
Recommend Next Steps#
โ Architecture complete!
Next: Sprint Planning (Phase 4)
Run /sprint-planning to:
- Break epics into detailed stories
- Estimate story complexity
- Plan sprint iterations
- Begin implementation
You now have complete planning documentation:
โ Product Brief
โ PRD
โ Architecture
Implementation teams have everything needed to build successfully!Helper References#
- Load config:
helpers.md#Combined-Config-Load - Load status:
helpers.md#Load-Workflow-Status - Load template:
helpers.md#Load-Template - Apply variables:
helpers.md#Apply-Variables-to-Template - Save document:
helpers.md#Save-Output-Document - Update status:
helpers.md#Update-Workflow-Status - Recommend next:
helpers.md#Determine-Next-Workflow
Tips for Effective Architecture#
Start with NFRs:
- NFRs drive architecture more than FRs
- Identify architectural drivers early
- Design for constraints first
Keep it Simple:
- Simplest solution that meets requirements
- Avoid premature optimization
- Don't over-engineer for Level 2 projects
Document Decisions:
- Every major choice needs a "why"
- Trade-offs should be explicit
- Future readers need context
Think in Layers:
- Clear separation of concerns
- Loose coupling between layers
- High cohesion within layers
Design for Change:
- Identify likely changes
- Make those areas pluggable
- But don't abstract everything
Notes for LLMs#
- Maintain a thoughtful, principled persona
- Use TodoWrite to track 12 architecture parts
- Systematically cover ALL FRs and NFRs - don't skip any
- Apply appropriate patterns based on project level
- Document trade-offs - no perfect solutions exist
- Use Memory tool to store architecture for Phase 4
- Validate completeness before finalizing
- Hand off to Scrum Master when ready for implementation
Remember: Architecture quality determines implementation success. Take time to design well - it saves enormous effort later.