@dzhechkov/keysarium 1.1.2 → 1.2.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/package.json +10 -2
- package/templates/.claude/commands/dream.md +101 -0
- package/templates/.claude/commands/feature-adr.md +92 -0
- package/templates/.claude/commands/init-platform.md +161 -0
- package/templates/.claude/commands/learning-stats.md +130 -0
- package/templates/.claude/commands/workers.md +140 -0
- package/templates/.claude/rules/background-workers.md +72 -0
- package/templates/.claude/rules/dream-cycles.md +90 -0
- package/templates/.claude/rules/feature-adr-conventions.md +82 -0
- package/templates/.claude/rules/reward-learning.md +124 -0
- package/templates/.claude/shards/feature-adr.shard.md +98 -0
- package/templates/.claude/skills/feature-adr/SKILL.md +252 -0
- package/templates/.claude/skills/feature-adr/examples/sample-feature-output.md +257 -0
- package/templates/.claude/skills/feature-adr/modules/00-complexity-router.md +114 -0
- package/templates/.claude/skills/feature-adr/modules/01-requirements.md +113 -0
- package/templates/.claude/skills/feature-adr/modules/02-research.md +92 -0
- package/templates/.claude/skills/feature-adr/modules/03-adr.md +135 -0
- package/templates/.claude/skills/feature-adr/modules/04-ddd.md +114 -0
- package/templates/.claude/skills/feature-adr/modules/05-architecture.md +149 -0
- package/templates/.claude/skills/feature-adr/modules/06-implementation-plan.md +129 -0
- package/templates/.claude/skills/feature-adr/modules/07-code.md +126 -0
- package/templates/.claude/skills/feature-adr/modules/08-qe.md +167 -0
- package/templates/.claude/skills/feature-adr/references/adr-template.md +102 -0
- package/templates/.claude/skills/feature-adr/references/c4-template.md +120 -0
- package/templates/.claude/skills/feature-adr/references/complexity-matrix.md +139 -0
- package/templates/.claude/skills/feature-adr/references/qe-checklist.md +86 -0
- package/templates/CLAUDE.md +124 -3
- package/templates/docs/improvement-directions.md +16 -16
- package/templates/docs/keysarium/01-deployment-guide.md +21 -12
- package/templates/docs/keysarium/02-admin-guide.md +204 -3
- package/templates/docs/keysarium/03-user-guide.md +224 -0
- package/templates/docs/keysarium/05-architecture.md +181 -0
- package/templates/docs/keysarium/06-user-flows.md +235 -0
- package/templates/lib/background-workers.md +278 -0
- package/templates/lib/dream-engine.md +460 -0
- package/templates/lib/judge-attestation.md +322 -0
- package/templates/lib/memory-protocol.md +239 -0
- package/templates/lib/platform-adapters.md +100 -0
- package/templates/lib/platform-templates/copilot.md +134 -0
- package/templates/lib/platform-templates/cursor.md +95 -0
- package/templates/lib/platform-templates/opencode.md +155 -0
- package/templates/lib/reward-tracker.md +256 -0
- package/templates/lib/witness-chain.md +372 -0
- package/templates/lib/worker-templates/brain-export.md +187 -0
- package/templates/lib/worker-templates/consolidate.md +180 -0
- package/templates/lib/worker-templates/dream-cycle.md +154 -0
- package/templates/lib/worker-templates/health-check.md +255 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Step 6: Implementation Plan
|
|
2
|
+
|
|
3
|
+
> Decompose the feature into ordered, estimable tasks with dependencies.
|
|
4
|
+
|
|
5
|
+
## When
|
|
6
|
+
|
|
7
|
+
Always runs. Adapts depth by tier:
|
|
8
|
+
- **S:** Inline checklist (3-5 items, no file)
|
|
9
|
+
- **M/L/XL:** Full structured plan document
|
|
10
|
+
|
|
11
|
+
## Model
|
|
12
|
+
|
|
13
|
+
sonnet (analytical decomposition)
|
|
14
|
+
|
|
15
|
+
## Input
|
|
16
|
+
|
|
17
|
+
- `{REQUIREMENTS}` from Step 1
|
|
18
|
+
- `{ADR_DECISIONS}` from Step 3 (M+)
|
|
19
|
+
- `{DOMAIN_MODEL}` from Step 4 (L/XL)
|
|
20
|
+
- `{ARCHITECTURE}` from Step 5 (M+)
|
|
21
|
+
|
|
22
|
+
## Protocol
|
|
23
|
+
|
|
24
|
+
### 1. Decompose into Tasks
|
|
25
|
+
|
|
26
|
+
Break the feature into atomic tasks. Each task should be:
|
|
27
|
+
- **Independent** — can be reviewed/tested in isolation
|
|
28
|
+
- **Completable** — produces working code (not half-done)
|
|
29
|
+
- **Testable** — has clear done criteria
|
|
30
|
+
|
|
31
|
+
Task format:
|
|
32
|
+
```
|
|
33
|
+
TASK-{N}: {Title}
|
|
34
|
+
Description: {What to do}
|
|
35
|
+
Files: {Files to create/modify}
|
|
36
|
+
Depends on: TASK-{M} (or none)
|
|
37
|
+
Test: {How to verify it works}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 2. Order by Dependencies
|
|
41
|
+
|
|
42
|
+
Build a dependency graph:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
TASK-1: Create data model
|
|
46
|
+
TASK-2: Create repository (depends: TASK-1)
|
|
47
|
+
TASK-3: Create service (depends: TASK-2)
|
|
48
|
+
TASK-4: Create controller (depends: TASK-3)
|
|
49
|
+
TASK-5: Create tests (depends: TASK-2, TASK-3, TASK-4)
|
|
50
|
+
TASK-6: Create migration (depends: TASK-1)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Rules:
|
|
54
|
+
- Tasks with no dependencies go first
|
|
55
|
+
- Parallel-safe tasks are marked for concurrent execution
|
|
56
|
+
- Tests depend on the code they test (but can be written first — TDD)
|
|
57
|
+
|
|
58
|
+
### 3. Identify Parallel Groups
|
|
59
|
+
|
|
60
|
+
Group tasks that can be worked on simultaneously:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Group 1: TASK-1, TASK-6 (no dependencies, can parallel)
|
|
64
|
+
Group 2: TASK-2, TASK-3 (depend on Group 1)
|
|
65
|
+
Group 3: TASK-4 (depends on Group 2)
|
|
66
|
+
Group 4: TASK-5 (depends on all)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
For L/XL: assign parallel groups to different agents.
|
|
70
|
+
|
|
71
|
+
### 4. Define Checkpoints
|
|
72
|
+
|
|
73
|
+
Insert checkpoints between groups:
|
|
74
|
+
- After data model + migrations → verify schema
|
|
75
|
+
- After services → verify business logic
|
|
76
|
+
- After controllers → verify API contract
|
|
77
|
+
- After tests → verify coverage
|
|
78
|
+
|
|
79
|
+
### 5. Risk Assessment
|
|
80
|
+
|
|
81
|
+
For each group, identify:
|
|
82
|
+
- What could block this task?
|
|
83
|
+
- What's the fallback if approach doesn't work?
|
|
84
|
+
- Does this task have external dependencies (APIs, packages)?
|
|
85
|
+
|
|
86
|
+
## Output
|
|
87
|
+
|
|
88
|
+
### S-tier (inline)
|
|
89
|
+
Inline checklist in conversation:
|
|
90
|
+
```
|
|
91
|
+
Implementation plan:
|
|
92
|
+
- [ ] {task 1}
|
|
93
|
+
- [ ] {task 2}
|
|
94
|
+
- [ ] {task 3}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### M/L/XL
|
|
98
|
+
Create `features/<slug>/06_implementation_plan.md` with:
|
|
99
|
+
- Task list with dependencies
|
|
100
|
+
- Parallel groups
|
|
101
|
+
- Checkpoint schedule
|
|
102
|
+
- Risk assessment (L/XL)
|
|
103
|
+
|
|
104
|
+
Set `{IMPL_PLAN}` variable.
|
|
105
|
+
|
|
106
|
+
## Checkpoint Format
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
═══════════════════════════════════════════════════════
|
|
110
|
+
⏸️ STEP 6/8: Implementation Plan Complete
|
|
111
|
+
<promise>FEATURE_ADR_PLANNED</promise>
|
|
112
|
+
Tier: {COMPLEXITY_TIER}
|
|
113
|
+
|
|
114
|
+
{N} tasks in {M} parallel groups
|
|
115
|
+
Estimated {K} files to create/modify
|
|
116
|
+
|
|
117
|
+
• "ок" — start coding
|
|
118
|
+
• "разбей [TASK-N]" — split task further
|
|
119
|
+
• "объедини [TASK-N, TASK-M]" — merge tasks
|
|
120
|
+
═══════════════════════════════════════════════════════
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Quality Gates
|
|
124
|
+
|
|
125
|
+
- [ ] Every task has clear done criteria
|
|
126
|
+
- [ ] Dependencies form a valid DAG (no cycles)
|
|
127
|
+
- [ ] Parallel groups correctly identified
|
|
128
|
+
- [ ] Each task touches identifiable files
|
|
129
|
+
- [ ] Total file count matches complexity tier expectation
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Step 7: Code Generation
|
|
2
|
+
|
|
3
|
+
> Implement the feature according to the plan, following existing patterns.
|
|
4
|
+
|
|
5
|
+
## When
|
|
6
|
+
|
|
7
|
+
Always runs. Adapts by tier:
|
|
8
|
+
- **S:** Single-pass implementation
|
|
9
|
+
- **M:** Sequential task execution with checkpoints
|
|
10
|
+
- **L/XL:** Parallel agents per module/domain
|
|
11
|
+
|
|
12
|
+
## Model
|
|
13
|
+
|
|
14
|
+
opus (complex code generation)
|
|
15
|
+
|
|
16
|
+
## Input
|
|
17
|
+
|
|
18
|
+
- `{IMPL_PLAN}` from Step 6
|
|
19
|
+
- `{ARCHITECTURE}` from Step 5 (M+)
|
|
20
|
+
- `{ADR_DECISIONS}` from Step 3 (M+)
|
|
21
|
+
- `{DOMAIN_MODEL}` from Step 4 (L/XL)
|
|
22
|
+
- Codebase context (existing patterns, conventions)
|
|
23
|
+
|
|
24
|
+
## Protocol
|
|
25
|
+
|
|
26
|
+
### 1. Pre-Implementation Checklist
|
|
27
|
+
|
|
28
|
+
Before writing any code:
|
|
29
|
+
- [ ] Read existing similar implementations in codebase
|
|
30
|
+
- [ ] Identify naming conventions (files, classes, functions, variables)
|
|
31
|
+
- [ ] Identify import patterns and module structure
|
|
32
|
+
- [ ] Identify error handling patterns
|
|
33
|
+
- [ ] Identify test patterns
|
|
34
|
+
|
|
35
|
+
### 2. Execute Tasks per Plan
|
|
36
|
+
|
|
37
|
+
For each task in `{IMPL_PLAN}`:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
1. Read existing files that will be modified
|
|
41
|
+
2. Implement the change following existing patterns
|
|
42
|
+
3. Verify: does it match the architecture diagram?
|
|
43
|
+
4. Verify: does it follow ADR decisions?
|
|
44
|
+
5. Mark task complete
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 3. Parallel Execution (L/XL)
|
|
48
|
+
|
|
49
|
+
For L/XL tiers with independent modules:
|
|
50
|
+
|
|
51
|
+
| Agent | Scope | Model |
|
|
52
|
+
|-------|-------|-------|
|
|
53
|
+
| Agent 1 | Module A (data layer) | opus |
|
|
54
|
+
| Agent 2 | Module B (service layer) | opus |
|
|
55
|
+
| Agent 3 | Module C (API layer) | opus |
|
|
56
|
+
|
|
57
|
+
Each agent:
|
|
58
|
+
- Works only on its assigned files
|
|
59
|
+
- Follows the same pre-implementation checklist
|
|
60
|
+
- Reports completion with list of created/modified files
|
|
61
|
+
|
|
62
|
+
After all agents complete:
|
|
63
|
+
- Verify integration points between modules
|
|
64
|
+
- Fix any interface mismatches
|
|
65
|
+
- Run existing tests to check for regressions
|
|
66
|
+
|
|
67
|
+
### 4. Code Quality Rules
|
|
68
|
+
|
|
69
|
+
While implementing:
|
|
70
|
+
|
|
71
|
+
| Rule | Rationale |
|
|
72
|
+
|------|-----------|
|
|
73
|
+
| Follow existing patterns | Consistency > "better" approaches |
|
|
74
|
+
| No over-engineering | Implement exactly what's planned |
|
|
75
|
+
| No premature abstraction | 3 similar lines > 1 premature helper |
|
|
76
|
+
| Handle errors at boundaries | Don't add internal error handling noise |
|
|
77
|
+
| Write self-documenting code | Clear names > comments |
|
|
78
|
+
| Respect ADR decisions | Don't deviate from chosen options |
|
|
79
|
+
|
|
80
|
+
### 5. Change Manifest
|
|
81
|
+
|
|
82
|
+
Track all changes:
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
## Files Created
|
|
86
|
+
- path/to/new/file.ts — {description}
|
|
87
|
+
|
|
88
|
+
## Files Modified
|
|
89
|
+
- path/to/existing/file.ts — {what changed}
|
|
90
|
+
|
|
91
|
+
## Files Deleted
|
|
92
|
+
- path/to/removed/file.ts — {why}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Output
|
|
96
|
+
|
|
97
|
+
- Actual code changes in the repository
|
|
98
|
+
- `features/<slug>/07_code_changes/change_manifest.md` — list of all changes
|
|
99
|
+
|
|
100
|
+
Set `{CODE_CHANGES}` variable with file list.
|
|
101
|
+
|
|
102
|
+
## Checkpoint Format
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
═══════════════════════════════════════════════════════
|
|
106
|
+
⏸️ STEP 7/8: Code Implementation Complete
|
|
107
|
+
<promise>FEATURE_ADR_IMPLEMENTED</promise>
|
|
108
|
+
Tier: {COMPLEXITY_TIER}
|
|
109
|
+
|
|
110
|
+
{N} files created, {M} modified, {K} deleted
|
|
111
|
+
Tasks completed: {completed}/{total}
|
|
112
|
+
|
|
113
|
+
• "ок" — proceed to QE
|
|
114
|
+
• "ревью [file]" — review specific file
|
|
115
|
+
• "переделай [task]" — redo specific task
|
|
116
|
+
═══════════════════════════════════════════════════════
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Quality Gates
|
|
120
|
+
|
|
121
|
+
- [ ] All planned tasks implemented
|
|
122
|
+
- [ ] Code follows existing codebase conventions
|
|
123
|
+
- [ ] ADR decisions reflected in code
|
|
124
|
+
- [ ] No unintended side effects on existing functionality
|
|
125
|
+
- [ ] Change manifest is complete and accurate
|
|
126
|
+
- [ ] No TODO/FIXME/HACK left without justification
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Step 8: Quality Engineering
|
|
2
|
+
|
|
3
|
+
> Verify the implementation through testing, review, and validation.
|
|
4
|
+
|
|
5
|
+
## When
|
|
6
|
+
|
|
7
|
+
Always runs. Adapts depth by tier:
|
|
8
|
+
- **S:** Smoke test — compile + existing tests pass
|
|
9
|
+
- **M:** Unit tests + basic code review
|
|
10
|
+
- **L:** Unit + integration tests + thorough review
|
|
11
|
+
- **XL:** Full QE — unit + integration + e2e + security + performance review
|
|
12
|
+
|
|
13
|
+
## Model
|
|
14
|
+
|
|
15
|
+
sonnet (analytical evaluation)
|
|
16
|
+
|
|
17
|
+
## Input
|
|
18
|
+
|
|
19
|
+
- `{CODE_CHANGES}` from Step 7
|
|
20
|
+
- `{REQUIREMENTS}` from Step 1 (for acceptance criteria)
|
|
21
|
+
- `{ARCHITECTURE}` from Step 5 (for structural validation)
|
|
22
|
+
- `{IMPL_PLAN}` from Step 6 (for completeness check)
|
|
23
|
+
|
|
24
|
+
## Protocol
|
|
25
|
+
|
|
26
|
+
### 1. Smoke Tests (All tiers)
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
- [ ] Code compiles / no syntax errors
|
|
30
|
+
- [ ] Existing test suite passes (no regressions)
|
|
31
|
+
- [ ] Linter passes (if configured)
|
|
32
|
+
- [ ] Type checker passes (if configured)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
For S-tier: if all pass, proceed to checkpoint. Done.
|
|
36
|
+
|
|
37
|
+
### 2. Test Generation (M+)
|
|
38
|
+
|
|
39
|
+
#### Unit Tests
|
|
40
|
+
For each new/modified module:
|
|
41
|
+
- Test happy path
|
|
42
|
+
- Test edge cases (null, empty, boundary values)
|
|
43
|
+
- Test error paths
|
|
44
|
+
- Follow existing test patterns in codebase
|
|
45
|
+
|
|
46
|
+
#### Integration Tests (L/XL)
|
|
47
|
+
For each integration point:
|
|
48
|
+
- Test API endpoints with real request/response cycle
|
|
49
|
+
- Test database operations with test database
|
|
50
|
+
- Test message queue interactions
|
|
51
|
+
- Test external service mocks
|
|
52
|
+
|
|
53
|
+
#### E2E Tests (XL only)
|
|
54
|
+
For critical user flows:
|
|
55
|
+
- Test complete user journey end-to-end
|
|
56
|
+
- Test with realistic data volumes
|
|
57
|
+
- Test failure recovery scenarios
|
|
58
|
+
|
|
59
|
+
### 3. Code Review (M+)
|
|
60
|
+
|
|
61
|
+
Adapted from agentic-qe brutal-honesty-review protocol:
|
|
62
|
+
|
|
63
|
+
#### Review Dimensions
|
|
64
|
+
|
|
65
|
+
| Dimension | Weight | Questions |
|
|
66
|
+
|-----------|--------|-----------|
|
|
67
|
+
| **Correctness** | 30% | Does it do what requirements say? Edge cases handled? |
|
|
68
|
+
| **Security** | 20% | Injection risks? Auth bypasses? Data exposure? |
|
|
69
|
+
| **Maintainability** | 20% | Readable? Follows patterns? Future-proof? |
|
|
70
|
+
| **Performance** | 15% | N+1 queries? Unnecessary allocations? Missing indexes? |
|
|
71
|
+
| **Consistency** | 15% | Matches codebase conventions? Naming consistent? |
|
|
72
|
+
|
|
73
|
+
#### Review Process
|
|
74
|
+
|
|
75
|
+
1. **Read every changed file** completely
|
|
76
|
+
2. **Check against requirements** — is anything missing or extra?
|
|
77
|
+
3. **Check against ADR decisions** — does code match chosen approach?
|
|
78
|
+
4. **Check against architecture** — do components match diagrams?
|
|
79
|
+
5. **Flag issues** with severity:
|
|
80
|
+
- 🔴 **BLOCKER** — must fix before merge
|
|
81
|
+
- 🟡 **WARNING** — should fix, but not blocking
|
|
82
|
+
- 🔵 **SUGGESTION** — nice to have improvement
|
|
83
|
+
|
|
84
|
+
### 4. Multi-Agent Review Panel (XL only)
|
|
85
|
+
|
|
86
|
+
For XL features, spawn 3 parallel review agents:
|
|
87
|
+
|
|
88
|
+
| Agent | Role | Model | Focus |
|
|
89
|
+
|-------|------|-------|-------|
|
|
90
|
+
| Agent 1 | Correctness Reviewer | sonnet | Requirements coverage, logic errors |
|
|
91
|
+
| Agent 2 | Security Reviewer | sonnet | OWASP top 10, auth, data exposure |
|
|
92
|
+
| Agent 3 | Architecture Reviewer | sonnet | Pattern compliance, ADR adherence |
|
|
93
|
+
|
|
94
|
+
Each agent produces independent findings. Synthesize into single report.
|
|
95
|
+
|
|
96
|
+
### 5. Acceptance Criteria Validation
|
|
97
|
+
|
|
98
|
+
For each requirement from Step 1:
|
|
99
|
+
```
|
|
100
|
+
FR-{N}: {requirement}
|
|
101
|
+
Status: ✅ PASS | ❌ FAIL | ⚠️ PARTIAL
|
|
102
|
+
Evidence: {how it was verified}
|
|
103
|
+
Test: {test name or manual verification}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 6. QE Report
|
|
107
|
+
|
|
108
|
+
Compile all findings into a structured report:
|
|
109
|
+
|
|
110
|
+
```markdown
|
|
111
|
+
# QE Report: {feature name}
|
|
112
|
+
|
|
113
|
+
## Summary
|
|
114
|
+
- Tests: {passed}/{total} ({percentage}%)
|
|
115
|
+
- Review findings: {blockers} 🔴 {warnings} 🟡 {suggestions} 🔵
|
|
116
|
+
- Requirements coverage: {covered}/{total} ({percentage}%)
|
|
117
|
+
|
|
118
|
+
## Test Results
|
|
119
|
+
### Unit Tests
|
|
120
|
+
{details}
|
|
121
|
+
|
|
122
|
+
### Integration Tests (L/XL)
|
|
123
|
+
{details}
|
|
124
|
+
|
|
125
|
+
## Review Findings
|
|
126
|
+
{list of findings with severity}
|
|
127
|
+
|
|
128
|
+
## Acceptance Criteria
|
|
129
|
+
{FR-N status table}
|
|
130
|
+
|
|
131
|
+
## Verdict
|
|
132
|
+
✅ READY FOR MERGE | ❌ NEEDS FIXES | ⚠️ CONDITIONAL APPROVAL
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Output
|
|
136
|
+
|
|
137
|
+
Create `features/<slug>/08_qe_report.md` with full QE report.
|
|
138
|
+
|
|
139
|
+
Set `{QE_RESULTS}` variable.
|
|
140
|
+
|
|
141
|
+
## Checkpoint Format
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
═══════════════════════════════════════════════════════
|
|
145
|
+
⏸️ STEP 8/8: Quality Engineering Complete
|
|
146
|
+
<promise>FEATURE_ADR_VERIFIED</promise>
|
|
147
|
+
Tier: {COMPLEXITY_TIER}
|
|
148
|
+
|
|
149
|
+
Tests: {passed}/{total} ✅
|
|
150
|
+
Review: {blockers} blockers, {warnings} warnings
|
|
151
|
+
Requirements: {covered}/{total} covered
|
|
152
|
+
|
|
153
|
+
Verdict: {READY | NEEDS FIXES | CONDITIONAL}
|
|
154
|
+
|
|
155
|
+
• "ок" — feature complete!
|
|
156
|
+
• "исправь [finding]" — fix specific issue
|
|
157
|
+
• "повтори QE" — re-run full QE
|
|
158
|
+
═══════════════════════════════════════════════════════
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Quality Gates
|
|
162
|
+
|
|
163
|
+
- [ ] All smoke tests pass
|
|
164
|
+
- [ ] No 🔴 BLOCKER findings remain
|
|
165
|
+
- [ ] All MUST requirements have ✅ PASS status
|
|
166
|
+
- [ ] Test coverage adequate for tier (S: smoke, M: unit, L: unit+integration, XL: full)
|
|
167
|
+
- [ ] QE report created and complete
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# ADR Template
|
|
2
|
+
|
|
3
|
+
Use this template for every Architecture Decision Record.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
# ADR-{NNN}: {Short Title of Decision}
|
|
9
|
+
|
|
10
|
+
## Status
|
|
11
|
+
|
|
12
|
+
{Proposed | Accepted | Deprecated | Superseded by ADR-{M}}
|
|
13
|
+
|
|
14
|
+
## Date
|
|
15
|
+
|
|
16
|
+
{YYYY-MM-DD}
|
|
17
|
+
|
|
18
|
+
## Context
|
|
19
|
+
|
|
20
|
+
{What is the issue that we're seeing that is motivating this decision or change?
|
|
21
|
+
Describe the forces at play — technical, business, political, social.
|
|
22
|
+
Describe the problem space, not the solution.}
|
|
23
|
+
|
|
24
|
+
## Decision Drivers
|
|
25
|
+
|
|
26
|
+
- {driver 1: e.g., "Team has no experience with technology X"}
|
|
27
|
+
- {driver 2: e.g., "Feature requires sub-100ms latency"}
|
|
28
|
+
- {driver 3: e.g., "Must integrate with existing auth system"}
|
|
29
|
+
|
|
30
|
+
## Considered Options
|
|
31
|
+
|
|
32
|
+
### Option 1: {Name}
|
|
33
|
+
|
|
34
|
+
{1-2 paragraph description of this option}
|
|
35
|
+
|
|
36
|
+
- ✅ {Pro 1}
|
|
37
|
+
- ✅ {Pro 2}
|
|
38
|
+
- ❌ {Con 1}
|
|
39
|
+
- ❌ {Con 2}
|
|
40
|
+
|
|
41
|
+
### Option 2: {Name}
|
|
42
|
+
|
|
43
|
+
{1-2 paragraph description}
|
|
44
|
+
|
|
45
|
+
- ✅ {Pro 1}
|
|
46
|
+
- ❌ {Con 1}
|
|
47
|
+
|
|
48
|
+
### Option 3: {Name} (optional)
|
|
49
|
+
|
|
50
|
+
{1-2 paragraph description}
|
|
51
|
+
|
|
52
|
+
- ✅ {Pro 1}
|
|
53
|
+
- ❌ {Con 1}
|
|
54
|
+
|
|
55
|
+
## Decision Matrix
|
|
56
|
+
|
|
57
|
+
| Criterion | Weight | Option 1 | Option 2 | Option 3 |
|
|
58
|
+
|-----------|--------|----------|----------|----------|
|
|
59
|
+
| {Criterion 1} | {1-5} | {1-5} | {1-5} | {1-5} |
|
|
60
|
+
| {Criterion 2} | {1-5} | {1-5} | {1-5} | {1-5} |
|
|
61
|
+
| {Criterion 3} | {1-5} | {1-5} | {1-5} | {1-5} |
|
|
62
|
+
| **Weighted Total** | | **{sum}** | **{sum}** | **{sum}** |
|
|
63
|
+
|
|
64
|
+
## Decision
|
|
65
|
+
|
|
66
|
+
We chose **{Option N}** because {1-2 sentence rationale linking back to decision drivers}.
|
|
67
|
+
|
|
68
|
+
## Consequences
|
|
69
|
+
|
|
70
|
+
### Positive
|
|
71
|
+
- {Positive consequence 1}
|
|
72
|
+
- {Positive consequence 2}
|
|
73
|
+
|
|
74
|
+
### Negative
|
|
75
|
+
- {Negative consequence 1 — with mitigation strategy}
|
|
76
|
+
|
|
77
|
+
### Risks
|
|
78
|
+
- {Risk 1} — Mitigation: {how to mitigate}
|
|
79
|
+
- {Risk 2} — Mitigation: {how to mitigate}
|
|
80
|
+
|
|
81
|
+
## Links
|
|
82
|
+
|
|
83
|
+
- Requirement: FR-{N}
|
|
84
|
+
- Related: ADR-{M} (if any)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## ADR Numbering
|
|
90
|
+
|
|
91
|
+
- Start from 001 for each feature
|
|
92
|
+
- Use kebab-case slugs: `001-choose-database-engine.md`
|
|
93
|
+
- Keep sequential within a feature, no gaps
|
|
94
|
+
|
|
95
|
+
## ADR Quality Checklist
|
|
96
|
+
|
|
97
|
+
- [ ] At least 2 options considered
|
|
98
|
+
- [ ] Every option has both pros and cons
|
|
99
|
+
- [ ] Decision matrix used for non-trivial decisions
|
|
100
|
+
- [ ] Consequences include both positive AND negative
|
|
101
|
+
- [ ] Risks have mitigation strategies
|
|
102
|
+
- [ ] Links to requirements present
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# C4 Diagram Templates
|
|
2
|
+
|
|
3
|
+
Reference templates for C4 architecture diagrams in Mermaid format.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Level 1: System Context
|
|
8
|
+
|
|
9
|
+
```mermaid
|
|
10
|
+
graph TB
|
|
11
|
+
%% Actors
|
|
12
|
+
User["👤 User<br/><i>Description of user</i>"]
|
|
13
|
+
Admin["👤 Admin<br/><i>Description of admin</i>"]
|
|
14
|
+
|
|
15
|
+
%% System
|
|
16
|
+
System["🖥️ Our System<br/><i>What it does</i>"]
|
|
17
|
+
|
|
18
|
+
%% External Systems
|
|
19
|
+
ExtAuth["🔐 Auth Provider<br/><i>OAuth 2.0</i>"]
|
|
20
|
+
ExtPay["💳 Payment Gateway<br/><i>Stripe/etc</i>"]
|
|
21
|
+
ExtEmail["📧 Email Service<br/><i>SendGrid/etc</i>"]
|
|
22
|
+
|
|
23
|
+
%% Relationships
|
|
24
|
+
User -->|"Uses"| System
|
|
25
|
+
Admin -->|"Manages"| System
|
|
26
|
+
System -->|"Authenticates via"| ExtAuth
|
|
27
|
+
System -->|"Processes payments via"| ExtPay
|
|
28
|
+
System -->|"Sends emails via"| ExtEmail
|
|
29
|
+
|
|
30
|
+
%% Styling
|
|
31
|
+
classDef system fill:#1168bd,stroke:#0b4884,color:#fff
|
|
32
|
+
classDef external fill:#999,stroke:#666,color:#fff
|
|
33
|
+
classDef person fill:#08427b,stroke:#052e56,color:#fff
|
|
34
|
+
class System system
|
|
35
|
+
class ExtAuth,ExtPay,ExtEmail external
|
|
36
|
+
class User,Admin person
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Level 2: Container
|
|
40
|
+
|
|
41
|
+
```mermaid
|
|
42
|
+
graph TB
|
|
43
|
+
subgraph boundary ["System Boundary"]
|
|
44
|
+
WebApp["🌐 Web Application<br/><i>React / Next.js</i>"]
|
|
45
|
+
API["⚙️ API Server<br/><i>Node.js / Express</i>"]
|
|
46
|
+
Worker["🔄 Background Worker<br/><i>Bull / Agenda</i>"]
|
|
47
|
+
DB[("💾 Database<br/><i>PostgreSQL</i>")]
|
|
48
|
+
Cache[("⚡ Cache<br/><i>Redis</i>")]
|
|
49
|
+
Queue["📬 Message Queue<br/><i>Redis / RabbitMQ</i>"]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
User["👤 User"] -->|"HTTPS"| WebApp
|
|
53
|
+
WebApp -->|"REST/GraphQL"| API
|
|
54
|
+
API -->|"SQL"| DB
|
|
55
|
+
API -->|"Read/Write"| Cache
|
|
56
|
+
API -->|"Publish"| Queue
|
|
57
|
+
Queue -->|"Consume"| Worker
|
|
58
|
+
Worker -->|"SQL"| DB
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Level 3: Component
|
|
62
|
+
|
|
63
|
+
```mermaid
|
|
64
|
+
graph TB
|
|
65
|
+
subgraph container ["API Server"]
|
|
66
|
+
Router["🔀 Router<br/><i>Express Router</i>"]
|
|
67
|
+
AuthMW["🔐 Auth Middleware<br/><i>JWT validation</i>"]
|
|
68
|
+
Controller["📋 Controller<br/><i>Request handling</i>"]
|
|
69
|
+
Validator["✅ Validator<br/><i>Input validation</i>"]
|
|
70
|
+
Service["⚙️ Service<br/><i>Business logic</i>"]
|
|
71
|
+
Repository["💾 Repository<br/><i>Data access</i>"]
|
|
72
|
+
EventBus["📡 Event Bus<br/><i>Domain events</i>"]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
Router --> AuthMW
|
|
76
|
+
AuthMW --> Controller
|
|
77
|
+
Controller --> Validator
|
|
78
|
+
Controller --> Service
|
|
79
|
+
Service --> Repository
|
|
80
|
+
Service --> EventBus
|
|
81
|
+
Repository --> DB[("Database")]
|
|
82
|
+
EventBus --> Queue["Message Queue"]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Sequence Diagram Template
|
|
86
|
+
|
|
87
|
+
```mermaid
|
|
88
|
+
sequenceDiagram
|
|
89
|
+
actor User
|
|
90
|
+
participant FE as Frontend
|
|
91
|
+
participant API as API Server
|
|
92
|
+
participant Auth as Auth Service
|
|
93
|
+
participant DB as Database
|
|
94
|
+
participant Queue as Message Queue
|
|
95
|
+
|
|
96
|
+
User->>FE: Action
|
|
97
|
+
FE->>API: POST /api/resource
|
|
98
|
+
API->>Auth: Validate token
|
|
99
|
+
Auth-->>API: Valid
|
|
100
|
+
|
|
101
|
+
API->>API: Validate input
|
|
102
|
+
API->>DB: INSERT INTO resource
|
|
103
|
+
DB-->>API: Created
|
|
104
|
+
|
|
105
|
+
API->>Queue: Publish event
|
|
106
|
+
API-->>FE: 201 Created
|
|
107
|
+
FE-->>User: Success feedback
|
|
108
|
+
|
|
109
|
+
Note over Queue: Async processing
|
|
110
|
+
Queue->>Worker: Process event
|
|
111
|
+
Worker->>DB: UPDATE status
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Tips
|
|
115
|
+
|
|
116
|
+
1. **Keep diagrams focused** — one concept per diagram
|
|
117
|
+
2. **Use consistent naming** — match code namespaces
|
|
118
|
+
3. **Show data flow direction** — arrows point from caller to callee
|
|
119
|
+
4. **Label relationships** — what protocol/format
|
|
120
|
+
5. **Highlight the new** — mark new components vs existing
|