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:

  1. Scale

    • How many users? (10, 1K, 100K, 1M+)
    • Data volume? (MB, GB, TB)
    • Transaction rate? (per second/minute)
  2. Team

    • Solo developer or team?
    • Team size and expertise?
    • Distributed or co-located?
  3. Timeline

    • MVP/Prototype or long-term product?
    • Time to market pressure?
  4. Domain

    • CRUD-heavy or business logic complex?
    • Real-time requirements?
    • Compliance/regulations?
  5. 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:

  1. Problem Solved: What SPECIFIC problem does this pattern solve?
  2. Simpler Alternative: Is there a simpler solution?
  3. Deferred Complexity: Can we add this LATER when needed?

Red Flags (Anti-patterns to Avoid)

PatternAnti-patternWhy BadSimpler Alternative
MicroservicesPremature splittingAdds complexity before proving valueStart monolith, extract when needed
Clean/HexagonalOver-abstractionHard to understand, debug, onboardConcrete first, extract interfaces later
Event SourcingOver-engineeringComplex debugging, temporal couplingAppend-only audit log
CQRSUnnecessary complexityTwo models to maintain, sync issuesSingle model until read/write diverge significantly
RepositoryYAGNI for simple CRUDExtra layer without benefitORM 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

PatternWhen to UseWhen NOT to UseComplexity
Active RecordSimple CRUD, rapid prototypingComplex queries, multiple data sourcesLow
RepositoryTesting needed, multiple data sourcesSimple CRUD, single databaseMedium
Unit of WorkComplex transactions, consistencySimple operationsHigh
Data MapperComplex domain logic, performanceSimple CRUD, rapid devHigh

Domain Logic Patterns

PatternWhen to UseWhen NOT to UseComplexity
Transaction ScriptSimple CRUD, proceduralComplex business rulesLow
Table ModuleRecord-based logic, simple domainRich behavior neededLow
Domain ModelComplex business logicSimple CRUDMedium
DDD (Full)Complex domain, domain expertsSimple domain, no expertsHigh

Distributed System Patterns

PatternWhen to UseWhen NOT to UseComplexity
Modular MonolithSmall teams, unclear boundariesClear bounded contexts, different scalesMedium
MicroservicesDifferent scales, large teamsSmall teams, simple domainVery High
Event-DrivenReal-time, loose couplingSimple workflows, strong consistencyHigh
CQRSRead/write performance divergesSimple CRUD, same modelHigh
SagaDistributed transactionsSingle database, simple ACIDHigh

API Patterns

PatternWhen to UseWhen NOT to UseComplexity
RESTStandard CRUD, resourcesReal-time, complex queriesLow
GraphQLFlexible queries, multiple clientsSimple CRUD, caching needsMedium
gRPCInternal services, performancePublic APIs, browser clientsMedium
WebSocketReal-time updatesSimple request/responseMedium

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

  1. Choose the simpler option
  2. Defer complexity until proven needed
  3. Document the decision (ADR)
  4. Set revisit triggers
  5. Stay pragmatic over dogmatic

Related Skills