moicle 1.3.0 → 1.4.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 +2 -1
- package/assets/architecture/ddd-architecture.md +337 -0
- package/assets/architecture/go-backend.md +770 -693
- package/assets/architecture/laravel-backend.md +388 -156
- package/assets/skills/architect-review/SKILL.md +292 -372
- package/assets/skills/deep-debug/SKILL.md +114 -0
- package/assets/skills/new-feature/SKILL.md +232 -252
- package/assets/skills/refactor/SKILL.md +261 -679
- package/assets/skills/sync-docs/SKILL.md +575 -0
- package/assets/templates/go-gin/CLAUDE.md +671 -121
- package/package.json +1 -1
- package/assets/architecture/clean-architecture.md +0 -143
- package/assets/skills/go-module/SKILL.md +0 -77
- package/assets/skills/ship/SKILL.md +0 -297
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deep-debug
|
|
3
|
+
description: Deep bug investigation workflow for hard-to-trace errors. Systematic root cause analysis — no guessing, no blind fixes. Use when user says "deep debug", "deep-debug", "trace bug", "find root cause", "hard bug", "investigate bug".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deep Bug Investigation Workflow
|
|
7
|
+
|
|
8
|
+
Dành cho bug khó, fix nhiều lần không được. KHÔNG đoán mò — trace từng bước đến root cause.
|
|
9
|
+
|
|
10
|
+
## Step 1: Thu thập evidence
|
|
11
|
+
|
|
12
|
+
Ghi lại chính xác, KHÔNG diễn giải:
|
|
13
|
+
|
|
14
|
+
- Error message nguyên văn
|
|
15
|
+
- Stack trace: file, line number, call chain
|
|
16
|
+
- Environment nào bị (production/staging/local)
|
|
17
|
+
- Lỗi mọi lúc hay chỉ một số case
|
|
18
|
+
|
|
19
|
+
## Step 2: Verify code đang chạy
|
|
20
|
+
|
|
21
|
+
KHÔNG giả định code trên production = code trên local.
|
|
22
|
+
|
|
23
|
+
- Xác định chính xác version/commit đang deploy
|
|
24
|
+
- So sánh với code đang đọc trên local
|
|
25
|
+
- Nếu KHÁC NHAU → đọc đúng version đang deploy trước khi phân tích tiếp
|
|
26
|
+
|
|
27
|
+
## Step 3: Trace execution path
|
|
28
|
+
|
|
29
|
+
Đây là bước quan trọng nhất. Đi từ entry point → đến dòng lỗi. Trace TỪNG bước, KHÔNG nhảy cóc.
|
|
30
|
+
|
|
31
|
+
### 3a. Entry point → Error line
|
|
32
|
+
|
|
33
|
+
- Request/event/job đi vào từ đâu?
|
|
34
|
+
- Function nào gọi function nào? Theo đúng stack trace.
|
|
35
|
+
- Data được truyền qua các layer thế nào?
|
|
36
|
+
|
|
37
|
+
### 3b. Data ở dòng lỗi đến từ đâu?
|
|
38
|
+
|
|
39
|
+
- Biến bị lỗi được tạo/load từ đâu?
|
|
40
|
+
- Load trực tiếp từ source (DB, API) hay từ cache/session?
|
|
41
|
+
- Có qua serialize → unserialize không?
|
|
42
|
+
- Có qua transform/convert nào không?
|
|
43
|
+
|
|
44
|
+
### 3c. Type & state tại thời điểm lỗi
|
|
45
|
+
|
|
46
|
+
- Type thực tế của biến là gì? (string, object, null, enum...)
|
|
47
|
+
- Code expect type gì?
|
|
48
|
+
- Tại sao type thực tế khác type expected?
|
|
49
|
+
|
|
50
|
+
### 3d. Framework internals (khi lỗi trong vendor/library)
|
|
51
|
+
|
|
52
|
+
- Đọc source code tại ĐÚNG line number từ stack trace
|
|
53
|
+
- Trace ngược: ai gọi method đó, với argument gì
|
|
54
|
+
- Điều kiện nào khiến code đi vào branch gây lỗi
|
|
55
|
+
|
|
56
|
+
## Step 4: Tìm root cause — Trả lời 3 câu
|
|
57
|
+
|
|
58
|
+
1. **Tại sao lỗi?** — Nguyên nhân kỹ thuật cụ thể
|
|
59
|
+
2. **Tại sao trước đây không lỗi?** — Cái gì thay đổi
|
|
60
|
+
3. **Điều kiện reproduce?** — Khi nào lỗi, khi nào không
|
|
61
|
+
|
|
62
|
+
Nếu chưa trả lời được cả 3 → quay lại Step 3, trace thêm.
|
|
63
|
+
|
|
64
|
+
## Step 5: Check các nguồn state ẩn
|
|
65
|
+
|
|
66
|
+
Bug "lúc được lúc không" thường do state ẩn. Check theo thứ tự:
|
|
67
|
+
|
|
68
|
+
### Cache / Serialization
|
|
69
|
+
|
|
70
|
+
- Object lấy từ cache có mất internal state không? (transient fields, lazy-loaded properties, runtime caches)
|
|
71
|
+
- Cache cũ chứa data format cũ, code mới expect format mới?
|
|
72
|
+
- Serialize/unserialize có thay đổi type không? (int↔float, null handling, enum↔string)
|
|
73
|
+
|
|
74
|
+
### Database / Storage
|
|
75
|
+
|
|
76
|
+
- Collation, encoding có ảnh hưởng comparison không?
|
|
77
|
+
- Default value trong DB có match code expectation không?
|
|
78
|
+
- Schema đã update trên production chưa?
|
|
79
|
+
|
|
80
|
+
### Runtime cache / Compiled cache
|
|
81
|
+
|
|
82
|
+
- Có compiled/cached config, routes, views chưa clear?
|
|
83
|
+
- Bytecode cache (OPcache, compiled assets) có serve file cũ?
|
|
84
|
+
- CDN/proxy cache serve asset cũ?
|
|
85
|
+
|
|
86
|
+
### Environment
|
|
87
|
+
|
|
88
|
+
- Env vars trên production có đúng/đủ không?
|
|
89
|
+
- Version runtime (PHP, Node, Go, Python, etc.) có khác local không?
|
|
90
|
+
- Dependency version có khác không?
|
|
91
|
+
|
|
92
|
+
## Step 6: Fix
|
|
93
|
+
|
|
94
|
+
Chỉ fix khi đã trả lời được 3 câu ở Step 4. Fix phải:
|
|
95
|
+
|
|
96
|
+
- Xử lý đúng root cause, không phải symptom
|
|
97
|
+
- Handle edge case đã phát hiện (cache stale, type mismatch)
|
|
98
|
+
- Defensive ở data boundary (cache, DB, external API) — không ở internal logic
|
|
99
|
+
- Không phá code path bình thường để fix edge case
|
|
100
|
+
|
|
101
|
+
## Step 7: Verify
|
|
102
|
+
|
|
103
|
+
- Reproduce điều kiện lỗi từ Step 4 → confirm đã fix
|
|
104
|
+
- Test code path bình thường vẫn hoạt động
|
|
105
|
+
- Nếu liên quan cache → test cả fresh load lẫn cached load
|
|
106
|
+
- Verify đúng version đã deploy (lặp lại Step 2)
|
|
107
|
+
|
|
108
|
+
## IMPORTANT
|
|
109
|
+
|
|
110
|
+
- **KHÔNG ĐOÁN MÒ** — Trace evidence, không suy luận từ tên biến hay "có lẽ là..."
|
|
111
|
+
- **KHÔNG FIX TRƯỚC KHI HIỂU** — Fix mà không hiểu root cause = tạo bug mới
|
|
112
|
+
- **VERIFY DEPLOYED CODE** — Luôn check version đang chạy, không giả định production = local
|
|
113
|
+
- **CHECK CACHE TRƯỚC** — Phần lớn bug "lúc được lúc không" là do stale cached state
|
|
114
|
+
- **MỘT ROOT CAUSE** — Mỗi bug chỉ có 1 root cause. Nếu còn nhiều khả năng → trace thêm
|
|
@@ -1,317 +1,297 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: new-feature
|
|
3
|
-
description:
|
|
3
|
+
description: DDD feature development workflow with phase-based checks and review loop. Use when implementing new features, building functionality, or when user says "implement feature", "add feature", "build feature", "create feature", "new feature".
|
|
4
|
+
args: "[DOMAIN] [FEATURE]"
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# Feature Development Workflow
|
|
7
|
+
# DDD Feature Development Workflow
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
Build a new feature following DDD architecture, with automated checks after each phase and a review loop that keeps fixing until all checks pass.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
**ARGUMENTS:** `<domain> <feature>` — e.g., `wallet savings`, `notification broadcast`, `catalog products`
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
## Read Architecture First
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
~/.claude/architecture/
|
|
17
|
-
├── clean-architecture.md # Core principles for all projects
|
|
18
|
-
├── flutter-mobile.md # Flutter + Riverpod
|
|
19
|
-
├── react-frontend.md # React + Vite + TypeScript
|
|
20
|
-
├── go-backend.md # Go + Gin
|
|
21
|
-
├── laravel-backend.md # Laravel + PHP
|
|
22
|
-
├── remix-fullstack.md # Remix fullstack
|
|
23
|
-
└── monorepo.md # Monorepo structure
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Project-specific (if exists)
|
|
27
|
-
```
|
|
28
|
-
.claude/architecture/ # Project overrides
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
**Follow the structure and patterns defined in these files exactly.**
|
|
15
|
+
**Before starting, MUST read TWO files:**
|
|
32
16
|
|
|
33
|
-
|
|
17
|
+
1. **Core DDD spec**: `.claude/architecture/ddd-architecture.md`
|
|
18
|
+
2. **Stack-specific doc**: detect stack → read the corresponding architecture doc
|
|
34
19
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
| REVIEW | `@perf-optimizer` | Performance optimization |
|
|
44
|
-
| TEST | `@test-writer` | Unit/integration/e2e tests |
|
|
45
|
-
| COMPLETE | `@docs-writer` | Documentation (if needed) |
|
|
46
|
-
|
|
47
|
-
## Workflow Overview
|
|
20
|
+
### Stack Detection
|
|
21
|
+
| File | Stack Doc |
|
|
22
|
+
|------|-----------|
|
|
23
|
+
| `go.mod` | `go-backend.md` |
|
|
24
|
+
| `package.json` + `vite.config.*` | `react-frontend.md` |
|
|
25
|
+
| `pubspec.yaml` | `flutter-mobile.md` |
|
|
26
|
+
| `composer.json` | `laravel-backend.md` |
|
|
27
|
+
| `remix.config.*` | `remix-fullstack.md` |
|
|
48
28
|
|
|
29
|
+
### Architecture Files Location
|
|
49
30
|
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
└──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘
|
|
53
|
-
│ │
|
|
54
|
-
└──────◀───────┘
|
|
55
|
-
Feedback Loop
|
|
31
|
+
.claude/architecture/{name}.md # Project-specific (priority)
|
|
32
|
+
~/.claude/architecture/{name}.md # Global
|
|
56
33
|
```
|
|
57
34
|
|
|
58
35
|
---
|
|
59
36
|
|
|
60
|
-
##
|
|
61
|
-
|
|
62
|
-
**Goal**: Understand requirements and break down into tasks
|
|
63
|
-
|
|
64
|
-
### Actions
|
|
65
|
-
1. Clarify requirements with user
|
|
66
|
-
2. **Identify project stack** (Flutter, React, Go, Laravel, Remix, etc.)
|
|
67
|
-
3. **Read the appropriate architecture doc** for this stack
|
|
68
|
-
4. Identify affected files/modules based on architecture
|
|
69
|
-
5. List acceptance criteria
|
|
70
|
-
6. Create task breakdown using TodoWrite
|
|
71
|
-
|
|
72
|
-
### Output
|
|
73
|
-
```markdown
|
|
74
|
-
## Feature: [Name]
|
|
75
|
-
|
|
76
|
-
### Stack & Architecture
|
|
77
|
-
- Stack: [Flutter/React/Go/Laravel/Remix]
|
|
78
|
-
- Architecture Doc: [path to architecture file]
|
|
79
|
-
|
|
80
|
-
### Requirements
|
|
81
|
-
- [ ] Requirement 1
|
|
82
|
-
- [ ] Requirement 2
|
|
37
|
+
## Workflow
|
|
83
38
|
|
|
84
|
-
### Affected Areas (based on architecture)
|
|
85
|
-
- [Layer/Module 1]
|
|
86
|
-
- [Layer/Module 2]
|
|
87
|
-
|
|
88
|
-
### Tasks
|
|
89
|
-
1. Task 1
|
|
90
|
-
2. Task 2
|
|
91
39
|
```
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
40
|
+
PHASE 1: Analyze & Plan
|
|
41
|
+
→ PHASE 2: Build Domain Layer
|
|
42
|
+
→ PHASE 3: Build Infrastructure Layer
|
|
43
|
+
→ PHASE 4: Build Application Layer
|
|
44
|
+
→ PHASE 5: Registration & Wiring
|
|
45
|
+
→ PHASE 6: Domain Tests
|
|
46
|
+
→ REVIEW LOOP (run /architect-review, fix issues, repeat until clean)
|
|
47
|
+
```
|
|
98
48
|
|
|
99
49
|
---
|
|
100
50
|
|
|
101
|
-
##
|
|
51
|
+
## PHASE 1: Analyze & Plan
|
|
52
|
+
|
|
53
|
+
### 1.1 Read Architecture Docs
|
|
54
|
+
1. Read `ddd-architecture.md` (core DDD rules)
|
|
55
|
+
2. Read stack-specific architecture doc
|
|
56
|
+
3. Extract: DDD directory structure, layer rules, hard rules, forbidden imports, check scripts
|
|
57
|
+
|
|
58
|
+
### 1.2 Read Reference Module
|
|
59
|
+
Pick a SMALL existing module in the project as reference. Read ALL its files to understand exact patterns:
|
|
60
|
+
- Entities, value objects, events, ports, usecases
|
|
61
|
+
- Service, handler, DTOs, listeners
|
|
62
|
+
- Infrastructure store/API implementations
|
|
63
|
+
- Registration in router/provider/registry
|
|
64
|
+
|
|
65
|
+
### 1.3 Plan Feature
|
|
66
|
+
Present to user:
|
|
67
|
+
- All entities and their fields
|
|
68
|
+
- All endpoints/screens/UI (depending on stack)
|
|
69
|
+
- All domain events
|
|
70
|
+
- All value objects
|
|
71
|
+
- Business rules summary
|
|
72
|
+
- Files to create/modify
|
|
73
|
+
|
|
74
|
+
### Rule Check Phase 1
|
|
75
|
+
- [ ] Architecture docs read and understood
|
|
76
|
+
- [ ] Reference module read
|
|
77
|
+
- [ ] Plan presented and **user CONFIRMED** before continuing
|
|
102
78
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
### Actions
|
|
106
|
-
1. **Re-read architecture doc** for the specific stack
|
|
107
|
-
2. Apply architecture principles from the doc:
|
|
108
|
-
- Identify which layers are affected
|
|
109
|
-
- Define components for each layer
|
|
110
|
-
- Follow naming conventions from doc
|
|
79
|
+
---
|
|
111
80
|
|
|
112
|
-
|
|
81
|
+
## PHASE 2: Build Domain Layer
|
|
82
|
+
|
|
83
|
+
Create in order: value objects → entities → events → ports → usecases
|
|
84
|
+
|
|
85
|
+
### 2.1 Value Objects (`valueobjects/`)
|
|
86
|
+
- Typed values with behavior methods
|
|
87
|
+
- Status with `IsTerminal()`, `CanTransitionTo()`
|
|
88
|
+
- **Only stdlib imports** — read Forbidden Imports from architecture doc
|
|
89
|
+
|
|
90
|
+
### 2.2 Entities (`entities/`)
|
|
91
|
+
- Constructor function/method
|
|
92
|
+
- Behavior methods that raise events (state transitions, calculations)
|
|
93
|
+
- Guard methods (isActive, canXxx)
|
|
94
|
+
- Business error types
|
|
95
|
+
- Only imports: stdlib + valueobjects + domain/shared
|
|
96
|
+
|
|
97
|
+
### 2.3 Events (`events/`)
|
|
98
|
+
- One file per event
|
|
99
|
+
- Extend/embed base event type
|
|
100
|
+
- Carry data needed by listeners (userID, amounts, names)
|
|
101
|
+
|
|
102
|
+
### 2.4 Ports (`ports/`)
|
|
103
|
+
- One file per interface
|
|
104
|
+
- Store interfaces use domain entity types and value objects
|
|
105
|
+
- DTOs for complex query results live here
|
|
106
|
+
- No infrastructure imports
|
|
107
|
+
|
|
108
|
+
### 2.5 UseCases (`usecases/`)
|
|
109
|
+
- Constructor with port dependencies + event dispatcher
|
|
110
|
+
- Split by concern: one file per action group
|
|
111
|
+
- Business logic lives HERE
|
|
112
|
+
- Dispatch entity events after successful save
|
|
113
|
+
- **No infrastructure imports** — read Forbidden Imports from architecture doc
|
|
114
|
+
|
|
115
|
+
### Rule Check Phase 2
|
|
116
|
+
Run the **Domain Purity** check scripts from the stack architecture doc:
|
|
117
|
+
```bash
|
|
118
|
+
# Example (Go):
|
|
119
|
+
go build ./internal/domain/$DOMAIN/... && echo "PASS" || echo "FAIL"
|
|
120
|
+
go vet ./internal/domain/$DOMAIN/... && echo "PASS" || echo "FAIL"
|
|
121
|
+
grep -rn {forbidden_imports} internal/domain/$DOMAIN/ && echo "FAIL" || echo "PASS"
|
|
122
|
+
|
|
123
|
+
# Example (React):
|
|
124
|
+
npx tsc --noEmit && echo "PASS" || echo "FAIL"
|
|
125
|
+
grep -rn "from 'react'" src/domain/$DOMAIN/ && echo "FAIL" || echo "PASS"
|
|
126
|
+
|
|
127
|
+
# Example (Flutter):
|
|
128
|
+
dart analyze lib/domain/$DOMAIN/ && echo "PASS" || echo "FAIL"
|
|
129
|
+
grep -rn "package:flutter" lib/domain/$DOMAIN/ && echo "FAIL" || echo "PASS"
|
|
130
|
+
```
|
|
113
131
|
|
|
114
|
-
|
|
115
|
-
```markdown
|
|
116
|
-
## Architecture Design
|
|
132
|
+
---
|
|
117
133
|
|
|
118
|
-
|
|
119
|
-
- Architecture Doc: [path]
|
|
120
|
-
- Pattern: [pattern from doc]
|
|
134
|
+
## PHASE 3: Build Infrastructure Layer
|
|
121
135
|
|
|
122
|
-
###
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
136
|
+
### 3.1 Persistence Models (if applicable)
|
|
137
|
+
- ORM models, Prisma schema, Freezed classes
|
|
138
|
+
- Table/collection configuration
|
|
139
|
+
- Helper functions for atomic updates
|
|
126
140
|
|
|
127
|
-
###
|
|
128
|
-
|
|
141
|
+
### 3.2 Store/API Implementation
|
|
142
|
+
- Implements port interfaces from domain
|
|
143
|
+
- Compile-time interface check (where language supports it)
|
|
144
|
+
- Mapper functions: domain entity ↔ persistence model
|
|
145
|
+
- NO business logic — pure persistence/communication
|
|
146
|
+
- Use context consistently
|
|
129
147
|
|
|
130
|
-
###
|
|
131
|
-
|
|
148
|
+
### Rule Check Phase 3
|
|
149
|
+
```bash
|
|
150
|
+
# Build infrastructure layer
|
|
151
|
+
{stack_build_command_for_infra}
|
|
132
152
|
```
|
|
133
153
|
|
|
134
|
-
### Gate
|
|
135
|
-
- [ ] Design follows architecture doc
|
|
136
|
-
- [ ] Layers properly defined
|
|
137
|
-
- [ ] Dependencies follow doc patterns
|
|
138
|
-
|
|
139
154
|
---
|
|
140
155
|
|
|
141
|
-
##
|
|
156
|
+
## PHASE 4: Build Application Layer
|
|
142
157
|
|
|
143
|
-
|
|
158
|
+
### 4.1 Service
|
|
159
|
+
- Thin wrapper delegating to usecases
|
|
160
|
+
- Can orchestrate cross-domain calls if needed
|
|
144
161
|
|
|
145
|
-
###
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
4. Use patterns defined in doc (DI, state management, etc.)
|
|
162
|
+
### 4.2 Transport/Handler/Controller/Screen
|
|
163
|
+
- Registration/wiring function: create store → usecase → service → handler → routes
|
|
164
|
+
- Thin handlers: parse input → call service → return output
|
|
165
|
+
- DTOs in separate file
|
|
150
166
|
|
|
151
|
-
###
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
### Directory Structure (from doc)
|
|
158
|
-
[Follow exact structure from architecture doc]
|
|
167
|
+
### 4.3 Listeners (if domain has events)
|
|
168
|
+
- One file per event
|
|
169
|
+
- Side-effects only (notifications, SSE, analytics, async jobs)
|
|
170
|
+
- Use background context for async work
|
|
171
|
+
- Register in event bus/registry
|
|
159
172
|
|
|
160
|
-
###
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
[Follow conventions defined in architecture doc]
|
|
173
|
+
### Rule Check Phase 4
|
|
174
|
+
```bash
|
|
175
|
+
# Build application layer
|
|
176
|
+
{stack_build_command_for_application}
|
|
165
177
|
```
|
|
166
178
|
|
|
167
|
-
### Gate
|
|
168
|
-
- [ ] Structure matches architecture doc
|
|
169
|
-
- [ ] All layers implemented per doc
|
|
170
|
-
- [ ] Code compiles without errors
|
|
171
|
-
- [ ] Basic functionality works
|
|
172
|
-
|
|
173
179
|
---
|
|
174
180
|
|
|
175
|
-
##
|
|
176
|
-
|
|
177
|
-
**Goal**: Review code quality against architecture doc
|
|
181
|
+
## PHASE 5: Registration & Wiring
|
|
178
182
|
|
|
179
|
-
###
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
- [ ] Layer boundaries respected
|
|
183
|
-
- [ ] Dependencies flow correctly
|
|
184
|
-
- [ ] Patterns used correctly
|
|
183
|
+
### 5.1 Router/Provider Registration
|
|
184
|
+
- Add routes/screens/providers for the new module
|
|
185
|
+
- Wire service dependencies between modules if needed
|
|
185
186
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
- [ ] Proper authentication/authorization
|
|
187
|
+
### 5.2 Persistence Setup
|
|
188
|
+
- Add model migrations/schemas
|
|
189
|
+
- Run migrations if needed
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
- [ ] No obvious bottlenecks
|
|
191
|
+
### 5.3 Event Registry
|
|
192
|
+
- Register all new event listeners
|
|
193
|
+
- Verify event name strings match between events and registry
|
|
195
194
|
|
|
196
|
-
###
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
### Architecture Compliance: [Pass/Fail]
|
|
201
|
-
- Reference: [architecture doc]
|
|
202
|
-
- Issues: [list]
|
|
203
|
-
|
|
204
|
-
### Quality: [Good/Needs Work]
|
|
205
|
-
- Issues: [list]
|
|
206
|
-
|
|
207
|
-
### Security: [Pass/Fail]
|
|
208
|
-
- Issues: [list]
|
|
209
|
-
|
|
210
|
-
### Performance: [Pass/Fail]
|
|
211
|
-
- Issues: [list]
|
|
195
|
+
### Rule Check Phase 5
|
|
196
|
+
```bash
|
|
197
|
+
# Full build
|
|
198
|
+
{stack_full_build_command}
|
|
212
199
|
```
|
|
213
200
|
|
|
214
|
-
|
|
215
|
-
- [ ] Architecture doc followed
|
|
216
|
-
- [ ] No critical issues
|
|
217
|
-
- [ ] Security issues resolved
|
|
201
|
+
---
|
|
218
202
|
|
|
219
|
-
|
|
220
|
-
|
|
203
|
+
## PHASE 6: Domain Tests
|
|
204
|
+
|
|
205
|
+
### 6.1 Value Object Tests
|
|
206
|
+
- All status transitions
|
|
207
|
+
- Terminal states
|
|
208
|
+
- Behavior methods
|
|
209
|
+
- Edge cases
|
|
210
|
+
|
|
211
|
+
### 6.2 Entity Tests
|
|
212
|
+
- Constructor
|
|
213
|
+
- State transitions
|
|
214
|
+
- Event collection after state change
|
|
215
|
+
- Guard methods
|
|
216
|
+
- Edge cases (boundary values)
|
|
217
|
+
|
|
218
|
+
### 6.3 UseCase Tests
|
|
219
|
+
- Mock port interfaces
|
|
220
|
+
- Happy path for each method
|
|
221
|
+
- Validation errors
|
|
222
|
+
- Business rules
|
|
223
|
+
- Event dispatching
|
|
224
|
+
|
|
225
|
+
### Rule Check Phase 6
|
|
226
|
+
```bash
|
|
227
|
+
# Run domain tests
|
|
228
|
+
{stack_test_command_for_domain}
|
|
229
|
+
```
|
|
221
230
|
|
|
222
231
|
---
|
|
223
232
|
|
|
224
|
-
##
|
|
233
|
+
## REVIEW LOOP
|
|
225
234
|
|
|
226
|
-
**
|
|
235
|
+
After all phases complete, run the architecture review. **Keep looping until ALL checks pass.**
|
|
227
236
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
237
|
+
```
|
|
238
|
+
LOOP:
|
|
239
|
+
1. Run /architect-review {stack} {domain}
|
|
240
|
+
2. Collect violations
|
|
241
|
+
3. IF violations with severity >= MEDIUM:
|
|
242
|
+
a. Fix all violations
|
|
243
|
+
b. Run build to verify
|
|
244
|
+
c. Run tests to verify
|
|
245
|
+
d. GOTO 1
|
|
246
|
+
4. IF score >= B:
|
|
247
|
+
BREAK → Final Report
|
|
248
|
+
```
|
|
234
249
|
|
|
235
|
-
|
|
236
|
-
```bash
|
|
237
|
-
# Use test command from architecture doc
|
|
238
|
-
flutter test # Flutter
|
|
239
|
-
go test ./... # Go
|
|
240
|
-
bun test # React/Remix
|
|
241
|
-
php artisan test # Laravel
|
|
242
|
-
```
|
|
250
|
+
---
|
|
243
251
|
|
|
244
|
-
|
|
245
|
-
- [ ] Tests follow architecture doc patterns
|
|
246
|
-
- [ ] All tests pass
|
|
247
|
-
- [ ] Coverage acceptable
|
|
252
|
+
## Final Report
|
|
248
253
|
|
|
249
|
-
|
|
250
|
-
If tests fail → Return to IMPLEMENT → Fix → Re-test
|
|
254
|
+
When review loop passes:
|
|
251
255
|
|
|
252
|
-
|
|
256
|
+
```markdown
|
|
257
|
+
## Feature Complete: {domain}/{feature}
|
|
253
258
|
|
|
254
|
-
|
|
259
|
+
### Files Created
|
|
260
|
+
- List all new files
|
|
255
261
|
|
|
256
|
-
|
|
262
|
+
### Files Modified
|
|
263
|
+
- List all modified files
|
|
257
264
|
|
|
258
|
-
###
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
- [ ] Code formatted (use formatter from doc)
|
|
262
|
-
- [ ] No TODO comments left
|
|
265
|
+
### Endpoints/Screens (depending on stack)
|
|
266
|
+
| Method/Route | Description |
|
|
267
|
+
|-------------|-------------|
|
|
263
268
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
git commit -m "feat: [feature description]"
|
|
268
|
-
```
|
|
269
|
+
### Domain Events
|
|
270
|
+
| Event | Listeners |
|
|
271
|
+
|-------|-----------|
|
|
269
272
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
```
|
|
273
|
+
### Test Coverage
|
|
274
|
+
- X test files, Y test functions
|
|
275
|
+
- Areas covered: value objects, entities, usecases
|
|
274
276
|
|
|
275
|
-
###
|
|
276
|
-
-
|
|
277
|
-
-
|
|
278
|
-
-
|
|
279
|
-
-
|
|
277
|
+
### Review Status: ALL CHECKS PASS
|
|
278
|
+
- Build: PASS
|
|
279
|
+
- Lint: PASS
|
|
280
|
+
- Domain purity: PASS
|
|
281
|
+
- Tests: PASS (X/X)
|
|
282
|
+
- Architecture score: {A/B}
|
|
283
|
+
```
|
|
280
284
|
|
|
281
285
|
---
|
|
282
286
|
|
|
283
|
-
##
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
|
289
|
-
|
|
|
290
|
-
|
|
|
291
|
-
|
|
|
292
|
-
|
|
|
293
|
-
|
|
|
294
|
-
| Monorepo | `monorepo.md` |
|
|
295
|
-
|
|
296
|
-
### Phase Summary
|
|
297
|
-
| Phase | Key Actions |
|
|
298
|
-
|-------|-------------|
|
|
299
|
-
| PLAN | Read arch doc, clarify, breakdown |
|
|
300
|
-
| DESIGN | Design per arch doc |
|
|
301
|
-
| IMPLEMENT | Code per arch doc |
|
|
302
|
-
| REVIEW | Check arch compliance |
|
|
303
|
-
| TEST | Test per arch doc patterns |
|
|
304
|
-
| COMPLETE | Commit, PR |
|
|
305
|
-
|
|
306
|
-
### When to Loop Back
|
|
307
|
-
- **REVIEW fails** → Return to IMPLEMENT
|
|
308
|
-
- **TEST fails** → Return to IMPLEMENT
|
|
309
|
-
- **Requirements change** → Return to PLAN
|
|
310
|
-
|
|
311
|
-
### Success Criteria
|
|
312
|
-
Feature is complete when:
|
|
313
|
-
1. Follows architecture doc
|
|
314
|
-
2. All acceptance criteria met
|
|
315
|
-
3. All tests passing
|
|
316
|
-
4. Code review passed
|
|
317
|
-
5. Committed/PR created
|
|
287
|
+
## Recommended Agents
|
|
288
|
+
|
|
289
|
+
| Phase | Agent | Purpose |
|
|
290
|
+
|-------|-------|---------|
|
|
291
|
+
| PLAN | `@clean-architect` | Architecture design |
|
|
292
|
+
| IMPLEMENT | Stack-specific dev agent | Code per architecture |
|
|
293
|
+
| IMPLEMENT | `@db-designer` | Database schema |
|
|
294
|
+
| IMPLEMENT | `@api-designer` | API design |
|
|
295
|
+
| REVIEW | `@code-reviewer` | Code quality |
|
|
296
|
+
| REVIEW | `@security-audit` | Security check |
|
|
297
|
+
| TEST | `@test-writer` | Write tests |
|