designing-architecture
32
总安装量
32
周安装量
#6391
全站排名
安装命令
npx skills add https://github.com/cloudai-x/claude-workflow-v2 --skill designing-architecture
Agent 安装分布
claude-code
23
opencode
17
codex
17
antigravity
15
cursor
14
Skill 文档
Designing Architecture
Architecture Decision Workflow
Copy this checklist and track progress:
Architecture Design Progress:
- [ ] Step 1: Understand requirements and constraints
- [ ] Step 2: Assess project size and team capabilities
- [ ] Step 3: Select architecture pattern
- [ ] Step 4: Define directory structure
- [ ] Step 5: Document trade-offs and decision
- [ ] Step 6: Validate against decision framework
Pattern Selection Guide
By Project Size
| Size | Recommended Pattern |
|---|---|
| Small (<10K LOC) | Simple MVC/Layered |
| Medium (10K-100K) | Clean Architecture |
| Large (>100K) | Modular Monolith or Microservices |
By Team Size
| Team | Recommended |
|---|---|
| 1-3 devs | Monolith with clear modules |
| 4-10 devs | Modular Monolith |
| 10+ devs | Microservices (if justified) |
Common Patterns
1. Layered Architecture
âââââââââââââââââââââââââââââââ
â Presentation â â UI, API Controllers
âââââââââââââââââââââââââââââââ¤
â Application â â Use Cases, Services
âââââââââââââââââââââââââââââââ¤
â Domain â â Business Logic, Entities
âââââââââââââââââââââââââââââââ¤
â Infrastructure â â Database, External APIs
âââââââââââââââââââââââââââââââ
Use when: Simple CRUD apps, small teams, quick prototypes
2. Clean Architecture
âââââââââââââââââââââââââââââââââââââââ
â Frameworks & Drivers â
â âââââââââââââââââââââââââââââââ â
â â Interface Adapters â â
â â âââââââââââââââââââââââ â â
â â â Application â â â
â â â âââââââââââââââ â â â
â â â â Domain â â â â
â â â âââââââââââââââ â â â
â â âââââââââââââââââââââââ â â
â âââââââââââââââââââââââââââââââ â
âââââââââââââââââââââââââââââââââââââââ
Use when: Complex business logic, long-lived projects, testability is key
3. Hexagonal (Ports & Adapters)
ââââââââââââ
â HTTP API â
ââââââ¬ââââââ
â Port
ââââââââââ¼âââââââââ
â â
â Application â
â Core â
â â
ââââââââââ¬âââââââââ
â Port
ââââââ¼ââââââ
â Database â
ââââââââââââ
Use when: Need to swap external dependencies, multiple entry points
4. Event-Driven Architecture
Producer â Event Bus â Consumer
â
âââ Consumer
â
âââ Consumer
Use when: Loose coupling needed, async processing, scalability
5. CQRS (Command Query Responsibility Segregation)
âââââââââââââââ âââââââââââââââ
â Commands â â Queries â
â (Write) â â (Read) â
ââââââââ¬âââââââ ââââââââ¬âââââââ
â â
â¼ â¼
Write Model Read Model
â â
ââââââââââ¬ââââââââââââ
â¼
Event Store
Use when: Different read/write scaling, complex domains, event sourcing
Directory Structure Patterns
Feature-Based (Recommended for medium+)
src/
âââ features/
â âââ users/
â â âââ api/
â â âââ components/
â â âââ hooks/
â â âââ services/
â â âââ types/
â âââ orders/
â âââ api/
â âââ components/
â âââ ...
âââ shared/
â âââ components/
â âââ hooks/
â âââ utils/
âââ app/
âââ ...
Layer-Based (Simple apps)
src/
âââ controllers/
âââ services/
âââ models/
âââ repositories/
âââ utils/
Decision Framework
When making architectural decisions, evaluate against these criteria:
- Simplicity – Start simple, evolve when needed
- Team Skills – Match architecture to team capabilities
- Requirements – Let business needs drive decisions
- Scalability – Consider growth trajectory
- Maintainability – Optimize for change
Trade-off Analysis Template
Use this template to document architectural decisions:
## Decision: [What we're deciding]
### Context
[Why this decision is needed now]
### Options Considered
1. Option A: [Description]
2. Option B: [Description]
### Trade-offs
| Criteria | Option A | Option B |
|----------|----------|----------|
| Complexity | Low | High |
| Scalability | Medium | High |
| Team familiarity | High | Low |
### Decision
We chose [Option] because [reasoning].
### Consequences
- [What this enables]
- [What this constrains]
Validation Checklist
After selecting an architecture, validate against:
Architecture Validation:
- [ ] Matches project size and complexity
- [ ] Aligns with team skills and experience
- [ ] Supports current requirements
- [ ] Allows for anticipated growth
- [ ] Dependencies flow inward (core has no external deps)
- [ ] Clear boundaries between modules/layers
- [ ] Testing strategy is feasible
- [ ] Trade-offs are documented
If validation fails, reconsider the pattern selection or adjust the implementation approach.