opencode-metis 0.1.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/README.md +140 -0
- package/dist/cli.cjs +63 -0
- package/dist/mcp-server.cjs +51 -0
- package/dist/plugin.cjs +4 -0
- package/dist/worker.cjs +224 -0
- package/opencode/agent/the-analyst/feature-prioritization.md +66 -0
- package/opencode/agent/the-analyst/market-research.md +77 -0
- package/opencode/agent/the-analyst/project-coordination.md +81 -0
- package/opencode/agent/the-analyst/requirements-analysis.md +77 -0
- package/opencode/agent/the-architect/compatibility-review.md +138 -0
- package/opencode/agent/the-architect/complexity-review.md +137 -0
- package/opencode/agent/the-architect/quality-review.md +67 -0
- package/opencode/agent/the-architect/security-review.md +127 -0
- package/opencode/agent/the-architect/system-architecture.md +119 -0
- package/opencode/agent/the-architect/system-documentation.md +83 -0
- package/opencode/agent/the-architect/technology-research.md +85 -0
- package/opencode/agent/the-chief.md +79 -0
- package/opencode/agent/the-designer/accessibility-implementation.md +101 -0
- package/opencode/agent/the-designer/design-foundation.md +74 -0
- package/opencode/agent/the-designer/interaction-architecture.md +75 -0
- package/opencode/agent/the-designer/user-research.md +70 -0
- package/opencode/agent/the-meta-agent.md +155 -0
- package/opencode/agent/the-platform-engineer/ci-cd-pipelines.md +109 -0
- package/opencode/agent/the-platform-engineer/containerization.md +106 -0
- package/opencode/agent/the-platform-engineer/data-architecture.md +81 -0
- package/opencode/agent/the-platform-engineer/dependency-review.md +144 -0
- package/opencode/agent/the-platform-engineer/deployment-automation.md +81 -0
- package/opencode/agent/the-platform-engineer/infrastructure-as-code.md +107 -0
- package/opencode/agent/the-platform-engineer/performance-tuning.md +82 -0
- package/opencode/agent/the-platform-engineer/pipeline-engineering.md +81 -0
- package/opencode/agent/the-platform-engineer/production-monitoring.md +105 -0
- package/opencode/agent/the-qa-engineer/exploratory-testing.md +66 -0
- package/opencode/agent/the-qa-engineer/performance-testing.md +81 -0
- package/opencode/agent/the-qa-engineer/quality-assurance.md +77 -0
- package/opencode/agent/the-qa-engineer/test-execution.md +66 -0
- package/opencode/agent/the-software-engineer/api-development.md +78 -0
- package/opencode/agent/the-software-engineer/component-development.md +79 -0
- package/opencode/agent/the-software-engineer/concurrency-review.md +141 -0
- package/opencode/agent/the-software-engineer/domain-modeling.md +66 -0
- package/opencode/agent/the-software-engineer/performance-optimization.md +113 -0
- package/opencode/command/analyze.md +149 -0
- package/opencode/command/constitution.md +178 -0
- package/opencode/command/debug.md +194 -0
- package/opencode/command/document.md +178 -0
- package/opencode/command/implement.md +225 -0
- package/opencode/command/refactor.md +207 -0
- package/opencode/command/review.md +229 -0
- package/opencode/command/simplify.md +267 -0
- package/opencode/command/specify.md +191 -0
- package/opencode/command/validate.md +224 -0
- package/opencode/skill/accessibility-design/SKILL.md +566 -0
- package/opencode/skill/accessibility-design/checklists/wcag-checklist.md +435 -0
- package/opencode/skill/agent-coordination/SKILL.md +224 -0
- package/opencode/skill/api-contract-design/SKILL.md +550 -0
- package/opencode/skill/api-contract-design/templates/graphql-schema-template.md +818 -0
- package/opencode/skill/api-contract-design/templates/rest-api-template.md +417 -0
- package/opencode/skill/architecture-design/SKILL.md +160 -0
- package/opencode/skill/architecture-design/examples/architecture-examples.md +170 -0
- package/opencode/skill/architecture-design/template.md +749 -0
- package/opencode/skill/architecture-design/validation.md +99 -0
- package/opencode/skill/architecture-selection/SKILL.md +522 -0
- package/opencode/skill/architecture-selection/examples/adrs/001-example-adr.md +71 -0
- package/opencode/skill/architecture-selection/examples/architecture-patterns.md +239 -0
- package/opencode/skill/bug-diagnosis/SKILL.md +235 -0
- package/opencode/skill/code-quality-review/SKILL.md +337 -0
- package/opencode/skill/code-quality-review/examples/anti-patterns.md +629 -0
- package/opencode/skill/code-quality-review/reference.md +322 -0
- package/opencode/skill/code-review/SKILL.md +363 -0
- package/opencode/skill/code-review/reference.md +450 -0
- package/opencode/skill/codebase-analysis/SKILL.md +139 -0
- package/opencode/skill/codebase-navigation/SKILL.md +227 -0
- package/opencode/skill/codebase-navigation/examples/exploration-patterns.md +263 -0
- package/opencode/skill/coding-conventions/SKILL.md +178 -0
- package/opencode/skill/coding-conventions/checklists/accessibility-checklist.md +176 -0
- package/opencode/skill/coding-conventions/checklists/performance-checklist.md +154 -0
- package/opencode/skill/coding-conventions/checklists/security-checklist.md +127 -0
- package/opencode/skill/constitution-validation/SKILL.md +315 -0
- package/opencode/skill/constitution-validation/examples/CONSTITUTION.md +202 -0
- package/opencode/skill/constitution-validation/reference/rule-patterns.md +328 -0
- package/opencode/skill/constitution-validation/template.md +115 -0
- package/opencode/skill/context-preservation/SKILL.md +445 -0
- package/opencode/skill/data-modeling/SKILL.md +385 -0
- package/opencode/skill/data-modeling/templates/schema-design-template.md +268 -0
- package/opencode/skill/deployment-pipeline-design/SKILL.md +579 -0
- package/opencode/skill/deployment-pipeline-design/templates/pipeline-template.md +633 -0
- package/opencode/skill/documentation-extraction/SKILL.md +259 -0
- package/opencode/skill/documentation-sync/SKILL.md +431 -0
- package/opencode/skill/domain-driven-design/SKILL.md +509 -0
- package/opencode/skill/domain-driven-design/examples/ddd-patterns.md +688 -0
- package/opencode/skill/domain-driven-design/reference.md +465 -0
- package/opencode/skill/drift-detection/SKILL.md +383 -0
- package/opencode/skill/drift-detection/reference.md +340 -0
- package/opencode/skill/error-recovery/SKILL.md +162 -0
- package/opencode/skill/error-recovery/examples/error-patterns.md +484 -0
- package/opencode/skill/feature-prioritization/SKILL.md +419 -0
- package/opencode/skill/feature-prioritization/examples/rice-template.md +139 -0
- package/opencode/skill/feature-prioritization/reference.md +256 -0
- package/opencode/skill/git-workflow/SKILL.md +453 -0
- package/opencode/skill/implementation-planning/SKILL.md +215 -0
- package/opencode/skill/implementation-planning/examples/phase-examples.md +217 -0
- package/opencode/skill/implementation-planning/template.md +220 -0
- package/opencode/skill/implementation-planning/validation.md +88 -0
- package/opencode/skill/implementation-verification/SKILL.md +272 -0
- package/opencode/skill/knowledge-capture/SKILL.md +265 -0
- package/opencode/skill/knowledge-capture/reference/knowledge-capture.md +402 -0
- package/opencode/skill/knowledge-capture/reference.md +444 -0
- package/opencode/skill/knowledge-capture/templates/domain-template.md +325 -0
- package/opencode/skill/knowledge-capture/templates/interface-template.md +255 -0
- package/opencode/skill/knowledge-capture/templates/pattern-template.md +144 -0
- package/opencode/skill/observability-design/SKILL.md +291 -0
- package/opencode/skill/observability-design/references/monitoring-patterns.md +461 -0
- package/opencode/skill/pattern-detection/SKILL.md +171 -0
- package/opencode/skill/pattern-detection/examples/common-patterns.md +359 -0
- package/opencode/skill/performance-analysis/SKILL.md +266 -0
- package/opencode/skill/performance-analysis/references/profiling-tools.md +499 -0
- package/opencode/skill/requirements-analysis/SKILL.md +139 -0
- package/opencode/skill/requirements-analysis/examples/good-prd.md +66 -0
- package/opencode/skill/requirements-analysis/template.md +177 -0
- package/opencode/skill/requirements-analysis/validation.md +69 -0
- package/opencode/skill/requirements-elicitation/SKILL.md +518 -0
- package/opencode/skill/requirements-elicitation/examples/interview-questions.md +226 -0
- package/opencode/skill/requirements-elicitation/examples/user-stories.md +414 -0
- package/opencode/skill/safe-refactoring/SKILL.md +312 -0
- package/opencode/skill/safe-refactoring/reference/code-smells.md +347 -0
- package/opencode/skill/security-assessment/SKILL.md +421 -0
- package/opencode/skill/security-assessment/checklists/security-review-checklist.md +285 -0
- package/opencode/skill/specification-management/SKILL.md +143 -0
- package/opencode/skill/specification-management/readme-template.md +32 -0
- package/opencode/skill/specification-management/reference.md +115 -0
- package/opencode/skill/specification-management/spec.py +229 -0
- package/opencode/skill/specification-validation/SKILL.md +397 -0
- package/opencode/skill/specification-validation/reference/3cs-framework.md +306 -0
- package/opencode/skill/specification-validation/reference/ambiguity-detection.md +132 -0
- package/opencode/skill/specification-validation/reference/constitution-validation.md +301 -0
- package/opencode/skill/specification-validation/reference/drift-detection.md +383 -0
- package/opencode/skill/task-delegation/SKILL.md +607 -0
- package/opencode/skill/task-delegation/examples/file-coordination.md +495 -0
- package/opencode/skill/task-delegation/examples/parallel-research.md +337 -0
- package/opencode/skill/task-delegation/examples/sequential-build.md +504 -0
- package/opencode/skill/task-delegation/reference.md +825 -0
- package/opencode/skill/tech-stack-detection/SKILL.md +89 -0
- package/opencode/skill/tech-stack-detection/references/framework-signatures.md +598 -0
- package/opencode/skill/technical-writing/SKILL.md +190 -0
- package/opencode/skill/technical-writing/templates/adr-template.md +205 -0
- package/opencode/skill/technical-writing/templates/system-doc-template.md +380 -0
- package/opencode/skill/test-design/SKILL.md +464 -0
- package/opencode/skill/test-design/examples/test-pyramid.md +724 -0
- package/opencode/skill/testing/SKILL.md +213 -0
- package/opencode/skill/testing/examples/test-pyramid.md +724 -0
- package/opencode/skill/user-insight-synthesis/SKILL.md +576 -0
- package/opencode/skill/user-insight-synthesis/templates/research-plan-template.md +217 -0
- package/opencode/skill/user-research/SKILL.md +508 -0
- package/opencode/skill/user-research/examples/interview-questions.md +265 -0
- package/opencode/skill/user-research/examples/personas.md +267 -0
- package/opencode/skill/vibe-security/SKILL.md +654 -0
- package/package.json +45 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# SDD Validation Checklist
|
|
2
|
+
|
|
3
|
+
Use this checklist to validate SDD completeness before proceeding to Implementation Plan.
|
|
4
|
+
|
|
5
|
+
## Structure Validation
|
|
6
|
+
|
|
7
|
+
- [ ] **All required sections are complete** - No empty or placeholder sections
|
|
8
|
+
- [ ] **No [NEEDS CLARIFICATION] markers remain** - All markers replaced with content
|
|
9
|
+
- [ ] **Template structure preserved** - No sections added, removed, or reorganized
|
|
10
|
+
|
|
11
|
+
## Context Validation
|
|
12
|
+
|
|
13
|
+
- [ ] **All context sources listed** - Every relevant file, doc, URL documented
|
|
14
|
+
- [ ] **Relevance ratings assigned** - CRITICAL/HIGH/MEDIUM/LOW for each source
|
|
15
|
+
- [ ] **Why explanations provided** - Each source explains its relevance
|
|
16
|
+
- [ ] **Project commands discovered** - Commands from actual project files, not assumed
|
|
17
|
+
|
|
18
|
+
## Constraints & Strategy
|
|
19
|
+
|
|
20
|
+
- [ ] **Constraints identified** - Technical, business, compliance constraints documented
|
|
21
|
+
- [ ] **Strategy follows from constraints** - Logical progression from constraints to approach
|
|
22
|
+
- [ ] **Architecture pattern stated** - Clear pattern name (layered, modular, microservice, etc.)
|
|
23
|
+
- [ ] **Pattern rationale provided** - Why this pattern fits the constraints
|
|
24
|
+
|
|
25
|
+
## Component Design
|
|
26
|
+
|
|
27
|
+
- [ ] **Every component has directory mapping** - Where code will live
|
|
28
|
+
- [ ] **Every component in diagram** - No orphan components
|
|
29
|
+
- [ ] **Component names consistent** - Same names across diagrams, text, and directory structure
|
|
30
|
+
- [ ] **Responsibilities clear** - What each component does (single responsibility)
|
|
31
|
+
- [ ] **No component overlap** - No duplicate responsibilities
|
|
32
|
+
|
|
33
|
+
## Interface Design
|
|
34
|
+
|
|
35
|
+
- [ ] **All interfaces specified** - API endpoints, data models, events documented
|
|
36
|
+
- [ ] **Request/response formats defined** - Clear data structures
|
|
37
|
+
- [ ] **Error responses documented** - Error codes and messages
|
|
38
|
+
- [ ] **Authentication specified** - How each interface is secured
|
|
39
|
+
- [ ] **External integrations documented** - Third-party APIs and their contracts
|
|
40
|
+
|
|
41
|
+
## Data Design
|
|
42
|
+
|
|
43
|
+
- [ ] **Data models defined** - Entities, fields, types
|
|
44
|
+
- [ ] **Database schema specified** - Tables, columns, relationships (if applicable)
|
|
45
|
+
- [ ] **SQL examples use actual column names** - Verified against migration files, not pseudocode (e.g. `product_bundle_id` not `bundle_id`, `settled_at` not `period_start`)
|
|
46
|
+
- [ ] **Data flow documented** - How data moves through the system
|
|
47
|
+
- [ ] **Storage decisions explained** - Why specific storage choices
|
|
48
|
+
|
|
49
|
+
## Cross-Cutting Concerns
|
|
50
|
+
|
|
51
|
+
- [ ] **Error handling covers all types** - Validation, business, system errors
|
|
52
|
+
- [ ] **Security patterns defined** - Auth, authz, encryption, input validation
|
|
53
|
+
- [ ] **Logging/observability planned** - What to log, how to monitor
|
|
54
|
+
- [ ] **Performance considerations** - Caching, batching, async patterns
|
|
55
|
+
- [ ] **Deployment approach defined** - Environment, config, dependencies
|
|
56
|
+
|
|
57
|
+
## Quality Requirements
|
|
58
|
+
|
|
59
|
+
- [ ] **Quality requirements are specific** - Numbers and units, not vague
|
|
60
|
+
- [ ] **Quality requirements are measurable** - Can be tested
|
|
61
|
+
- [ ] **Every quality requirement has test coverage** - How it will be verified
|
|
62
|
+
|
|
63
|
+
## Architecture Decisions
|
|
64
|
+
|
|
65
|
+
- [ ] **ADRs documented** - All significant decisions recorded
|
|
66
|
+
- [ ] **Rationale provided** - Why each choice was made
|
|
67
|
+
- [ ] **Trade-offs acknowledged** - What we accept with each decision
|
|
68
|
+
- [ ] **All ADRs confirmed by user** - User has approved each decision
|
|
69
|
+
|
|
70
|
+
## PRD Alignment
|
|
71
|
+
|
|
72
|
+
- [ ] **All PRD requirements addressable** - Every requirement maps to design
|
|
73
|
+
- [ ] **No scope creep** - Nothing designed beyond PRD scope
|
|
74
|
+
- [ ] **Acceptance criteria satisfiable** - Design enables meeting all criteria
|
|
75
|
+
|
|
76
|
+
## Implementability
|
|
77
|
+
|
|
78
|
+
- [ ] **A developer could implement from this** - Clear enough for someone new
|
|
79
|
+
- [ ] **Implementation examples provided** - For complex logic (where helpful)
|
|
80
|
+
- [ ] **Complex queries include traced walkthroughs** - Example data rows showing how conditional logic evaluates for each variant
|
|
81
|
+
- [ ] **Acceptance criteria defined** - EARS criteria for system behaviors
|
|
82
|
+
- [ ] **Dependencies identified** - External libraries, services, etc.
|
|
83
|
+
|
|
84
|
+
## Consistency Checks
|
|
85
|
+
|
|
86
|
+
Run these checks across the entire document:
|
|
87
|
+
- [ ] **Component names match everywhere** - Diagrams, text, directory structure
|
|
88
|
+
- [ ] **Interface names match everywhere** - APIs, data models, references
|
|
89
|
+
- [ ] **No contradictions between sections** - Consistent throughout
|
|
90
|
+
- [ ] **Patterns applied consistently** - Same approach for similar problems
|
|
91
|
+
|
|
92
|
+
## Completion Criteria
|
|
93
|
+
|
|
94
|
+
✅ **SDD is complete when:**
|
|
95
|
+
- All checklist items pass
|
|
96
|
+
- All ADRs have user confirmation
|
|
97
|
+
- No open questions remain
|
|
98
|
+
- A developer could implement without further clarification
|
|
99
|
+
- Ready for implementation planning (PLAN)
|
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture-selection
|
|
3
|
+
description: "System architecture patterns including monolith, microservices, event-driven, and serverless, with C4 modeling, scalability strategies, and technology selection criteria. Use when designing system architectures, evaluating patterns, or planning scalability."
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: opencode
|
|
6
|
+
metadata:
|
|
7
|
+
category: development
|
|
8
|
+
version: "1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Architecture Selection
|
|
12
|
+
|
|
13
|
+
Roleplay as an architecture selection specialist that evaluates system requirements against architectural patterns and recommends solutions balancing scalability, team capability, and operational complexity.
|
|
14
|
+
|
|
15
|
+
ArchitectureSelection {
|
|
16
|
+
Activation {
|
|
17
|
+
Designing new system architectures
|
|
18
|
+
Evaluating monolith vs microservices vs serverless
|
|
19
|
+
Planning scalability strategies
|
|
20
|
+
Selecting technology stacks
|
|
21
|
+
Creating architecture documentation
|
|
22
|
+
Reviewing architecture decisions
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Constraints {
|
|
26
|
+
1. Evaluate patterns top-to-bottom; first match wins
|
|
27
|
+
2. Balance scalability, team capability, and operational complexity
|
|
28
|
+
3. Document decisions using ADR format
|
|
29
|
+
4. Consider team size and domain complexity before choosing patterns
|
|
30
|
+
5. Avoid premature optimization - start simple, measure, scale
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
PatternSelectionGuide {
|
|
34
|
+
Evaluate top-to-bottom. First match wins.
|
|
35
|
+
|
|
36
|
+
| If You See | Choose | Rationale |
|
|
37
|
+
|------------|--------|-----------|
|
|
38
|
+
| Small team (<10), simple domain, rapid iteration | Monolith | Lowest complexity, fastest development |
|
|
39
|
+
| Multiple teams, independent scaling needs, complex domain | Microservices | Team autonomy, targeted scaling |
|
|
40
|
+
| Loose coupling required, async processing acceptable | Event-Driven | Temporal decoupling, natural audit trail |
|
|
41
|
+
| Variable workloads, short-running operations, cost-sensitive | Serverless | Pay-per-use, auto-scaling, no ops |
|
|
42
|
+
| Read/write pattern mismatch, complex queries | CQRS | Optimized read/write models |
|
|
43
|
+
|
|
44
|
+
PatternComparisonMatrix {
|
|
45
|
+
| Factor | Monolith | Microservices | Event-Driven | Serverless |
|
|
46
|
+
|--------|----------|---------------|--------------|------------|
|
|
47
|
+
| Team Size | Small (<10) | Large (>20) | Any | Any |
|
|
48
|
+
| Domain Complexity | Simple | Complex | Complex | Simple-Medium |
|
|
49
|
+
| Scaling Needs | Uniform | Varied | Async | Unpredictable |
|
|
50
|
+
| Time to Market | Fast initially | Slower start | Medium | Fast |
|
|
51
|
+
| Ops Maturity | Low | High | High | Medium |
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
ArchitecturePatterns {
|
|
56
|
+
MonolithicArchitecture {
|
|
57
|
+
Description: "A single deployable unit containing all functionality"
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
61
|
+
│ Monolithic Application │
|
|
62
|
+
├─────────────────────────────────────────────────────────────┤
|
|
63
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
64
|
+
│ │ Web UI │ │ API Layer │ │ Admin UI │ │
|
|
65
|
+
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
|
|
66
|
+
│ │ │ │ │
|
|
67
|
+
│ └────────────────┼────────────────┘ │
|
|
68
|
+
│ │ │
|
|
69
|
+
│ ┌───────────────────────┴───────────────────────────┐ │
|
|
70
|
+
│ │ Business Logic Layer │ │
|
|
71
|
+
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
|
|
72
|
+
│ │ │ Orders │ │ Users │ │ Products │ │ │
|
|
73
|
+
│ │ └──────────┘ └──────────┘ └──────────┘ │ │
|
|
74
|
+
│ └───────────────────────┬───────────────────────────┘ │
|
|
75
|
+
│ │ │
|
|
76
|
+
│ ┌───────────────────────┴───────────────────────────┐ │
|
|
77
|
+
│ │ Data Access Layer │ │
|
|
78
|
+
│ └───────────────────────┬───────────────────────────┘ │
|
|
79
|
+
│ │ │
|
|
80
|
+
└──────────────────────────┼──────────────────────────────────┘
|
|
81
|
+
│
|
|
82
|
+
┌──────┴──────┐
|
|
83
|
+
│ Database │
|
|
84
|
+
└─────────────┘
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
WhenToUse {
|
|
88
|
+
Small team (< 10 developers)
|
|
89
|
+
Simple domain
|
|
90
|
+
Rapid iteration needed
|
|
91
|
+
Limited infrastructure expertise
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
TradeOffs {
|
|
95
|
+
| Pros | Cons |
|
|
96
|
+
|------|------|
|
|
97
|
+
| Simple deployment | Limited scalability |
|
|
98
|
+
| Easy debugging | Large codebase to manage |
|
|
99
|
+
| Single codebase | Technology lock-in |
|
|
100
|
+
| Fast development initially | Team coupling |
|
|
101
|
+
| Transactional consistency | Full redeploy for changes |
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
MicroservicesArchitecture {
|
|
106
|
+
Description: "Independently deployable services organized around business capabilities"
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐
|
|
110
|
+
│ Web UI │ │Mobile │ │ Admin │ │External│
|
|
111
|
+
└───┬────┘ └───┬────┘ └───┬────┘ └───┬────┘
|
|
112
|
+
│ │ │ │
|
|
113
|
+
└────────────┴────────────┴────────────┘
|
|
114
|
+
│
|
|
115
|
+
┌────────┴────────┐
|
|
116
|
+
│ API Gateway │
|
|
117
|
+
└────────┬────────┘
|
|
118
|
+
│
|
|
119
|
+
┌──────────────────┼──────────────────┐
|
|
120
|
+
│ │ │
|
|
121
|
+
┌───┴───┐ ┌────┴───┐ ┌───┴───┐
|
|
122
|
+
│ Order │ │ User │ │Product│
|
|
123
|
+
│Service│ │Service │ │Service│
|
|
124
|
+
├───────┤ ├────────┤ ├───────┤
|
|
125
|
+
│ DB │ │ DB │ │ DB │
|
|
126
|
+
└───────┘ └────────┘ └───────┘
|
|
127
|
+
│ │ │
|
|
128
|
+
└──────────────────┴──────────────────┘
|
|
129
|
+
│
|
|
130
|
+
┌────────┴────────┐
|
|
131
|
+
│ Message Bus │
|
|
132
|
+
└─────────────────┘
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
WhenToUse {
|
|
136
|
+
Large team (> 20 developers)
|
|
137
|
+
Complex, evolving domain
|
|
138
|
+
Independent scaling needed
|
|
139
|
+
Different tech stacks for different services
|
|
140
|
+
High availability requirements
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
TradeOffs {
|
|
144
|
+
| Pros | Cons |
|
|
145
|
+
|------|------|
|
|
146
|
+
| Independent deployment | Operational complexity |
|
|
147
|
+
| Technology flexibility | Network latency |
|
|
148
|
+
| Team autonomy | Distributed debugging |
|
|
149
|
+
| Targeted scaling | Data consistency challenges |
|
|
150
|
+
| Fault isolation | More infrastructure |
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
EventDrivenArchitecture {
|
|
155
|
+
Description: "Services communicate through events rather than direct calls"
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
159
|
+
│ Event Bus / Broker │
|
|
160
|
+
├─────────────────────────────────────────────────────────────┤
|
|
161
|
+
│ │
|
|
162
|
+
│ OrderPlaced UserCreated PaymentReceived │
|
|
163
|
+
│ │
|
|
164
|
+
└──────┬──────────────┬──────────────┬───────────────────────┘
|
|
165
|
+
│ │ │
|
|
166
|
+
▼ ▼ ▼
|
|
167
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
168
|
+
│ Order │ │ User │ │ Payment │
|
|
169
|
+
│ Service │ │ Service │ │ Service │
|
|
170
|
+
│ │ │ │ │ │
|
|
171
|
+
│ Publishes: │ │ Publishes: │ │ Publishes: │
|
|
172
|
+
│ OrderPlaced │ │ UserCreated │ │ PaymentRcvd │
|
|
173
|
+
│ │ │ │ │ │
|
|
174
|
+
│ Subscribes: │ │ Subscribes: │ │ Subscribes: │
|
|
175
|
+
│ PaymentRcvd │ │ OrderPlaced │ │ OrderPlaced │
|
|
176
|
+
└─────────────┘ └─────────────┘ └─────────────┘
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
WhenToUse {
|
|
180
|
+
Loose coupling required
|
|
181
|
+
Asynchronous processing acceptable
|
|
182
|
+
Complex workflows spanning multiple services
|
|
183
|
+
Audit trail needed
|
|
184
|
+
Event sourcing scenarios
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
TradeOffs {
|
|
188
|
+
| Pros | Cons |
|
|
189
|
+
|------|------|
|
|
190
|
+
| Temporal decoupling | Eventual consistency |
|
|
191
|
+
| Natural audit log | Complex debugging |
|
|
192
|
+
| Scalability | Message ordering challenges |
|
|
193
|
+
| Extensibility | Infrastructure requirements |
|
|
194
|
+
| Resilience | Learning curve |
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
ServerlessArchitecture {
|
|
199
|
+
Description: "Functions executed on-demand without managing servers"
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
┌────────────────────────────────────────────────────────────┐
|
|
203
|
+
│ Client │
|
|
204
|
+
└────────────────────────────┬───────────────────────────────┘
|
|
205
|
+
│
|
|
206
|
+
┌────────────────────────────┴───────────────────────────────┐
|
|
207
|
+
│ API Gateway │
|
|
208
|
+
└────────────────────────────┬───────────────────────────────┘
|
|
209
|
+
│
|
|
210
|
+
┌────────────────────────┼────────────────────────┐
|
|
211
|
+
│ │ │
|
|
212
|
+
▼ ▼ ▼
|
|
213
|
+
┌──────────┐ ┌──────────┐ ┌──────────┐
|
|
214
|
+
│ Function │ │ Function │ │ Function │
|
|
215
|
+
│ GetUser │ │CreateOrder│ │ SendEmail│
|
|
216
|
+
└────┬─────┘ └────┬─────┘ └────┬─────┘
|
|
217
|
+
│ │ │
|
|
218
|
+
▼ ▼ ▼
|
|
219
|
+
┌──────────┐ ┌──────────┐ ┌──────────┐
|
|
220
|
+
│ Database │ │ Queue │ │ Email │
|
|
221
|
+
│ │ │ │ │ Service │
|
|
222
|
+
└──────────┘ └──────────┘ └──────────┘
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
WhenToUse {
|
|
226
|
+
Variable/unpredictable workloads
|
|
227
|
+
Event-triggered processing
|
|
228
|
+
Cost optimization for low traffic
|
|
229
|
+
Rapid development needed
|
|
230
|
+
Short-running operations
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
TradeOffs {
|
|
234
|
+
| Pros | Cons |
|
|
235
|
+
|------|------|
|
|
236
|
+
| No server management | Cold start latency |
|
|
237
|
+
| Pay-per-use | Execution time limits |
|
|
238
|
+
| Auto-scaling | Vendor lock-in |
|
|
239
|
+
| Rapid deployment | Complex local development |
|
|
240
|
+
| Reduced ops burden | Stateless constraints |
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
C4Model {
|
|
246
|
+
Description: "Hierarchical way to document architecture at multiple levels of detail"
|
|
247
|
+
|
|
248
|
+
Level1SystemContext {
|
|
249
|
+
Purpose: "Shows system in its environment with external actors and systems"
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
253
|
+
│ System Context Diagram │
|
|
254
|
+
├──────────────────────────────────────────────────────────────┤
|
|
255
|
+
│ │
|
|
256
|
+
│ ┌──────────┐ ┌──────────┐ │
|
|
257
|
+
│ │ Customer │ │ Admin │ │
|
|
258
|
+
│ │ [User] │ │ [User] │ │
|
|
259
|
+
│ └────┬─────┘ └────┬─────┘ │
|
|
260
|
+
│ │ │ │
|
|
261
|
+
│ │ Places orders │ Manages │
|
|
262
|
+
│ │ │ products │
|
|
263
|
+
│ ▼ ▼ │
|
|
264
|
+
│ ┌────────────────────────────────────────────────┐ │
|
|
265
|
+
│ │ E-Commerce System │ │
|
|
266
|
+
│ │ [Software System] │ │
|
|
267
|
+
│ └───────────┬─────────────────┬──────────────────┘ │
|
|
268
|
+
│ │ │ │
|
|
269
|
+
│ │ │ │
|
|
270
|
+
│ ▼ ▼ │
|
|
271
|
+
│ ┌───────────────┐ ┌───────────────┐ │
|
|
272
|
+
│ │ Payment │ │ Email │ │
|
|
273
|
+
│ │ Gateway │ │ Provider │ │
|
|
274
|
+
│ │ [External] │ │ [External] │ │
|
|
275
|
+
│ └───────────────┘ └───────────────┘ │
|
|
276
|
+
│ │
|
|
277
|
+
└──────────────────────────────────────────────────────────────┘
|
|
278
|
+
```
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
Level2Container {
|
|
282
|
+
Purpose: "Shows the high-level technology choices and how containers communicate"
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
286
|
+
│ Container Diagram │
|
|
287
|
+
├──────────────────────────────────────────────────────────────┤
|
|
288
|
+
│ │
|
|
289
|
+
│ ┌──────────────────┐ ┌──────────────────┐ │
|
|
290
|
+
│ │ Web App │ │ Mobile App │ │
|
|
291
|
+
│ │ [React SPA] │ │ [React Native] │ │
|
|
292
|
+
│ └────────┬─────────┘ └────────┬─────────┘ │
|
|
293
|
+
│ │ │ │
|
|
294
|
+
│ │ HTTPS │ │
|
|
295
|
+
│ └───────────┬───────────────┘ │
|
|
296
|
+
│ ▼ │
|
|
297
|
+
│ ┌───────────────────────┐ │
|
|
298
|
+
│ │ API Gateway │ │
|
|
299
|
+
│ │ [Kong] │ │
|
|
300
|
+
│ └───────────┬───────────┘ │
|
|
301
|
+
│ │ │
|
|
302
|
+
│ ┌────────────────┼────────────────┐ │
|
|
303
|
+
│ │ │ │ │
|
|
304
|
+
│ ▼ ▼ ▼ │
|
|
305
|
+
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
|
|
306
|
+
│ │ Order │ │ User │ │ Product │ │
|
|
307
|
+
│ │ Service │ │ Service │ │ Service │ │
|
|
308
|
+
│ │ [Node] │ │ [Node] │ │ [Go] │ │
|
|
309
|
+
│ └────┬────┘ └────┬────┘ └────┬────┘ │
|
|
310
|
+
│ │ │ │ │
|
|
311
|
+
│ ▼ ▼ ▼ │
|
|
312
|
+
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
|
|
313
|
+
│ │ Orders │ │ Users │ │Products │ │
|
|
314
|
+
│ │ DB │ │ DB │ │ DB │ │
|
|
315
|
+
│ │[Postgres│ │[Postgres│ │ [Mongo] │ │
|
|
316
|
+
│ └─────────┘ └─────────┘ └─────────┘ │
|
|
317
|
+
│ │
|
|
318
|
+
└──────────────────────────────────────────────────────────────┘
|
|
319
|
+
```
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
Level3Component {
|
|
323
|
+
Purpose: "Shows internal structure of a container"
|
|
324
|
+
|
|
325
|
+
```
|
|
326
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
327
|
+
│ Component Diagram: Order Service │
|
|
328
|
+
├──────────────────────────────────────────────────────────────┤
|
|
329
|
+
│ │
|
|
330
|
+
│ ┌───────────────────────────────────────────────────────┐ │
|
|
331
|
+
│ │ API Layer │ │
|
|
332
|
+
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
|
|
333
|
+
│ │ │ OrdersCtrl │ │ HealthCtrl │ │ MetricsCtrl │ │ │
|
|
334
|
+
│ │ └──────┬──────┘ └─────────────┘ └─────────────┘ │ │
|
|
335
|
+
│ └─────────┼─────────────────────────────────────────────┘ │
|
|
336
|
+
│ │ │
|
|
337
|
+
│ ┌─────────┼─────────────────────────────────────────────┐ │
|
|
338
|
+
│ │ ▼ Domain Layer │ │
|
|
339
|
+
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
|
|
340
|
+
│ │ │OrderService │ │ OrderCalc │ │ Validators │ │ │
|
|
341
|
+
│ │ └──────┬──────┘ └─────────────┘ └─────────────┘ │ │
|
|
342
|
+
│ └─────────┼─────────────────────────────────────────────┘ │
|
|
343
|
+
│ │ │
|
|
344
|
+
│ ┌─────────┼─────────────────────────────────────────────┐ │
|
|
345
|
+
│ │ ▼ Infrastructure Layer │ │
|
|
346
|
+
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
|
|
347
|
+
│ │ │ OrderRepo │ │PaymentClient│ │ EventPub │ │ │
|
|
348
|
+
│ │ └─────────────┘ └─────────────┘ └─────────────┘ │ │
|
|
349
|
+
│ └───────────────────────────────────────────────────────┘ │
|
|
350
|
+
│ │
|
|
351
|
+
└──────────────────────────────────────────────────────────────┘
|
|
352
|
+
```
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
Level4Code {
|
|
356
|
+
Purpose: "Shows implementation details (class diagrams, sequence diagrams)"
|
|
357
|
+
Note: "Use standard UML when needed at this level"
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
ScalabilityPatterns {
|
|
362
|
+
HorizontalScaling {
|
|
363
|
+
Description: "Add more instances of the same component"
|
|
364
|
+
|
|
365
|
+
```
|
|
366
|
+
Load Balancer
|
|
367
|
+
│
|
|
368
|
+
┌───────────────┼───────────────┐
|
|
369
|
+
│ │ │
|
|
370
|
+
▼ ▼ ▼
|
|
371
|
+
┌─────────┐ ┌─────────┐ ┌─────────┐
|
|
372
|
+
│Instance │ │Instance │ │Instance │
|
|
373
|
+
│ 1 │ │ 2 │ │ 3 │
|
|
374
|
+
└─────────┘ └─────────┘ └─────────┘
|
|
375
|
+
|
|
376
|
+
Requirements:
|
|
377
|
+
- Stateless services
|
|
378
|
+
- Shared session storage
|
|
379
|
+
- Database can handle connections
|
|
380
|
+
```
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
Caching {
|
|
384
|
+
Description: "Reduce load on slow resources"
|
|
385
|
+
|
|
386
|
+
```
|
|
387
|
+
┌─────────────────────────────────────────────────────┐
|
|
388
|
+
│ Caching Layers │
|
|
389
|
+
├─────────────────────────────────────────────────────┤
|
|
390
|
+
│ │
|
|
391
|
+
│ Browser Cache → CDN → App Cache → Database Cache │
|
|
392
|
+
│ │
|
|
393
|
+
│ Examples: │
|
|
394
|
+
│ - Browser: Static assets, API responses │
|
|
395
|
+
│ - CDN: Static content, cached API responses │
|
|
396
|
+
│ - App: Redis/Memcached for sessions, computed data│
|
|
397
|
+
│ - Database: Query cache, connection pooling │
|
|
398
|
+
│ │
|
|
399
|
+
└─────────────────────────────────────────────────────┘
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
InvalidationStrategies {
|
|
403
|
+
TTL: "Time to Live - Simplest, eventual consistency"
|
|
404
|
+
WriteThrough: "Update cache on write"
|
|
405
|
+
WriteBehind: "Async update for performance"
|
|
406
|
+
CacheAside: "App manages cache explicitly"
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
DatabaseScaling {
|
|
411
|
+
| Strategy | Use Case | Trade-off |
|
|
412
|
+
|----------|----------|-----------|
|
|
413
|
+
| Read Replicas | Read-heavy workloads | Replication lag |
|
|
414
|
+
| Sharding | Large datasets | Query complexity |
|
|
415
|
+
| Partitioning | Time-series data | Partition management |
|
|
416
|
+
| CQRS | Different read/write patterns | System complexity |
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
ReliabilityPatterns {
|
|
420
|
+
| Pattern | Purpose | Implementation |
|
|
421
|
+
|---------|---------|----------------|
|
|
422
|
+
| Circuit Breaker | Prevent cascade failures | Fail fast after threshold |
|
|
423
|
+
| Bulkhead | Isolate failures | Separate thread pools |
|
|
424
|
+
| Retry | Handle transient failures | Exponential backoff |
|
|
425
|
+
| Timeout | Bound wait times | Don't wait forever |
|
|
426
|
+
| Rate Limiting | Prevent overload | Throttle requests |
|
|
427
|
+
|
|
428
|
+
```
|
|
429
|
+
Circuit Breaker States:
|
|
430
|
+
|
|
431
|
+
┌────────┐
|
|
432
|
+
│ CLOSED │ ──── Failure Threshold ──► ┌────────┐
|
|
433
|
+
│(normal)│ │ OPEN │
|
|
434
|
+
└────────┘ │(failing│
|
|
435
|
+
▲ └────┬───┘
|
|
436
|
+
│ │
|
|
437
|
+
Success Timeout
|
|
438
|
+
Threshold │
|
|
439
|
+
│ ▼
|
|
440
|
+
┌────┴────┐ ┌─────────┐
|
|
441
|
+
│HALF-OPEN│ ◄─── Test Request ────── │ │
|
|
442
|
+
└─────────┘ └─────────┘
|
|
443
|
+
```
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
TechnologySelection {
|
|
448
|
+
SelectionCriteria {
|
|
449
|
+
| Criterion | Questions |
|
|
450
|
+
|-----------|-----------|
|
|
451
|
+
| Fit | Does it solve the actual problem? |
|
|
452
|
+
| Maturity | Production-proven? Community size? |
|
|
453
|
+
| Team Skills | Can the team use it effectively? |
|
|
454
|
+
| Performance | Meets requirements? Benchmarks? |
|
|
455
|
+
| Operations | How hard to deploy, monitor, debug? |
|
|
456
|
+
| Cost | License, infrastructure, learning curve? |
|
|
457
|
+
| Lock-in | Exit strategy? Standards compliance? |
|
|
458
|
+
| Security | Track record? Compliance certifications? |
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
EvaluationMatrix {
|
|
462
|
+
```
|
|
463
|
+
| Technology | Fit | Maturity | Skills | Perf | Ops | Cost | Score |
|
|
464
|
+
|------------|-----|----------|--------|------|-----|------|-------|
|
|
465
|
+
| Option A | 4 | 5 | 3 | 4 | 4 | 3 | 3.8 |
|
|
466
|
+
| Option B | 5 | 3 | 4 | 5 | 2 | 4 | 3.8 |
|
|
467
|
+
| Option C | 3 | 4 | 5 | 3 | 5 | 5 | 4.2 |
|
|
468
|
+
|
|
469
|
+
Weights: Fit(25%), Maturity(15%), Skills(20%), Perf(15%), Ops(15%), Cost(10%)
|
|
470
|
+
```
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
ADRTemplate {
|
|
475
|
+
```markdown
|
|
476
|
+
# ADR-[NUMBER]: [TITLE]
|
|
477
|
+
|
|
478
|
+
## Status
|
|
479
|
+
[Proposed | Accepted | Deprecated | Superseded by ADR-XXX]
|
|
480
|
+
|
|
481
|
+
## Context
|
|
482
|
+
[What is the issue we're facing? What decision needs to be made?]
|
|
483
|
+
|
|
484
|
+
## Decision
|
|
485
|
+
[What is the change we're proposing/making?]
|
|
486
|
+
|
|
487
|
+
## Consequences
|
|
488
|
+
### Positive
|
|
489
|
+
- [Benefit 1]
|
|
490
|
+
- [Benefit 2]
|
|
491
|
+
|
|
492
|
+
### Negative
|
|
493
|
+
- [Trade-off 1]
|
|
494
|
+
- [Trade-off 2]
|
|
495
|
+
|
|
496
|
+
### Neutral
|
|
497
|
+
- [Observation]
|
|
498
|
+
|
|
499
|
+
## Alternatives Considered
|
|
500
|
+
### Alternative 1: [Name]
|
|
501
|
+
- Pros: [...]
|
|
502
|
+
- Cons: [...]
|
|
503
|
+
- Why rejected: [...]
|
|
504
|
+
```
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
AntiPatterns {
|
|
508
|
+
| Anti-Pattern | Problem | Solution |
|
|
509
|
+
|--------------|---------|----------|
|
|
510
|
+
| Big Ball of Mud | No clear architecture | Establish bounded contexts |
|
|
511
|
+
| Distributed Monolith | Microservices without independence | True service boundaries |
|
|
512
|
+
| Resume-Driven | Choosing tech for experience | Match tech to requirements |
|
|
513
|
+
| Premature Optimization | Scaling before needed | Start simple, measure, scale |
|
|
514
|
+
| Ivory Tower | Architecture divorced from reality | Evolutionary architecture |
|
|
515
|
+
| Golden Hammer | Same solution for every problem | Evaluate each case |
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
## References
|
|
520
|
+
|
|
521
|
+
- [Pattern Examples](examples/architecture-patterns.md) - Detailed implementations
|
|
522
|
+
- [ADR Repository](examples/adrs/) - Example decision records
|