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
|
@@ -1,429 +1,367 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: architect-review
|
|
3
|
-
description:
|
|
4
|
-
args: ARCHITECTURE_NAME
|
|
3
|
+
description: DDD architecture compliance review with automated checks and review loop. Use when user says "architect-review", "architecture review", "review architecture", "check architecture", "review ddd", "ddd review".
|
|
4
|
+
args: "[ARCHITECTURE_NAME] [DOMAIN]"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Architecture Review
|
|
7
|
+
# DDD Architecture Review
|
|
8
8
|
|
|
9
|
-
Review codebase
|
|
9
|
+
Review codebase against DDD architecture guidelines with automated checks and a review loop that keeps fixing until all checks pass.
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
|
|
15
|
-
/architect-review clean-architecture
|
|
14
|
+
/architect-review go-backend wallet
|
|
16
15
|
/architect-review react-frontend
|
|
17
|
-
/architect-review go-backend
|
|
18
|
-
|
|
19
|
-
# Without argument - will ask user to select
|
|
20
16
|
/architect-review
|
|
21
17
|
```
|
|
22
18
|
|
|
23
19
|
## Supported Architectures
|
|
24
20
|
|
|
25
21
|
Check for architecture files in these locations (in order):
|
|
26
|
-
|
|
27
22
|
1. **Project-specific**: `.claude/architecture/`
|
|
28
23
|
2. **Global**: `~/.claude/architecture/`
|
|
29
24
|
|
|
30
25
|
### Built-in Architectures
|
|
31
26
|
|
|
32
|
-
| Name | File |
|
|
33
|
-
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `monorepo` | `monorepo.md` |
|
|
41
|
-
|
|
42
|
-
### Name Aliases
|
|
43
|
-
|
|
44
|
-
Support short names for convenience:
|
|
45
|
-
|
|
46
|
-
| Alias | Maps to |
|
|
47
|
-
|-------|---------|
|
|
48
|
-
| `clean` | `clean-architecture` |
|
|
49
|
-
| `react` | `react-frontend` |
|
|
50
|
-
| `go` | `go-backend` |
|
|
51
|
-
| `laravel` | `laravel-backend` |
|
|
52
|
-
| `remix` | `remix-fullstack` |
|
|
53
|
-
| `flutter` | `flutter-mobile` |
|
|
27
|
+
| Name | File | Aliases |
|
|
28
|
+
|------|------|---------|
|
|
29
|
+
| `ddd-architecture` | `ddd-architecture.md` | `ddd`, `core` |
|
|
30
|
+
| `go-backend` | `go-backend.md` | `go` |
|
|
31
|
+
| `react-frontend` | `react-frontend.md` | `react` |
|
|
32
|
+
| `flutter-mobile` | `flutter-mobile.md` | `flutter` |
|
|
33
|
+
| `laravel-backend` | `laravel-backend.md` | `laravel` |
|
|
34
|
+
| `remix-fullstack` | `remix-fullstack.md` | `remix` |
|
|
35
|
+
| `monorepo` | `monorepo.md` | `mono` |
|
|
54
36
|
|
|
55
37
|
---
|
|
56
38
|
|
|
57
39
|
## Phase 0: RESOLVE ARCHITECTURE
|
|
58
40
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
### Available architectures:
|
|
76
|
-
[List all .md files found in both architecture directories]
|
|
77
|
-
|
|
78
|
-
### To add a custom architecture:
|
|
79
|
-
Place your architecture guideline file at:
|
|
80
|
-
- Project: `.claude/architecture/{name}.md`
|
|
81
|
-
- Global: `~/.claude/architecture/{name}.md`
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
**STOP HERE. Do not proceed with review.**
|
|
85
|
-
|
|
86
|
-
### If NO argument provided (`/architect-review`)
|
|
87
|
-
|
|
88
|
-
1. Scan both architecture directories for available `.md` files:
|
|
89
|
-
```bash
|
|
90
|
-
ls .claude/architecture/*.md 2>/dev/null
|
|
91
|
-
ls ~/.claude/architecture/*.md 2>/dev/null
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
2. If NO architecture files found → **REJECT**:
|
|
95
|
-
```markdown
|
|
96
|
-
## ❌ No Architecture Guidelines Found
|
|
97
|
-
|
|
98
|
-
No architecture guideline files found in:
|
|
99
|
-
- `.claude/architecture/`
|
|
100
|
-
- `~/.claude/architecture/`
|
|
101
|
-
|
|
102
|
-
Install moicle to get built-in architecture guidelines:
|
|
103
|
-
```bash
|
|
104
|
-
npm install -g moicle && moicle install
|
|
105
|
-
```
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
**STOP HERE.**
|
|
109
|
-
|
|
110
|
-
3. If files found → **ASK USER** to select which architecture to review against. Present the list of available architectures.
|
|
111
|
-
|
|
112
|
-
4. User selects → proceed to Phase 1
|
|
41
|
+
### If argument provided
|
|
42
|
+
1. Normalize name using alias table
|
|
43
|
+
2. Search: `.claude/architecture/{name}.md` → `~/.claude/architecture/{name}.md`
|
|
44
|
+
3. Found → Phase 1
|
|
45
|
+
4. Not found → REJECT with available architectures list. **STOP.**
|
|
46
|
+
|
|
47
|
+
### If NO argument
|
|
48
|
+
1. Auto-detect stack from project files:
|
|
49
|
+
- `go.mod` → `go-backend`
|
|
50
|
+
- `package.json` + `vite.config` → `react-frontend`
|
|
51
|
+
- `pubspec.yaml` → `flutter-mobile`
|
|
52
|
+
- `composer.json` → `laravel-backend`
|
|
53
|
+
- `remix.config` → `remix-fullstack`
|
|
54
|
+
2. If detected → confirm with user
|
|
55
|
+
3. If not detected → list available, ask user to select
|
|
113
56
|
|
|
114
57
|
### Gate
|
|
115
|
-
- [ ] Architecture
|
|
116
|
-
- [ ]
|
|
117
|
-
- [ ] Architecture guideline content loaded
|
|
58
|
+
- [ ] Architecture file loaded
|
|
59
|
+
- [ ] Domain name identified (if provided)
|
|
118
60
|
|
|
119
61
|
---
|
|
120
62
|
|
|
121
|
-
## Phase 1: LOAD GUIDELINE
|
|
122
|
-
|
|
123
|
-
**Goal**: Read and understand the architecture guideline
|
|
124
|
-
|
|
125
|
-
### Actions
|
|
63
|
+
## Phase 1: LOAD GUIDELINE & EXTRACT RULES
|
|
126
64
|
|
|
127
|
-
|
|
128
|
-
2. Extract key review criteria:
|
|
129
|
-
- Layer structure & boundaries
|
|
130
|
-
- Dependency rules (what depends on what)
|
|
131
|
-
- Directory/folder structure conventions
|
|
132
|
-
- Naming conventions
|
|
133
|
-
- Design patterns required
|
|
134
|
-
- Data flow patterns
|
|
135
|
-
- Testing patterns
|
|
136
|
-
- Anti-patterns to avoid
|
|
65
|
+
Read the architecture file completely. Also read `ddd-architecture.md` (core DDD spec) as the base reference.
|
|
137
66
|
|
|
138
|
-
###
|
|
139
|
-
```markdown
|
|
140
|
-
## Architecture Guideline Summary
|
|
67
|
+
### Extract from architecture doc:
|
|
141
68
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
### Layer Structure
|
|
151
|
-
{layer diagram or description from guideline}
|
|
152
|
-
|
|
153
|
-
### Dependency Rules
|
|
154
|
-
- {rule 1}
|
|
155
|
-
- {rule 2}
|
|
156
|
-
|
|
157
|
-
### Required Patterns
|
|
158
|
-
- {pattern 1}
|
|
159
|
-
- {pattern 2}
|
|
160
|
-
|
|
161
|
-
### Directory Structure
|
|
162
|
-
{expected structure from guideline}
|
|
163
|
-
|
|
164
|
-
### Naming Conventions
|
|
165
|
-
- {convention 1}
|
|
166
|
-
- {convention 2}
|
|
167
|
-
```
|
|
69
|
+
1. **DDD Directory Structure** — expected folder layout
|
|
70
|
+
2. **Layer Rules** — import/dependency rules per layer
|
|
71
|
+
3. **Hard Rules** — forbidden imports, naming conventions
|
|
72
|
+
4. **Forbidden Imports** — specific packages/modules NOT allowed in domain
|
|
73
|
+
5. **Check Scripts** — automated bash commands for validation
|
|
74
|
+
6. **Wiring Pattern** — how modules are registered
|
|
75
|
+
7. **Test Patterns** — how each layer should be tested
|
|
168
76
|
|
|
169
77
|
### Gate
|
|
170
|
-
- [ ]
|
|
171
|
-
- [ ]
|
|
78
|
+
- [ ] Core DDD rules loaded
|
|
79
|
+
- [ ] Stack-specific rules loaded
|
|
80
|
+
- [ ] Check scripts extracted
|
|
172
81
|
- [ ] Review checklist prepared
|
|
173
82
|
|
|
174
83
|
---
|
|
175
84
|
|
|
176
|
-
## Phase 2:
|
|
177
|
-
|
|
178
|
-
**Goal**: Analyze current codebase structure against the architecture
|
|
179
|
-
|
|
180
|
-
### Actions
|
|
181
|
-
|
|
182
|
-
1. **Map project structure**:
|
|
183
|
-
```bash
|
|
184
|
-
# Get overall structure (exclude common non-source dirs)
|
|
185
|
-
find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.go" -o -name "*.php" -o -name "*.dart" -o -name "*.js" -o -name "*.jsx" \) \
|
|
186
|
-
-not -path "*/node_modules/*" -not -path "*/vendor/*" -not -path "*/.dart_tool/*" -not -path "*/build/*" -not -path "*/dist/*" | head -100
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
2. **Check directory structure** against guideline:
|
|
190
|
-
- Does folder structure match expected layout?
|
|
191
|
-
- Are there unexpected directories?
|
|
192
|
-
- Are required directories missing?
|
|
193
|
-
|
|
194
|
-
3. **Check layer boundaries**:
|
|
195
|
-
- Read key files in each layer
|
|
196
|
-
- Check imports/dependencies
|
|
197
|
-
- Verify dependency direction follows guideline rules
|
|
198
|
-
|
|
199
|
-
4. **Check naming conventions**:
|
|
200
|
-
- File names follow convention?
|
|
201
|
-
- Class/function names follow convention?
|
|
202
|
-
- Module/package names follow convention?
|
|
203
|
-
|
|
204
|
-
5. **Check design patterns**:
|
|
205
|
-
- Required patterns implemented?
|
|
206
|
-
- Anti-patterns present?
|
|
207
|
-
- Correct use of dependency injection?
|
|
208
|
-
|
|
209
|
-
6. **Check data flow**:
|
|
210
|
-
- Data flows in correct direction per guideline?
|
|
211
|
-
- Proper DTOs/entities at layer boundaries?
|
|
212
|
-
|
|
213
|
-
### Output
|
|
214
|
-
```markdown
|
|
215
|
-
## Codebase Scan Results
|
|
216
|
-
|
|
217
|
-
### Directory Structure
|
|
218
|
-
- Expected: {from guideline}
|
|
219
|
-
- Actual: {current structure}
|
|
220
|
-
- Match: [✅ Yes / ⚠️ Partial / ❌ No]
|
|
221
|
-
|
|
222
|
-
### Files Analyzed: {count}
|
|
223
|
-
### Layers Identified: {list}
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### Gate
|
|
227
|
-
- [ ] Project structure mapped
|
|
228
|
-
- [ ] Key files identified per layer
|
|
229
|
-
- [ ] Dependencies analyzed
|
|
85
|
+
## Phase 2: AUTOMATED CHECKS
|
|
230
86
|
|
|
231
|
-
|
|
87
|
+
Run the check scripts from the architecture doc. These vary per stack but follow this pattern:
|
|
232
88
|
|
|
233
|
-
|
|
89
|
+
### Standard Checks (all stacks)
|
|
234
90
|
|
|
235
|
-
|
|
91
|
+
```bash
|
|
92
|
+
echo "=== R1: Build ==="
|
|
93
|
+
{stack_build_command} && echo "PASS" || echo "FAIL"
|
|
236
94
|
|
|
237
|
-
|
|
95
|
+
echo "=== R2: Lint/Vet ==="
|
|
96
|
+
{stack_lint_command} && echo "PASS" || echo "FAIL"
|
|
238
97
|
|
|
239
|
-
|
|
98
|
+
echo "=== R3: Domain Purity (no framework imports) ==="
|
|
99
|
+
{grep_forbidden_imports_in_domain} && echo "FAIL" || echo "PASS"
|
|
240
100
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
- [ ] Infrastructure doesn't leak into domain
|
|
244
|
-
- [ ] Presentation doesn't directly access data layer
|
|
245
|
-
- [ ] Business logic is in the correct layer
|
|
101
|
+
echo "=== R4: No Cross-Domain Imports ==="
|
|
102
|
+
{check_domain_A_not_importing_domain_B} && echo "FAIL" || echo "PASS"
|
|
246
103
|
|
|
247
|
-
|
|
104
|
+
echo "=== R5: No Circular Imports ==="
|
|
105
|
+
{build_and_check_cycles} && echo "FAIL" || echo "PASS"
|
|
248
106
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
- [ ] No misplaced files across layers
|
|
252
|
-
- [ ] Required directories exist
|
|
107
|
+
echo "=== R6: Tests Exist ==="
|
|
108
|
+
{find_test_files_in_domain} | wc -l
|
|
253
109
|
|
|
254
|
-
|
|
110
|
+
echo "=== R7: Tests Pass ==="
|
|
111
|
+
{stack_test_command} && echo "PASS" || echo "FAIL"
|
|
255
112
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
- [ ] Functions/methods follow naming convention
|
|
259
|
-
- [ ] Variables follow naming convention
|
|
260
|
-
- [ ] Constants follow naming convention
|
|
113
|
+
echo "=== R8: Wiring Registered ==="
|
|
114
|
+
{check_routes_or_providers_registered}
|
|
261
115
|
|
|
262
|
-
|
|
116
|
+
echo "=== R9: Event Names Match Registry ==="
|
|
117
|
+
{check_event_names_consistency}
|
|
263
118
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
- [ ] Dependency injection done properly
|
|
119
|
+
echo "=== R10: Async Context Safety ==="
|
|
120
|
+
{check_no_request_context_in_goroutines}
|
|
121
|
+
```
|
|
268
122
|
|
|
269
|
-
|
|
123
|
+
### Stack-Specific Check Scripts
|
|
270
124
|
|
|
271
|
-
|
|
272
|
-
- [ ] Proper DTOs at boundaries
|
|
273
|
-
- [ ] No domain entities exposed to presentation
|
|
274
|
-
- [ ] Proper mapping between layers
|
|
125
|
+
Read the **Check Scripts** section from the loaded architecture doc and run those exact commands.
|
|
275
126
|
|
|
276
|
-
|
|
127
|
+
### Output
|
|
128
|
+
Record PASS/FAIL for each check. Continue to Phase 3 regardless — manual review catches what automated checks miss.
|
|
277
129
|
|
|
278
|
-
|
|
279
|
-
- [ ]
|
|
280
|
-
- [ ]
|
|
281
|
-
- [ ] Test naming conventions followed
|
|
130
|
+
### Gate
|
|
131
|
+
- [ ] All automated checks executed
|
|
132
|
+
- [ ] Results recorded
|
|
282
133
|
|
|
283
|
-
|
|
134
|
+
---
|
|
284
135
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
136
|
+
## Phase 3: ARCHITECTURE REVIEW (Manual)
|
|
137
|
+
|
|
138
|
+
Read files and check DDD compliance. Focus on **architecture structure**, NOT business logic correctness.
|
|
139
|
+
|
|
140
|
+
### 3.1 Directory Structure
|
|
141
|
+
|
|
142
|
+
| # | Check | What to look for |
|
|
143
|
+
|---|-------|-----------------|
|
|
144
|
+
| D1 | Domain dir exists | `domain/{domain}/` with proper subdirs |
|
|
145
|
+
| D2 | Required subdirs | `entities/`, `ports/`, `usecases/` at minimum |
|
|
146
|
+
| D3 | Value objects separate | `valueobjects/` dir, NOT mixed in `entities/` |
|
|
147
|
+
| D4 | Events separate | `events/` dir with 1 file per event |
|
|
148
|
+
| D5 | Application layer | `application/ports/{transport}/`, `services/`, `listeners/` |
|
|
149
|
+
| D6 | Infrastructure layer | Implements port interfaces |
|
|
150
|
+
| D7 | No legacy dirs | No `modules/`, `pkg/` (for Go), or flat structure |
|
|
151
|
+
|
|
152
|
+
### 3.2 Entities
|
|
153
|
+
|
|
154
|
+
| # | Check | What to look for |
|
|
155
|
+
|---|-------|-----------------|
|
|
156
|
+
| E1 | Has constructor | Factory function/method: `New{Entity}()`, `create()`, etc. |
|
|
157
|
+
| E2 | Has behavior methods | State transitions, calculations, guard checks — NOT anemic |
|
|
158
|
+
| E3 | Raises domain events | Collects/emits events on state changes |
|
|
159
|
+
| E4 | No framework imports | Only stdlib + domain/shared + valueobjects |
|
|
160
|
+
| E5 | Has mappers (if applicable) | ToModel/FromModel or equivalent for persistence mapping |
|
|
161
|
+
|
|
162
|
+
### 3.3 Value Objects
|
|
163
|
+
|
|
164
|
+
| # | Check | What to look for |
|
|
165
|
+
|---|-------|-----------------|
|
|
166
|
+
| VO1 | Separate directory | In `valueobjects/`, NOT in `entities/` |
|
|
167
|
+
| VO2 | Only stdlib imports | No external packages, no domain/shared |
|
|
168
|
+
| VO3 | Immutable with behavior | Typed values with query methods (IsPending, CanTransitionTo) |
|
|
169
|
+
| VO4 | Used by entities/ports | Entities and ports reference VO types, not raw strings |
|
|
170
|
+
|
|
171
|
+
### 3.4 Ports
|
|
172
|
+
|
|
173
|
+
| # | Check | What to look for |
|
|
174
|
+
|---|-------|-----------------|
|
|
175
|
+
| P1 | `ports/` folder exists | MUST have `ports/` — inline interfaces in usecases is a violation |
|
|
176
|
+
| P2 | One file per port | `{store_name}.go/.ts/.dart/.php` — not all in one file |
|
|
177
|
+
| P3 | Interface + related DTOs | Each file has interface + its param/result types |
|
|
178
|
+
| P4 | Domain types in signatures | Return entities/VOs, not primitives for typed values |
|
|
179
|
+
| P5 | Platform-agnostic naming | `URLParser`, NOT `ShopeeURLParser` |
|
|
180
|
+
| P6 | No infrastructure imports | Only stdlib + entities + valueobjects + shared |
|
|
181
|
+
|
|
182
|
+
### 3.5 Events
|
|
183
|
+
|
|
184
|
+
| # | Check | What to look for |
|
|
185
|
+
|---|-------|-----------------|
|
|
186
|
+
| EV1 | One file per event | `{event_name}` naming, not multiple events in one file |
|
|
187
|
+
| EV2 | Extends base event | Embeds/extends shared BaseEvent |
|
|
188
|
+
| EV3 | Carries data for listeners | UserID, amounts, names — enough for side-effects |
|
|
189
|
+
| EV4 | Name matches registry | Event name string matches event bus registration |
|
|
190
|
+
|
|
191
|
+
### 3.6 UseCases
|
|
192
|
+
|
|
193
|
+
| # | Check | What to look for |
|
|
194
|
+
|---|-------|-----------------|
|
|
195
|
+
| U1 | Uses port interfaces | From `ports/` package, NOT inline interface definitions |
|
|
196
|
+
| U2 | Split by concern | One file per action group, max ~200 lines per file |
|
|
197
|
+
| U3 | Business logic lives here | Not in controller, not in store, not in service |
|
|
198
|
+
| U4 | No infrastructure imports | No ORM, no HTTP framework, no cache client |
|
|
199
|
+
| U5 | Dispatches domain events | After successful persistence, dispatches collected events |
|
|
200
|
+
| U6 | No `deps.go` or similar | Interfaces MUST be in `ports/`, not inline |
|
|
201
|
+
|
|
202
|
+
### 3.7 Services
|
|
203
|
+
|
|
204
|
+
| # | Check | What to look for |
|
|
205
|
+
|---|-------|-----------------|
|
|
206
|
+
| SVC1 | Thin wrapper | Delegates to usecases, no business logic |
|
|
207
|
+
| SVC2 | No infrastructure imports | No ORM, no HTTP framework |
|
|
208
|
+
|
|
209
|
+
### 3.8 Handlers/Controllers
|
|
210
|
+
|
|
211
|
+
| # | Check | What to look for |
|
|
212
|
+
|---|-------|-----------------|
|
|
213
|
+
| H1 | Registration function | `Register{Module}Routes` or equivalent wiring |
|
|
214
|
+
| H2 | Thin handlers | Parse input -> call service -> return output |
|
|
215
|
+
| H3 | No business logic | Logic is in usecases, not here |
|
|
216
|
+
| H4 | DTOs separate | Request/Response types in separate file |
|
|
217
|
+
|
|
218
|
+
### 3.9 Listeners
|
|
219
|
+
|
|
220
|
+
| # | Check | What to look for |
|
|
221
|
+
|---|-------|-----------------|
|
|
222
|
+
| L1 | One per event | `on_{event_name}` naming |
|
|
223
|
+
| L2 | Side-effects only | Notifications, SSE, analytics — no business logic |
|
|
224
|
+
| L3 | Registered in event bus | Listed in registry/event bus setup |
|
|
225
|
+
| L4 | Background context | Async work uses background context, not request context |
|
|
226
|
+
|
|
227
|
+
### 3.10 Infrastructure/Store
|
|
228
|
+
|
|
229
|
+
| # | Check | What to look for |
|
|
230
|
+
|---|-------|-----------------|
|
|
231
|
+
| I1 | Implements port interface | All methods from the port interface |
|
|
232
|
+
| I2 | Has mappers | Converts between domain entities and persistence models |
|
|
233
|
+
| I3 | No business logic | Pure persistence — queries, saves, deletes |
|
|
234
|
+
| I4 | Compile-time check | Interface compliance verified at compile time (where possible) |
|
|
291
235
|
|
|
292
236
|
### Gate
|
|
293
|
-
- [ ] All
|
|
237
|
+
- [ ] All 10 areas reviewed
|
|
294
238
|
- [ ] Findings categorized by severity
|
|
295
|
-
- [ ] Specific file:line references provided
|
|
296
239
|
|
|
297
240
|
---
|
|
298
241
|
|
|
299
242
|
## Phase 4: REPORT
|
|
300
243
|
|
|
301
|
-
|
|
244
|
+
### Severity Levels
|
|
245
|
+
|
|
246
|
+
| Level | Meaning | Examples |
|
|
247
|
+
|-------|---------|---------|
|
|
248
|
+
| **CRITICAL** | Architecture broken | Build fails, circular imports, domain imports framework |
|
|
249
|
+
| **HIGH** | DDD violation | Cross-domain import, business logic in wrong layer, no ports dir, inline interfaces |
|
|
250
|
+
| **MEDIUM** | Structure issue | Anemic entity, fat controller, missing events, missing tests, missing json tags |
|
|
251
|
+
| **LOW** | Convention issue | File naming, redundant code, DTOs in wrong package |
|
|
252
|
+
|
|
253
|
+
**ALL levels must be fixed.**
|
|
302
254
|
|
|
303
255
|
### Report Template
|
|
304
256
|
|
|
305
257
|
```markdown
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
|
318
|
-
|
|
319
|
-
|
|
|
320
|
-
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
258
|
+
## Architecture Review: {architecture} / {domain}
|
|
259
|
+
|
|
260
|
+
### Automated Checks
|
|
261
|
+
| # | Check | Status |
|
|
262
|
+
|---|-------|--------|
|
|
263
|
+
| R1 | Build | PASS/FAIL |
|
|
264
|
+
| R2 | Lint/Vet | PASS/FAIL |
|
|
265
|
+
| R3 | Domain purity | PASS/FAIL |
|
|
266
|
+
| R4 | No cross-domain imports | PASS/FAIL |
|
|
267
|
+
| R5 | No circular imports | PASS/FAIL |
|
|
268
|
+
| R6 | Tests exist | PASS/WARN |
|
|
269
|
+
| R7 | Tests pass | PASS/FAIL |
|
|
270
|
+
| R8 | Wiring registered | PASS/FAIL |
|
|
271
|
+
| R9 | Event names consistent | PASS/N/A |
|
|
272
|
+
| R10 | Async context safety | PASS/N/A |
|
|
273
|
+
|
|
274
|
+
### Architecture Review
|
|
275
|
+
| Area | Status | Violations |
|
|
276
|
+
|------|--------|------------|
|
|
277
|
+
| Directory Structure (D1-D7) | OK/ISSUE | ... |
|
|
278
|
+
| Entities (E1-E5) | OK/ISSUE | ... |
|
|
279
|
+
| Value Objects (VO1-VO4) | OK/ISSUE | ... |
|
|
280
|
+
| Ports (P1-P6) | OK/ISSUE | ... |
|
|
281
|
+
| Events (EV1-EV4) | OK/N/A | ... |
|
|
282
|
+
| UseCases (U1-U6) | OK/ISSUE | ... |
|
|
283
|
+
| Services (SVC1-SVC2) | OK/ISSUE | ... |
|
|
284
|
+
| Handlers (H1-H4) | OK/ISSUE | ... |
|
|
285
|
+
| Listeners (L1-L4) | OK/N/A | ... |
|
|
286
|
+
| Infrastructure (I1-I4) | OK/ISSUE | ... |
|
|
287
|
+
|
|
288
|
+
### Violations Found
|
|
289
|
+
1. [SEVERITY] Code — file:line — description
|
|
290
|
+
2. ...
|
|
291
|
+
|
|
292
|
+
### Recommended Fixes
|
|
293
|
+
1. Fix description
|
|
294
|
+
2. ...
|
|
295
|
+
|
|
296
|
+
### Overall Score: {A/B/C/D/F}
|
|
297
|
+
```
|
|
334
298
|
|
|
335
|
-
|
|
299
|
+
### Scoring
|
|
336
300
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
```
|
|
345
|
-
{suggested fix or approach}
|
|
346
|
-
```
|
|
301
|
+
| Score | Criteria |
|
|
302
|
+
|-------|----------|
|
|
303
|
+
| **A** | 0 violations, all automated checks PASS |
|
|
304
|
+
| **B** | 0 CRITICAL/HIGH, max 3 MEDIUM |
|
|
305
|
+
| **C** | 0 CRITICAL, max 2 HIGH |
|
|
306
|
+
| **D** | Has CRITICAL or 3+ HIGH |
|
|
307
|
+
| **F** | Multiple CRITICAL, architecture fundamentally broken |
|
|
347
308
|
|
|
348
|
-
###
|
|
309
|
+
### Gate
|
|
310
|
+
- [ ] Report generated
|
|
311
|
+
- [ ] Score calculated
|
|
312
|
+
- [ ] All violations listed with file:line
|
|
349
313
|
|
|
350
314
|
---
|
|
351
315
|
|
|
352
|
-
##
|
|
353
|
-
|
|
354
|
-
### Issue 1: {title}
|
|
355
|
-
- **Dimension**: {dimension}
|
|
356
|
-
- **Location**: `{file}:{line}`
|
|
357
|
-
- **Guideline Says**: {requirement}
|
|
358
|
-
- **Actual**: {current state}
|
|
359
|
-
- **Fix**: {how to fix}
|
|
316
|
+
## Phase 5: REVIEW LOOP (if user confirms fix)
|
|
360
317
|
|
|
361
|
-
|
|
318
|
+
**Keep looping until ALL checks pass and score is A or B.**
|
|
362
319
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
320
|
+
```
|
|
321
|
+
LOOP:
|
|
322
|
+
1. Fix all violations found in report
|
|
323
|
+
2. Run automated checks (Phase 2)
|
|
324
|
+
3. Run architecture review (Phase 3)
|
|
325
|
+
4. Collect violations
|
|
326
|
+
5. IF violations with severity >= MEDIUM:
|
|
327
|
+
a. Fix violations
|
|
328
|
+
b. GOTO 1
|
|
329
|
+
6. IF only LOW violations or none:
|
|
330
|
+
BREAK → Report final status
|
|
331
|
+
```
|
|
367
332
|
|
|
368
|
-
|
|
333
|
+
### After Each Fix Iteration
|
|
334
|
+
```bash
|
|
335
|
+
# Verify build still works
|
|
336
|
+
{stack_build_command}
|
|
369
337
|
|
|
370
|
-
|
|
338
|
+
# Verify tests still pass
|
|
339
|
+
{stack_test_command}
|
|
371
340
|
|
|
372
|
-
-
|
|
373
|
-
|
|
341
|
+
# Re-check domain purity
|
|
342
|
+
{grep_forbidden_imports_in_domain}
|
|
343
|
+
```
|
|
374
344
|
|
|
375
345
|
---
|
|
376
346
|
|
|
377
|
-
##
|
|
378
|
-
|
|
379
|
-
### What's Done Well ✅
|
|
380
|
-
- {strength 1}
|
|
381
|
-
- {strength 2}
|
|
382
|
-
- {strength 3}
|
|
383
|
-
|
|
384
|
-
### What Needs Improvement ⚠️
|
|
385
|
-
- {area 1}
|
|
386
|
-
- {area 2}
|
|
387
|
-
|
|
388
|
-
### Recommended Action Plan
|
|
389
|
-
|
|
390
|
-
#### Priority 1 (Critical - Fix Immediately)
|
|
391
|
-
1. {action 1}
|
|
392
|
-
2. {action 2}
|
|
393
|
-
|
|
394
|
-
#### Priority 2 (Major - Fix Soon)
|
|
395
|
-
1. {action 1}
|
|
396
|
-
2. {action 2}
|
|
347
|
+
## Calling from Other Skills
|
|
397
348
|
|
|
398
|
-
|
|
399
|
-
1. {action 1}
|
|
400
|
-
2. {action 2}
|
|
349
|
+
This skill is designed to be called by `new-feature` and `refactor` skills at the end of their workflows:
|
|
401
350
|
|
|
402
|
-
---
|
|
403
|
-
|
|
404
|
-
## Architecture Reference
|
|
405
|
-
|
|
406
|
-
Key sections from the guideline that are most relevant:
|
|
407
|
-
- {section 1}: {brief summary}
|
|
408
|
-
- {section 2}: {brief summary}
|
|
409
351
|
```
|
|
352
|
+
# From new-feature skill, after Phase 5 (registration):
|
|
353
|
+
→ Run /architect-review {detected_stack} {domain}
|
|
354
|
+
→ Review loop until score >= B
|
|
410
355
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
- [ ] Specific file references included
|
|
416
|
-
|
|
417
|
-
---
|
|
418
|
-
|
|
419
|
-
## Recommended Agents
|
|
356
|
+
# From refactor skill, after Phase 4 (cleanup):
|
|
357
|
+
→ Run /architect-review {detected_stack} {domain}
|
|
358
|
+
→ Review loop until score >= B
|
|
359
|
+
```
|
|
420
360
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
| REVIEW | `@security-audit` | Security pattern compliance |
|
|
426
|
-
| REPORT | `@docs-writer` | Generate detailed report |
|
|
361
|
+
When called from another skill:
|
|
362
|
+
- Skip Phase 0 (architecture already known)
|
|
363
|
+
- Skip user confirmation for fixes (auto-fix in loop)
|
|
364
|
+
- Report final score back to calling skill
|
|
427
365
|
|
|
428
366
|
---
|
|
429
367
|
|
|
@@ -431,43 +369,25 @@ Key sections from the guideline that are most relevant:
|
|
|
431
369
|
|
|
432
370
|
### Architecture Files Location
|
|
433
371
|
```
|
|
434
|
-
# Project-specific (priority)
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
# Global
|
|
438
|
-
~/.claude/architecture/{name}.md
|
|
372
|
+
.claude/architecture/{name}.md # Project-specific (priority)
|
|
373
|
+
~/.claude/architecture/{name}.md # Global
|
|
439
374
|
```
|
|
440
375
|
|
|
441
|
-
###
|
|
376
|
+
### Aliases
|
|
442
377
|
```
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
monorepo
|
|
378
|
+
ddd → ddd-architecture
|
|
379
|
+
go → go-backend
|
|
380
|
+
react → react-frontend
|
|
381
|
+
flutter → flutter-mobile
|
|
382
|
+
laravel → laravel-backend
|
|
383
|
+
remix → remix-fullstack
|
|
384
|
+
mono → monorepo
|
|
450
385
|
```
|
|
451
386
|
|
|
452
|
-
### Review
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
| 5 | Data Flow | High |
|
|
460
|
-
| 6 | Testing Structure | Medium |
|
|
461
|
-
|
|
462
|
-
---
|
|
463
|
-
|
|
464
|
-
## Success Criteria
|
|
465
|
-
|
|
466
|
-
Architecture review is complete when:
|
|
467
|
-
1. Architecture guideline loaded and understood
|
|
468
|
-
2. Codebase scanned thoroughly
|
|
469
|
-
3. All 6 dimensions reviewed
|
|
470
|
-
4. Findings categorized by severity
|
|
471
|
-
5. Compliance score calculated
|
|
472
|
-
6. Action plan provided with priorities
|
|
473
|
-
7. Specific file:line references for all findings
|
|
387
|
+
### Review Areas (10)
|
|
388
|
+
```
|
|
389
|
+
D: Directory Structure E: Entities VO: Value Objects
|
|
390
|
+
P: Ports EV: Events U: UseCases
|
|
391
|
+
SVC: Services H: Handlers L: Listeners
|
|
392
|
+
I: Infrastructure
|
|
393
|
+
```
|