@wipal/agent-team 1.0.0
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.
- package/.claude/rules/common/general-rules.md +141 -0
- package/.claude/rules/lessons/lessons.md +91 -0
- package/.claude/rules/role-rules/dev-fe-rules.md +146 -0
- package/.claude/rules/role-rules/sa-rules.md +226 -0
- package/.claude/skills/SKILL-INDEX.md +299 -0
- package/.claude/skills/community/security-validator/SKILL.md +392 -0
- package/.claude/skills/core/agent-creation/SKILL.md +338 -0
- package/.claude/skills/core/code-review/SKILL.md +154 -0
- package/.claude/skills/core/git-automation/SKILL.md +93 -0
- package/.claude/skills/core/retrospect-work/SKILL.md +172 -0
- package/.claude/skills/domain/architecture/adr-writing/SKILL.md +254 -0
- package/.claude/skills/domain/architecture/adr-writing/references/adr-best-practices.md +257 -0
- package/.claude/skills/domain/architecture/adr-writing/references/adr-examples.md +246 -0
- package/.claude/skills/domain/architecture/adr-writing/references/adr-template.md +160 -0
- package/.claude/skills/domain/architecture/architecture-patterns/SKILL.md +316 -0
- package/.claude/skills/domain/architecture/architecture-patterns/references/event-driven.md +393 -0
- package/.claude/skills/domain/architecture/architecture-patterns/references/microservices.md +315 -0
- package/.claude/skills/domain/architecture/architecture-patterns/references/monolith.md +321 -0
- package/.claude/skills/domain/architecture/architecture-patterns/references/serverless.md +457 -0
- package/.claude/skills/domain/architecture/performance-engineering/SKILL.md +227 -0
- package/.claude/skills/domain/architecture/performance-engineering/references/benchmarking.md +336 -0
- package/.claude/skills/domain/architecture/performance-engineering/references/caching-strategies.md +284 -0
- package/.claude/skills/domain/architecture/performance-engineering/references/optimization.md +298 -0
- package/.claude/skills/domain/architecture/security-architecture/SKILL.md +206 -0
- package/.claude/skills/domain/architecture/security-architecture/references/auth-patterns.md +209 -0
- package/.claude/skills/domain/architecture/security-architecture/references/compliance.md +246 -0
- package/.claude/skills/domain/architecture/security-architecture/references/threat-modeling.md +219 -0
- package/.claude/skills/domain/architecture/system-design/SKILL.md +227 -0
- package/.claude/skills/domain/architecture/system-design/references/distributed-systems.md +231 -0
- package/.claude/skills/domain/architecture/system-design/references/resilience.md +344 -0
- package/.claude/skills/domain/architecture/system-design/references/scalability.md +303 -0
- package/.claude/skills/domain/architecture/tech-selection/SKILL.md +192 -0
- package/.claude/skills/domain/architecture/tech-selection/references/build-vs-buy.md +258 -0
- package/.claude/skills/domain/architecture/tech-selection/references/evaluation-framework.md +203 -0
- package/.claude/skills/domain/architecture/tech-selection/references/tech-radar.md +257 -0
- package/.claude/skills/domain/backend/api-design/SKILL.md +121 -0
- package/.claude/skills/domain/backend/database-design/SKILL.md +156 -0
- package/.claude/skills/domain/backend/performance-be/SKILL.md +210 -0
- package/.claude/skills/domain/backend/security/SKILL.md +138 -0
- package/.claude/skills/domain/backend/testing-be/SKILL.md +203 -0
- package/.claude/skills/domain/devops/ci-cd/SKILL.md +188 -0
- package/.claude/skills/domain/devops/containerization/SKILL.md +177 -0
- package/.claude/skills/domain/devops/deployment/SKILL.md +198 -0
- package/.claude/skills/domain/devops/infrastructure-as-code/SKILL.md +178 -0
- package/.claude/skills/domain/devops/monitoring/SKILL.md +163 -0
- package/.claude/skills/domain/frontend/accessibility/SKILL.md +179 -0
- package/.claude/skills/domain/frontend/frontend-design/SKILL.md +138 -0
- package/.claude/skills/domain/frontend/performance-fe/SKILL.md +195 -0
- package/.claude/skills/domain/frontend/state-management/SKILL.md +190 -0
- package/.claude/skills/domain/frontend/testing-fe/SKILL.md +193 -0
- package/.claude/skills/domain/product/requirements-gathering/SKILL.md +136 -0
- package/.claude/skills/domain/product/roadmap-planning/SKILL.md +169 -0
- package/.claude/skills/domain/product/sprint-planning/SKILL.md +151 -0
- package/.claude/skills/domain/product/stakeholder-communication/SKILL.md +162 -0
- package/.claude/skills/domain/product/user-stories/SKILL.md +141 -0
- package/.claude/skills/domain/quality/bug-reporting/SKILL.md +150 -0
- package/.claude/skills/domain/quality/regression-testing/SKILL.md +178 -0
- package/.claude/skills/domain/quality/test-automation/SKILL.md +185 -0
- package/.claude/skills/domain/quality/test-planning/SKILL.md +177 -0
- package/.claude/skills/leadership/code-review-advanced/SKILL.md +167 -0
- package/.claude/skills/leadership/mentoring/SKILL.md +151 -0
- package/.claude/skills/leadership/technical-debt/SKILL.md +166 -0
- package/.claude/skills/leadership/technical-decision/SKILL.md +160 -0
- package/.claude/skills/security-reports/.gitkeep +0 -0
- package/.claude/skills/skills-registry.yaml +441 -0
- package/README.md +232 -0
- package/bin/agent-team.js +107 -0
- package/package.json +51 -0
- package/src/commands/add.js +227 -0
- package/src/commands/init.js +136 -0
- package/src/commands/list.js +66 -0
- package/src/commands/remove.js +71 -0
- package/src/commands/switch.js +53 -0
- package/src/index.js +11 -0
- package/src/interactive/prompts.js +153 -0
- package/src/server/api/agents.js +150 -0
- package/src/server/api/roles.js +97 -0
- package/src/server/api/skills.js +79 -0
- package/src/server/index.js +78 -0
- package/src/ui/agents.html +174 -0
- package/src/ui/css/styles.css +470 -0
- package/src/ui/index.html +107 -0
- package/src/ui/roles.html +371 -0
- package/src/ui/skills.html +332 -0
- package/src/utils/file-utils.js +193 -0
- package/src/utils/skill-resolver.js +594 -0
- package/src/utils/skill-scanner.js +154 -0
- package/templates/CLAUDE.md.tmpl +42 -0
- package/templates/knowledge.md.tmpl +31 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# ADR Examples
|
|
2
|
+
|
|
3
|
+
Real-world examples of Architecture Decision Records.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Example 1: Database Selection
|
|
8
|
+
|
|
9
|
+
# ADR-001: Use PostgreSQL for Primary Database
|
|
10
|
+
|
|
11
|
+
## Status
|
|
12
|
+
Accepted
|
|
13
|
+
|
|
14
|
+
## Context
|
|
15
|
+
Our e-commerce application requires a relational database for:
|
|
16
|
+
- User accounts and authentication
|
|
17
|
+
- Product catalog with complex relationships
|
|
18
|
+
- Order management with ACID transactions
|
|
19
|
+
- Inventory tracking with strong consistency
|
|
20
|
+
|
|
21
|
+
Current situation:
|
|
22
|
+
- MySQL 5.7 running on single EC2 instance
|
|
23
|
+
- Approaching capacity limits (500GB)
|
|
24
|
+
- No high availability
|
|
25
|
+
- Manual backups
|
|
26
|
+
|
|
27
|
+
Requirements:
|
|
28
|
+
- ACID compliance
|
|
29
|
+
- JSON support for flexible product attributes
|
|
30
|
+
- Full-text search capability
|
|
31
|
+
- High availability
|
|
32
|
+
- Managed service preferred
|
|
33
|
+
|
|
34
|
+
## Decision
|
|
35
|
+
We will use Amazon RDS for PostgreSQL as our primary database.
|
|
36
|
+
|
|
37
|
+
Configuration:
|
|
38
|
+
- Instance: db.r6g.xlarge (4 vCPU, 32GB RAM)
|
|
39
|
+
- Multi-AZ deployment for HA
|
|
40
|
+
- 1TB gp3 storage with auto-scaling
|
|
41
|
+
- PostgreSQL 15.x
|
|
42
|
+
|
|
43
|
+
## Consequences
|
|
44
|
+
|
|
45
|
+
### Positive
|
|
46
|
+
- Strong ACID compliance for financial transactions
|
|
47
|
+
- Native JSON support eliminates need for separate document store
|
|
48
|
+
- Built-in full-text search reduces infrastructure
|
|
49
|
+
- Managed service reduces operational burden
|
|
50
|
+
- Point-in-time recovery for backups
|
|
51
|
+
- Better query optimizer than MySQL for complex joins
|
|
52
|
+
|
|
53
|
+
### Negative
|
|
54
|
+
- Team needs to learn PostgreSQL (MySQL experience currently)
|
|
55
|
+
- Migration effort estimated at 3 weeks
|
|
56
|
+
- Higher cost than self-managed ($800/month vs $400/month)
|
|
57
|
+
- Some MySQL-specific queries need rewriting
|
|
58
|
+
|
|
59
|
+
### Risks
|
|
60
|
+
| Risk | Likelihood | Impact | Mitigation |
|
|
61
|
+
|------|------------|--------|------------|
|
|
62
|
+
| Migration data loss | Low | High | Test migration 3x, use CDC |
|
|
63
|
+
| Performance regression | Medium | Medium | Load test with production data |
|
|
64
|
+
| Team learning curve | High | Low | Training budget allocated |
|
|
65
|
+
|
|
66
|
+
## Alternatives Considered
|
|
67
|
+
|
|
68
|
+
### Option 1: Continue with MySQL (upgraded)
|
|
69
|
+
- **Pros**: No migration, team expertise
|
|
70
|
+
- **Cons**: Limited JSON support, no native full-text, more ops
|
|
71
|
+
- **Why not**: Doesn't meet requirements for JSON and search
|
|
72
|
+
|
|
73
|
+
### Option 2: Amazon Aurora MySQL
|
|
74
|
+
- **Pros**: MySQL compatible, managed, better performance
|
|
75
|
+
- **Cons**: More expensive, still MySQL limitations
|
|
76
|
+
- **Why not**: JSON and full-text still limited
|
|
77
|
+
|
|
78
|
+
### Option 3: MongoDB + PostgreSQL
|
|
79
|
+
- **Pros**: Best of both worlds
|
|
80
|
+
- **Cons**: Operational complexity, data sync issues
|
|
81
|
+
- **Why not**: Over-engineering for current needs
|
|
82
|
+
|
|
83
|
+
## Related Decisions
|
|
84
|
+
- ADR-002: Database Migration Strategy
|
|
85
|
+
- ADR-005: Backup and Disaster Recovery
|
|
86
|
+
|
|
87
|
+
## References
|
|
88
|
+
- [PostgreSQL vs MySQL comparison](link)
|
|
89
|
+
- [Migration plan document](link)
|
|
90
|
+
- [Cost analysis spreadsheet](link)
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Example 2: API Style
|
|
95
|
+
|
|
96
|
+
# ADR-005: Use GraphQL for Public API
|
|
97
|
+
|
|
98
|
+
## Status
|
|
99
|
+
Accepted
|
|
100
|
+
|
|
101
|
+
## Context
|
|
102
|
+
Our mobile application makes 15+ API calls to render the home screen.
|
|
103
|
+
This results in:
|
|
104
|
+
- Slow load times (3+ seconds)
|
|
105
|
+
- High bandwidth usage
|
|
106
|
+
- Poor user experience
|
|
107
|
+
- N+1 query problems
|
|
108
|
+
|
|
109
|
+
Current REST API:
|
|
110
|
+
- `/api/users/{id}`
|
|
111
|
+
- `/api/users/{id}/orders`
|
|
112
|
+
- `/api/orders/{id}/items`
|
|
113
|
+
- `/api/products/{id}`
|
|
114
|
+
- etc.
|
|
115
|
+
|
|
116
|
+
Mobile team reports frustration with over/under-fetching.
|
|
117
|
+
|
|
118
|
+
## Decision
|
|
119
|
+
We will implement GraphQL for our public-facing APIs.
|
|
120
|
+
|
|
121
|
+
Implementation:
|
|
122
|
+
- Apollo Server on Node.js
|
|
123
|
+
- Schema-first design
|
|
124
|
+
- DataLoader for N+1 prevention
|
|
125
|
+
- Persisted queries for production
|
|
126
|
+
- Keep REST for internal services
|
|
127
|
+
|
|
128
|
+
## Consequences
|
|
129
|
+
|
|
130
|
+
### Positive
|
|
131
|
+
- Single request for complex data
|
|
132
|
+
- Clients fetch exactly what they need
|
|
133
|
+
- Self-documenting API
|
|
134
|
+
- Strong typing with schema
|
|
135
|
+
- Better mobile performance
|
|
136
|
+
|
|
137
|
+
### Negative
|
|
138
|
+
- Learning curve for team
|
|
139
|
+
- New caching strategy needed
|
|
140
|
+
- Query complexity analysis required
|
|
141
|
+
- Different error handling
|
|
142
|
+
- File uploads more complex
|
|
143
|
+
|
|
144
|
+
## Alternatives Considered
|
|
145
|
+
|
|
146
|
+
### Option 1: REST with include parameters
|
|
147
|
+
```
|
|
148
|
+
GET /api/users/1?include=orders.items.product
|
|
149
|
+
```
|
|
150
|
+
- **Why not**: Non-standard, limited flexibility
|
|
151
|
+
|
|
152
|
+
### Option 2: Custom endpoints per screen
|
|
153
|
+
- **Why not**: Maintenance burden, tight coupling
|
|
154
|
+
|
|
155
|
+
### Option 3: gRPC
|
|
156
|
+
- **Why not**: Not browser-friendly, overkill for JSON
|
|
157
|
+
|
|
158
|
+
## Related Decisions
|
|
159
|
+
- ADR-006: GraphQL Security Guidelines
|
|
160
|
+
- ADR-007: API Rate Limiting Strategy
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Example 3: Microservices Decision
|
|
165
|
+
|
|
166
|
+
# ADR-010: Split Order Service from Monolith
|
|
167
|
+
|
|
168
|
+
## Status
|
|
169
|
+
Accepted
|
|
170
|
+
|
|
171
|
+
## Context
|
|
172
|
+
The Order module in our monolith has:
|
|
173
|
+
- Different scaling requirements (high traffic during sales)
|
|
174
|
+
- Different reliability requirements (critical path)
|
|
175
|
+
- Dedicated team of 6 developers
|
|
176
|
+
- Clear bounded context (DDD)
|
|
177
|
+
|
|
178
|
+
Current pain points:
|
|
179
|
+
- Full application deployment for order changes
|
|
180
|
+
- Order bugs affect entire system
|
|
181
|
+
- Team blocked by other teams' changes
|
|
182
|
+
|
|
183
|
+
## Decision
|
|
184
|
+
Extract Order Service as a separate microservice.
|
|
185
|
+
|
|
186
|
+
Boundaries:
|
|
187
|
+
- Order creation and management
|
|
188
|
+
- Payment processing
|
|
189
|
+
- Order status tracking
|
|
190
|
+
|
|
191
|
+
NOT included:
|
|
192
|
+
- Inventory (stays in monolith for now)
|
|
193
|
+
- User management (stays in monolith)
|
|
194
|
+
- Product catalog (stays in monolith)
|
|
195
|
+
|
|
196
|
+
## Consequences
|
|
197
|
+
|
|
198
|
+
### Positive
|
|
199
|
+
- Independent deployment and scaling
|
|
200
|
+
- Team autonomy
|
|
201
|
+
- Technology choice freedom
|
|
202
|
+
- Fault isolation
|
|
203
|
+
- Clearer ownership
|
|
204
|
+
|
|
205
|
+
### Negative
|
|
206
|
+
- Distributed system complexity
|
|
207
|
+
- Need for API versioning
|
|
208
|
+
- Monitoring complexity increases
|
|
209
|
+
- Data consistency across boundaries
|
|
210
|
+
|
|
211
|
+
## Implementation Timeline
|
|
212
|
+
1. Week 1-2: Define API contract
|
|
213
|
+
2. Week 3-4: Implement service
|
|
214
|
+
3. Week 5-6: Strangler migration
|
|
215
|
+
4. Week 7: Cut over and monitor
|
|
216
|
+
|
|
217
|
+
## Related Decisions
|
|
218
|
+
- ADR-011: Service Communication Pattern
|
|
219
|
+
- ADR-012: Order Service Database Design
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Example 4: Deprecating a Decision
|
|
224
|
+
|
|
225
|
+
# ADR-003: Use Redis for Session Storage
|
|
226
|
+
|
|
227
|
+
## Status
|
|
228
|
+
**Deprecated** - See ADR-015
|
|
229
|
+
|
|
230
|
+
## Context
|
|
231
|
+
[Historical context preserved]
|
|
232
|
+
|
|
233
|
+
## Decision
|
|
234
|
+
We used Redis for session storage.
|
|
235
|
+
|
|
236
|
+
## Consequences
|
|
237
|
+
[Historical consequences preserved]
|
|
238
|
+
|
|
239
|
+
## Deprecation Note
|
|
240
|
+
**Date**: 2024-06-15
|
|
241
|
+
**Reason**: Moving to JWT-based stateless authentication
|
|
242
|
+
**Migration**: See ADR-015 for migration plan
|
|
243
|
+
**Timeline**: Full migration by 2024-08-01
|
|
244
|
+
|
|
245
|
+
## Related Decisions
|
|
246
|
+
- **Superseded by**: ADR-015: JWT Authentication
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# ADR Template
|
|
2
|
+
|
|
3
|
+
This is the standard template for Architecture Decision Records.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# ADR-XXX: [Title]
|
|
8
|
+
|
|
9
|
+
## Meta
|
|
10
|
+
- **Status**: [Proposed | Accepted | Deprecated | Superseded]
|
|
11
|
+
- **Date**: YYYY-MM-DD
|
|
12
|
+
- **Decision Makers**: @username1, @username2
|
|
13
|
+
- **Consulted**: @username3, @username4
|
|
14
|
+
- **Informed**: @team-name
|
|
15
|
+
|
|
16
|
+
## Status
|
|
17
|
+
[Proposed | Accepted | Deprecated | Superseded by ADR-YYY]
|
|
18
|
+
|
|
19
|
+
If Superseded, link to the new ADR.
|
|
20
|
+
|
|
21
|
+
## Context
|
|
22
|
+
|
|
23
|
+
### Problem Statement
|
|
24
|
+
[What is the issue that we're seeing? What problem needs to be solved?]
|
|
25
|
+
|
|
26
|
+
### Business Context
|
|
27
|
+
[Why is this important? What business need drives this?]
|
|
28
|
+
|
|
29
|
+
### Technical Context
|
|
30
|
+
[What is the current technical situation?]
|
|
31
|
+
[What constraints exist?]
|
|
32
|
+
|
|
33
|
+
### Requirements
|
|
34
|
+
- Requirement 1
|
|
35
|
+
- Requirement 2
|
|
36
|
+
- Requirement 3
|
|
37
|
+
|
|
38
|
+
### Constraints
|
|
39
|
+
- Constraint 1 (e.g., budget, timeline, team expertise)
|
|
40
|
+
- Constraint 2
|
|
41
|
+
- Constraint 3
|
|
42
|
+
|
|
43
|
+
## Decision
|
|
44
|
+
|
|
45
|
+
### Summary
|
|
46
|
+
[One sentence summary of the decision]
|
|
47
|
+
|
|
48
|
+
### Details
|
|
49
|
+
[Detailed description of the decision. Be specific and concrete.]
|
|
50
|
+
|
|
51
|
+
### Implementation
|
|
52
|
+
[How will this be implemented? What are the steps?]
|
|
53
|
+
|
|
54
|
+
### Timeline
|
|
55
|
+
[When will this be implemented?]
|
|
56
|
+
|
|
57
|
+
## Consequences
|
|
58
|
+
|
|
59
|
+
### Positive
|
|
60
|
+
1. [Benefit 1]
|
|
61
|
+
2. [Benefit 2]
|
|
62
|
+
3. [Benefit 3]
|
|
63
|
+
|
|
64
|
+
### Negative
|
|
65
|
+
1. [Drawback 1]
|
|
66
|
+
2. [Drawback 2]
|
|
67
|
+
3. [Drawback 3]
|
|
68
|
+
|
|
69
|
+
### Neutral
|
|
70
|
+
1. [Side effect 1 - neither good nor bad]
|
|
71
|
+
2. [Side effect 2]
|
|
72
|
+
|
|
73
|
+
### Risks and Mitigations
|
|
74
|
+
| Risk | Likelihood | Impact | Mitigation |
|
|
75
|
+
|------|------------|--------|------------|
|
|
76
|
+
| Risk 1 | High/Medium/Low | High/Medium/Low | How to mitigate |
|
|
77
|
+
| Risk 2 | ... | ... | ... |
|
|
78
|
+
|
|
79
|
+
## Alternatives Considered
|
|
80
|
+
|
|
81
|
+
### Option 1: [Name]
|
|
82
|
+
**Description**: [Brief description]
|
|
83
|
+
|
|
84
|
+
**Pros**:
|
|
85
|
+
- Pro 1
|
|
86
|
+
- Pro 2
|
|
87
|
+
|
|
88
|
+
**Cons**:
|
|
89
|
+
- Con 1
|
|
90
|
+
- Con 2
|
|
91
|
+
|
|
92
|
+
**Why not chosen**: [Reason]
|
|
93
|
+
|
|
94
|
+
### Option 2: [Name]
|
|
95
|
+
**Description**: [Brief description]
|
|
96
|
+
|
|
97
|
+
**Pros**:
|
|
98
|
+
- Pro 1
|
|
99
|
+
- Pro 2
|
|
100
|
+
|
|
101
|
+
**Cons**:
|
|
102
|
+
- Con 1
|
|
103
|
+
- Con 2
|
|
104
|
+
|
|
105
|
+
**Why not chosen**: [Reason]
|
|
106
|
+
|
|
107
|
+
### Option 3: [Name]
|
|
108
|
+
[Same structure]
|
|
109
|
+
|
|
110
|
+
## Decision Criteria
|
|
111
|
+
| Criteria | Weight | Option 1 | Option 2 | Option 3 |
|
|
112
|
+
|----------|--------|----------|----------|----------|
|
|
113
|
+
| [Criterion 1] | 25% | 5/5 | 3/5 | 4/5 |
|
|
114
|
+
| [Criterion 2] | 25% | 4/5 | 5/5 | 3/5 |
|
|
115
|
+
| [Criterion 3] | 25% | 3/5 | 4/5 | 5/5 |
|
|
116
|
+
| [Criterion 4] | 25% | 4/5 | 3/5 | 4/5 |
|
|
117
|
+
| **Total** | 100% | **4.0** | **3.75** | **4.0** |
|
|
118
|
+
|
|
119
|
+
## Related Decisions
|
|
120
|
+
- ADR-XXX: [Title] - [Relationship description]
|
|
121
|
+
- ADR-YYY: [Title] - [Relationship description]
|
|
122
|
+
|
|
123
|
+
## References
|
|
124
|
+
- [Link to relevant documentation]
|
|
125
|
+
- [Link to RFC or proposal]
|
|
126
|
+
- [Link to meeting notes]
|
|
127
|
+
- [Link to external articles]
|
|
128
|
+
|
|
129
|
+
## Notes
|
|
130
|
+
[Any additional notes or context]
|
|
131
|
+
|
|
132
|
+
## Review History
|
|
133
|
+
| Date | Reviewer | Action | Notes |
|
|
134
|
+
|------|----------|--------|-------|
|
|
135
|
+
| YYYY-MM-DD | @username | Reviewed | [Feedback] |
|
|
136
|
+
| YYYY-MM-DD | @username | Approved | [Comments] |
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Quick Template (Minimal)
|
|
141
|
+
|
|
142
|
+
```markdown
|
|
143
|
+
# ADR-XXX: [Title]
|
|
144
|
+
|
|
145
|
+
## Status
|
|
146
|
+
[Proposed | Accepted | Deprecated | Superseded by ADR-YYY]
|
|
147
|
+
|
|
148
|
+
## Context
|
|
149
|
+
[Why are we making this decision?]
|
|
150
|
+
|
|
151
|
+
## Decision
|
|
152
|
+
[What is the change?]
|
|
153
|
+
|
|
154
|
+
## Consequences
|
|
155
|
+
- [What becomes easier/harder?]
|
|
156
|
+
|
|
157
|
+
## Alternatives Considered
|
|
158
|
+
- Option A: [Why not chosen]
|
|
159
|
+
- Option B: [Why not chosen]
|
|
160
|
+
```
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture-patterns
|
|
3
|
+
description: |
|
|
4
|
+
Use when choosing or implementing architecture patterns like microservices,
|
|
5
|
+
monolith, event-driven, or serverless. Covers patterns, trade-offs,
|
|
6
|
+
and when to use each approach.
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
category: architecture
|
|
9
|
+
tags:
|
|
10
|
+
- microservices
|
|
11
|
+
- monolith
|
|
12
|
+
- event-driven
|
|
13
|
+
- serverless
|
|
14
|
+
- patterns
|
|
15
|
+
dependencies:
|
|
16
|
+
- system-design
|
|
17
|
+
references:
|
|
18
|
+
- references/microservices.md
|
|
19
|
+
- references/monolith.md
|
|
20
|
+
- references/event-driven.md
|
|
21
|
+
- references/serverless.md
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# Architecture Patterns
|
|
25
|
+
|
|
26
|
+
## Core Principle
|
|
27
|
+
**Choose the architecture that fits your problem, team, and scale - not what's trendy.**
|
|
28
|
+
|
|
29
|
+
## When to Use This Skill
|
|
30
|
+
|
|
31
|
+
### Trigger Conditions
|
|
32
|
+
- Starting a new project
|
|
33
|
+
- Evaluating current architecture
|
|
34
|
+
- Planning a migration
|
|
35
|
+
- Scaling challenges
|
|
36
|
+
- Team structure changes
|
|
37
|
+
|
|
38
|
+
### Keywords
|
|
39
|
+
- "microservices"
|
|
40
|
+
- "monolith"
|
|
41
|
+
- "serverless"
|
|
42
|
+
- "event-driven"
|
|
43
|
+
- "architecture pattern"
|
|
44
|
+
- "service decomposition"
|
|
45
|
+
|
|
46
|
+
## Pattern Comparison
|
|
47
|
+
|
|
48
|
+
| Pattern | Complexity | Scale | Team Size | Best For |
|
|
49
|
+
|---------|------------|-------|-----------|----------|
|
|
50
|
+
| **Monolith** | Low | Medium | Small-Medium | Early stage, simple domains |
|
|
51
|
+
| **Microservices** | High | High | Large | Complex domains, independent scaling |
|
|
52
|
+
| **Event-Driven** | Medium-High | High | Medium-Large | Async workflows, real-time |
|
|
53
|
+
| **Serverless** | Medium | Auto | Any | Variable load, quick prototypes |
|
|
54
|
+
| **Modular Monolith** | Medium | Medium | Medium | Growing products, bounded contexts |
|
|
55
|
+
|
|
56
|
+
## Architecture Styles Overview
|
|
57
|
+
|
|
58
|
+
### 1. Monolithic Architecture
|
|
59
|
+
```
|
|
60
|
+
┌─────────────────────────────────────────┐
|
|
61
|
+
│ Monolith Application │
|
|
62
|
+
├─────────────────────────────────────────┤
|
|
63
|
+
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
|
|
64
|
+
│ │ Users │ │ Orders │ │Products │ │
|
|
65
|
+
│ │ Module │ │ Module │ │ Module │ │
|
|
66
|
+
│ └─────────┘ └─────────┘ └─────────┘ │
|
|
67
|
+
│ ┌─────────────────────────────────┐ │
|
|
68
|
+
│ │ Shared Database │ │
|
|
69
|
+
│ └─────────────────────────────────┘ │
|
|
70
|
+
└─────────────────────────────────────────┘
|
|
71
|
+
|
|
72
|
+
Pros:
|
|
73
|
+
- Simple to develop and deploy
|
|
74
|
+
- Easy to debug and test
|
|
75
|
+
- Low operational overhead
|
|
76
|
+
- Strong consistency
|
|
77
|
+
|
|
78
|
+
Cons:
|
|
79
|
+
- Can become complex over time
|
|
80
|
+
- Scaling requires full deployment
|
|
81
|
+
- Technology lock-in
|
|
82
|
+
- Single point of failure
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 2. Microservices Architecture
|
|
86
|
+
```
|
|
87
|
+
┌───────────┐ ┌───────────┐ ┌───────────┐
|
|
88
|
+
│ User │ │ Order │ │ Product │
|
|
89
|
+
│ Service │ │ Service │ │ Service │
|
|
90
|
+
└─────┬─────┘ └─────┬─────┘ └─────┬─────┘
|
|
91
|
+
│ │ │
|
|
92
|
+
▼ ▼ ▼
|
|
93
|
+
┌─────────┐ ┌─────────┐ ┌─────────┐
|
|
94
|
+
│ User DB │ │Order DB │ │ Prod DB │
|
|
95
|
+
└─────────┘ └─────────┘ └─────────┘
|
|
96
|
+
|
|
97
|
+
Pros:
|
|
98
|
+
- Independent deployment and scaling
|
|
99
|
+
- Technology flexibility
|
|
100
|
+
- Team autonomy
|
|
101
|
+
- Fault isolation
|
|
102
|
+
|
|
103
|
+
Cons:
|
|
104
|
+
- Distributed system complexity
|
|
105
|
+
- Operational overhead
|
|
106
|
+
- Data consistency challenges
|
|
107
|
+
- Network latency
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 3. Event-Driven Architecture
|
|
111
|
+
```
|
|
112
|
+
┌─────────────┐
|
|
113
|
+
│ Event │
|
|
114
|
+
│ Broker │
|
|
115
|
+
└──────┬──────┘
|
|
116
|
+
│
|
|
117
|
+
┌──────────────────┼──────────────────┐
|
|
118
|
+
│ │ │
|
|
119
|
+
▼ ▼ ▼
|
|
120
|
+
┌───────────┐ ┌───────────┐ ┌───────────┐
|
|
121
|
+
│ Service │ │ Service │ │ Service │
|
|
122
|
+
│ A │ │ B │ │ C │
|
|
123
|
+
└─────┬─────┘ └─────┬─────┘ └─────┬─────┘
|
|
124
|
+
│ │ │
|
|
125
|
+
└──────────────────┴──────────────────┘
|
|
126
|
+
produces events
|
|
127
|
+
|
|
128
|
+
Pros:
|
|
129
|
+
- Loose coupling
|
|
130
|
+
- Async processing
|
|
131
|
+
- Easy to add consumers
|
|
132
|
+
- Scalable
|
|
133
|
+
|
|
134
|
+
Cons:
|
|
135
|
+
- Eventual consistency
|
|
136
|
+
- Debugging complexity
|
|
137
|
+
- Event schema evolution
|
|
138
|
+
- Message ordering
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### 4. Serverless Architecture
|
|
142
|
+
```
|
|
143
|
+
┌─────────┐ ┌─────────────┐ ┌─────────────┐
|
|
144
|
+
│ API │────▶│ Lambda/ │────▶│ Managed │
|
|
145
|
+
│ Gateway │ │ Function │ │ Services │
|
|
146
|
+
└─────────┘ └─────────────┘ └─────────────┘
|
|
147
|
+
│
|
|
148
|
+
▼
|
|
149
|
+
┌─────────────┐
|
|
150
|
+
│ DynamoDB/ │
|
|
151
|
+
│ S3/SQS │
|
|
152
|
+
└─────────────┘
|
|
153
|
+
|
|
154
|
+
Pros:
|
|
155
|
+
- No server management
|
|
156
|
+
- Auto-scaling
|
|
157
|
+
- Pay per use
|
|
158
|
+
- Fast time to market
|
|
159
|
+
|
|
160
|
+
Cons:
|
|
161
|
+
- Vendor lock-in
|
|
162
|
+
- Cold starts
|
|
163
|
+
- Debugging challenges
|
|
164
|
+
- Limited execution time
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Decision Framework
|
|
168
|
+
|
|
169
|
+
### When to Choose Monolith
|
|
170
|
+
```
|
|
171
|
+
✅ Early-stage startup
|
|
172
|
+
✅ Small team (< 10 developers)
|
|
173
|
+
✅ Simple domain
|
|
174
|
+
✅ Quick time to market needed
|
|
175
|
+
✅ Limited operational expertise
|
|
176
|
+
✅ Tight budget
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### When to Choose Microservices
|
|
180
|
+
```
|
|
181
|
+
✅ Large team (> 20 developers)
|
|
182
|
+
✅ Complex domain with bounded contexts
|
|
183
|
+
✅ Need independent scaling
|
|
184
|
+
✅ Different technology requirements
|
|
185
|
+
✅ Need fault isolation
|
|
186
|
+
✅ Multiple deployment cadences needed
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### When to Choose Event-Driven
|
|
190
|
+
```
|
|
191
|
+
✅ Async workflows
|
|
192
|
+
✅ Real-time processing needs
|
|
193
|
+
✅ High throughput
|
|
194
|
+
✅ Loose coupling required
|
|
195
|
+
✅ Event sourcing requirements
|
|
196
|
+
✅ CQRS pattern needed
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### When to Choose Serverless
|
|
200
|
+
```
|
|
201
|
+
✅ Unpredictable/variable traffic
|
|
202
|
+
✅ Event-based triggers
|
|
203
|
+
✅ Quick prototyping
|
|
204
|
+
✅ Small, stateless functions
|
|
205
|
+
✅ Limited ops team
|
|
206
|
+
✅ Cost optimization for low traffic
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Migration Paths
|
|
210
|
+
|
|
211
|
+
### Monolith to Microservices
|
|
212
|
+
```
|
|
213
|
+
Phase 1: Modularize
|
|
214
|
+
- Identify bounded contexts
|
|
215
|
+
- Create clear module boundaries
|
|
216
|
+
- Establish interfaces between modules
|
|
217
|
+
|
|
218
|
+
Phase 2: Extract
|
|
219
|
+
- Start with least coupled service
|
|
220
|
+
- Strangler fig pattern
|
|
221
|
+
- One service at a time
|
|
222
|
+
|
|
223
|
+
Phase 3: Independent
|
|
224
|
+
- Separate databases
|
|
225
|
+
- Independent deployment
|
|
226
|
+
- Own infrastructure
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Strangler Fig Pattern
|
|
230
|
+
```
|
|
231
|
+
Original: After:
|
|
232
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
233
|
+
│ Monolith │ │ Monolith │
|
|
234
|
+
│ │ │ (remaining) │
|
|
235
|
+
└────────┬────────┘ └────────┬────────┘
|
|
236
|
+
│ │
|
|
237
|
+
│ │
|
|
238
|
+
│ ┌────────────┼────────────┐
|
|
239
|
+
│ │ │ │
|
|
240
|
+
▼ ▼ ▼ ▼
|
|
241
|
+
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
|
|
242
|
+
│ Service │ │ Service │ │ Service │ │ Service │
|
|
243
|
+
│ A │ │ B │ │ C │ │ D │
|
|
244
|
+
└─────────┘ └─────────┘ └─────────┘ └─────────┘
|
|
245
|
+
|
|
246
|
+
Route new features to new services.
|
|
247
|
+
Gradually migrate existing functionality.
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Common Patterns by Domain
|
|
251
|
+
|
|
252
|
+
### E-commerce
|
|
253
|
+
```
|
|
254
|
+
Services:
|
|
255
|
+
- Product Catalog
|
|
256
|
+
- Shopping Cart
|
|
257
|
+
- Order Management
|
|
258
|
+
- Payment Processing
|
|
259
|
+
- Inventory
|
|
260
|
+
- User Management
|
|
261
|
+
- Search
|
|
262
|
+
- Recommendations
|
|
263
|
+
|
|
264
|
+
Events:
|
|
265
|
+
- ProductViewed
|
|
266
|
+
- CartUpdated
|
|
267
|
+
- OrderPlaced
|
|
268
|
+
- PaymentProcessed
|
|
269
|
+
- InventoryUpdated
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Social Media
|
|
273
|
+
```
|
|
274
|
+
Services:
|
|
275
|
+
- User Service
|
|
276
|
+
- Post Service
|
|
277
|
+
- Feed Service
|
|
278
|
+
- Notification Service
|
|
279
|
+
- Media Service
|
|
280
|
+
- Search Service
|
|
281
|
+
|
|
282
|
+
Events:
|
|
283
|
+
- UserFollowed
|
|
284
|
+
- PostCreated
|
|
285
|
+
- PostLiked
|
|
286
|
+
- CommentAdded
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## Rules
|
|
290
|
+
|
|
291
|
+
### DO
|
|
292
|
+
- ✅ Start with monolith unless you have clear reasons
|
|
293
|
+
- ✅ Design for decomposition from the start
|
|
294
|
+
- ✅ Use bounded contexts to define service boundaries
|
|
295
|
+
- ✅ Keep services loosely coupled
|
|
296
|
+
- ✅ Have strong monitoring and observability
|
|
297
|
+
|
|
298
|
+
### DON'T
|
|
299
|
+
- ❌ Start with microservices for a new product
|
|
300
|
+
- ❌ Create distributed monolith (services tightly coupled)
|
|
301
|
+
- ❌ Share databases between services
|
|
302
|
+
- ❌ Make synchronous calls everywhere
|
|
303
|
+
- ❌ Ignore operational complexity
|
|
304
|
+
|
|
305
|
+
## Output
|
|
306
|
+
|
|
307
|
+
When using this skill, produce:
|
|
308
|
+
1. **Architecture Decision Record** - Why this pattern was chosen
|
|
309
|
+
2. **Service Map** - If microservices, define boundaries
|
|
310
|
+
3. **Communication Patterns** - How services interact
|
|
311
|
+
4. **Migration Plan** - If changing architecture
|
|
312
|
+
|
|
313
|
+
## Related Skills
|
|
314
|
+
- `system-design` - Core distributed systems concepts
|
|
315
|
+
- `adr-writing` - Document architecture decisions
|
|
316
|
+
- `api-design` - Service interfaces
|