Unnamed Skill
Architectural reasoning framework: requirements analysis, trade-off evaluation, and ADR-based decision documentation. NOT a pattern catalog, but a thinking framework. Use when designing system architecture, choosing patterns, or making structural decisions.
$ Installer
git clone https://github.com/xenitV1/claude-code-maestro /tmp/claude-code-maestro && cp -r /tmp/claude-code-maestro/skills/architecture ~/.claude/skills/claude-code-maestro// tip: Run this command in your terminal to install the skill
name: architecture description: Architectural reasoning framework: requirements analysis, trade-off evaluation, and ADR-based decision documentation. NOT a pattern catalog, but a thinking framework. Use when designing system architecture, choosing patterns, or making structural decisions.
Architecture Decision Framework
Core Philosophy
"Requirements drive architecture. Trade-offs inform decisions. ADRs capture rationale."
Architecture is NOT about applying patterns. It's about solving problems within constraints.
Phase 1: Context Discovery
Question Hierarchy (Ask User FIRST)
Before suggesting any architecture, gather context:
-
Scale
- How many users? (10, 1K, 100K, 1M+)
- Data volume? (MB, GB, TB)
- Transaction rate? (per second/minute)
-
Team
- Solo developer or team?
- Team size and expertise?
- Distributed or co-located?
-
Timeline
- MVP/Prototype or long-term product?
- Time to market pressure?
-
Domain
- CRUD-heavy or business logic complex?
- Real-time requirements?
- Compliance/regulations?
-
Constraints
- Budget limitations?
- Legacy systems to integrate?
- Technology stack preferences?
Project Classification Matrix
MVP SaaS Enterprise
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Scale โ <1K โ 1K-100K โ 100K+ โ
โ Team โ Solo โ 2-10 โ 10+ โ
โ Timeline โ Fast (weeks) โ Medium (months)โ Long (years)โ
โ Architecture โ Simple โ Modular โ Distributed โ
โ Patterns โ Minimal โ Selective โ Comprehensiveโ
โ Example โ Next.js API โ NestJS โ Microservicesโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Phase 2: Trade-off Analysis
Decision Framework
For EACH architectural component, document:
## Architecture Decision Record
### Context
- **Problem**: [What problem are we solving?]
- **Constraints**: [Team size, scale, timeline, budget]
### Options Considered
| Option | Pros | Cons | Complexity | When Valid |
|--------|------|------|------------|-----------|
| Option A | Benefit 1 | Cost 1 | Low | [Conditions] |
| Option B | Benefit 2 | Cost 2 | High | [Conditions] |
| Option C | Benefit 3 | Cost 3 | Medium | [Conditions] |
### Decision
**Chosen**: [Option B]
### Rationale
1. [Reason 1 - tied to constraints]
2. [Reason 2 - tied to requirements]
3. [Reason 3 - trade-off accepted]
### Trade-offs Accepted
- [What we're giving up]
- [Why this is acceptable given constraints]
### Consequences
- **Positive**: [Benefits we gain]
- **Negative**: [Costs/risks we accept]
- **Mitigation**: [How we'll address negatives]
### Revisit Trigger
- [When to reconsider this decision]
Phase 3: Pattern Selection Guidelines
NOT a Checklist - But Decision Trees
START: What's your MAIN concern?
โโ Data Access Complexity?
โ โโ HIGH (complex queries, testing needed, multiple data sources)
โ โ โ Repository Pattern + Unit of Work
โ โ VALIDATE: Will data source change frequently?
โ โ โโ YES โ Repository worth the indirection
โ โ โโ NO โ Consider simpler ORM direct access
โ โโ LOW (simple CRUD, single database)
โ โ ORM directly (TypeORM, Prisma, Sequelize, etc.)
โ Simpler = Better, Faster
โ
โโ Business Rules Complexity?
โ โโ HIGH (domain logic, rules vary by context)
โ โ โ Domain-Driven Design
โ โ VALIDATE: Do you have domain experts on team?
โ โ โโ YES โ Full DDD (Aggregates, Value Objects, Domain Events)
โ โ โโ NO โ Partial DDD (rich entities, clear boundaries)
โ โโ LOW (mostly CRUD, simple validation)
โ โ Transaction Script pattern
โ Simpler = Better, Faster
โ
โโ Independent Scaling Needed?
โ โโ YES (different components scale differently)
โ โ โ Microservices WORTH the complexity
โ โ REQUIREMENTS (ALL must be true):
โ โ - Clear domain boundaries (bounded contexts)
โ โ - Team > 10 developers (otherwise overhead too high)
โ โ - Different scaling/timeline needs per service
โ โ IF NOT ALL MET โ Modular Monolith instead
โ โโ NO (everything scales together)
โ โ Modular Monolith
โ Can extract services later when proven needed
โ
โโ Real-time Requirements?
โโ HIGH (immediate updates, multi-user sync)
โ โ Event-Driven Architecture
โ โ Message Queue (RabbitMQ, Redis, Kafka)
โ VALIDATE: Can you handle eventual consistency?
โ โโ YES โ Event-driven valid
โ โโ NO โ Consider synchronous with polling
โโ LOW (eventual consistency acceptable)
โ Synchronous (REST/GraphQL)
Simpler = Better, Faster
Phase 4: Validation - The Simplicity Test
The 3 Questions
Before applying ANY pattern, ask:
- Problem Solved: What SPECIFIC problem does this pattern solve?
- Simpler Alternative: Is there a simpler solution?
- Deferred Complexity: Can we add this LATER when needed?
Red Flags (Anti-patterns to Avoid)
| Pattern | Anti-pattern | Why Bad | Simpler Alternative |
|---|---|---|---|
| Microservices | Premature splitting | Adds complexity before proving value | Start monolith, extract when needed |
| Clean/Hexagonal | Over-abstraction | Hard to understand, debug, onboard | Concrete first, extract interfaces later |
| Event Sourcing | Over-engineering | Complex debugging, temporal coupling | Append-only audit log |
| CQRS | Unnecessary complexity | Two models to maintain, sync issues | Single model until read/write diverge significantly |
| Repository | YAGNI for simple CRUD | Extra layer without benefit | ORM direct access |
Simplicity Principle
"Simplicity is the ultimate sophistication."
- Start simple
- Add complexity ONLY when proven necessary
- You can always add patterns later
- Removing complexity is MUCH harder than adding it
Phase 5: Document & Communicate
ADR Template
Every architectural decision MUST be documented:
# ADR-[XXX]: [Decision Title]
## Status
Proposed | Accepted | Deprecated | Superseded by [ADR-YYY]
## Context
[What problem are we solving? What constraints exist?]
## Decision
[What we chose - be specific]
## Rationale
[Why this decision - tie back to requirements and constraints]
## Trade-offs
[What we're giving up - be honest about costs]
## Consequences
- **Positive**: [Benefits we gain]
- **Negative**: [Costs/risks we accept]
- **Mitigation**: [How we'll address the negatives]
ADR Storage
Create docs/architecture/adr-*.md files:
docs/
โโโ architecture/
โโโ adr-001-use-nextjs.md
โโโ adr-002-postgresql-over-mongodb.md
โโโ adr-003-adopt-repository-pattern.md
โโโ adr-004-add-redis-caching.md
Examples by Project Type
Example 1: MVP E-commerce (Solo Developer)
Requirements:
- <1000 users initially
- Solo developer
- Fast to market (8 weeks)
- Budget-conscious
Architecture Decisions:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Decision โ Choice โ Rationale โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ App Structure โ Monolith โ Simpler for solo โ
โ Framework โ Next.js โ Full-stack, fast โ
โ Data Layer โ Prisma direct โ No Repo over-abstr โ
โ File Storage โ Local/S3 โ Start local โ
โ Authentication โ JWT โ Simpler than OAuth โ
โ Payment โ Stripe โ Hosted solution โ
โ Database โ PostgreSQL โ ACID for orders โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Trade-offs Accepted:
- Monolith โ Can't scale components independently
Why: Team size doesn't justify microservices overhead
- No Repository โ Less testable data layer
Why: Simple CRUD doesn't need indirection
- JWT โ No social login initially
Why: Faster implementation, can add OAuth later
Future Migration Path:
- When users > 10K โ Extract payment service
- When team > 3 โ Add Repository pattern
- When social login requested โ Add OAuth provider
Example 2: SaaS Product (5-10 Developers)
Requirements:
- 1K-100K users
- 5-10 developers
- Long-term product (12+ months)
- Multiple domains (billing, users, core)
Architecture Decisions:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Decision โ Choice โ Rationale โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ App Structure โ Modular Monolithโ Team size optimal โ
โ Framework โ NestJS โ Modular by design โ
โ Data Layer โ Repository โ Testing, flex โ
โ Domain Model โ Partial DDD โ Rich entities โ
โ Authentication โ OAuth + JWT โ Social login โ
โ Caching โ Redis โ Performance โ
โ Database โ PostgreSQL โ ACID, reliable โ
โ Message Queue โ RabbitMQ (later)โ When async needed โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Trade-offs Accepted:
- Modular Monolith โ Some coupling between modules
Why: Microservices overhead not justified yet
- Partial DDD โ Not full aggregates/domain events
Why: No domain experts, rich entities sufficient
- RabbitMQ later โ Initial synchronous calls
Why: Add complexity when async proven needed
Migration Path:
- When team > 10 โ Consider microservices
- When domains conflict โ Extract bounded contexts
- When read performance issues โ Add CQRS
Example 3: Enterprise (100K+ Users)
Requirements:
- 100K+ users
- 10+ developers
- Multiple business domains
- Different scaling needs per domain
- 24/7 availability required
Architecture Decisions:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Decision โ Choice โ Rationale โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ App Structure โ Microservices โ Independent scale โ
โ API Gateway โ Kong/AWS API GW โ Routing, auth โ
โ Domain Model โ Full DDD โ Complex business โ
โ Data Consistency โ Event-driven โ Eventual OK โ
โ Message Bus โ Kafka โ High throughput โ
โ Authentication โ OAuth + SAML โ Enterprise SSO โ
โ Database โ Polyglot โ Right tool per jobโ
โ CQRS โ Selected servicesโ Read/write divergeโ
โ Observability โ Full stack โ Debugging complex โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Trade-offs Accepted:
- Microservices โ High operational complexity
Why: Different scaling needs justify cost
- Eventual Consistency โ Complex debugging
Why: Real-time not required everywhere
- Polyglot Persistence โ More expertise needed
Why: Different domains have different needs
Operational Requirements:
- Service mesh (Istio/Linkerd)
- Distributed tracing (Jaeger/Tempo)
- Centralized logging (ELK/Loki)
- Circuit breakers (Resilience4j)
- Deployment automation (Kubernetes/Helm)
Common Architecture Patterns Reference
Data Access Patterns
| Pattern | When to Use | When NOT to Use | Complexity |
|---|---|---|---|
| Active Record | Simple CRUD, rapid prototyping | Complex queries, multiple data sources | Low |
| Repository | Testing needed, multiple data sources | Simple CRUD, single database | Medium |
| Unit of Work | Complex transactions, consistency | Simple operations | High |
| Data Mapper | Complex domain logic, performance | Simple CRUD, rapid dev | High |
Domain Logic Patterns
| Pattern | When to Use | When NOT to Use | Complexity |
|---|---|---|---|
| Transaction Script | Simple CRUD, procedural | Complex business rules | Low |
| Table Module | Record-based logic, simple domain | Rich behavior needed | Low |
| Domain Model | Complex business logic | Simple CRUD | Medium |
| DDD (Full) | Complex domain, domain experts | Simple domain, no experts | High |
Distributed System Patterns
| Pattern | When to Use | When NOT to Use | Complexity |
|---|---|---|---|
| Modular Monolith | Small teams, unclear boundaries | Clear bounded contexts, different scales | Medium |
| Microservices | Different scales, large teams | Small teams, simple domain | Very High |
| Event-Driven | Real-time, loose coupling | Simple workflows, strong consistency | High |
| CQRS | Read/write performance diverges | Simple CRUD, same model | High |
| Saga | Distributed transactions | Single database, simple ACID | High |
API Patterns
| Pattern | When to Use | When NOT to Use | Complexity |
|---|---|---|---|
| REST | Standard CRUD, resources | Real-time, complex queries | Low |
| GraphQL | Flexible queries, multiple clients | Simple CRUD, caching needs | Medium |
| gRPC | Internal services, performance | Public APIs, browser clients | Medium |
| WebSocket | Real-time updates | Simple request/response | Medium |
Validation Checklist
Before finalizing architecture, verify:
- Requirements clearly understood and documented
- Constraints identified and accepted
- Each decision has trade-off analysis
- Simpler alternatives considered
- ADRs written for significant decisions
- Migration path documented (if needed)
- Team expertise matches chosen patterns
- Operational complexity is manageable
Final Principle
"Simplicity is the ultimate sophistication. Start simple, add complexity only when proven necessary."
When in Doubt
- Choose the simpler option
- Defer complexity until proven needed
- Document the decision (ADR)
- Set revisit triggers
- Stay pragmatic over dogmatic
Related Skills
- database-design - Database schema design
- api-patterns - API design patterns
- deployment-procedures - Deployment architecture
Repository
