moicle 1.3.1 → 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.
@@ -1,429 +1,367 @@
1
1
  ---
2
2
  name: architect-review
3
- description: Architecture compliance review workflow. Reviews codebase against specific architecture guidelines. Use when user says "architect-review", "architecture review", "review architecture", "check architecture compliance".
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 Workflow
7
+ # DDD Architecture Review
8
8
 
9
- Review codebase compliance against a specific architecture guideline.
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
- # With architecture name - review immediately
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 | Description |
33
- |------|------|-------------|
34
- | `clean-architecture` | `clean-architecture.md` | Clean Architecture layers & principles |
35
- | `react-frontend` | `react-frontend.md` | React + Vite + TypeScript |
36
- | `go-backend` | `go-backend.md` | Go + Gin |
37
- | `laravel-backend` | `laravel-backend.md` | Laravel + PHP |
38
- | `remix-fullstack` | `remix-fullstack.md` | Remix fullstack |
39
- | `flutter-mobile` | `flutter-mobile.md` | Flutter + Dart + Riverpod |
40
- | `monorepo` | `monorepo.md` | Monorepo structure |
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
- **Goal**: Determine which architecture to review against
60
-
61
- ### If argument provided (`/architect-review {ARCHITECTURE_NAME}`)
62
-
63
- 1. Normalize the name using alias table above
64
- 2. Search for the architecture file:
65
- - First check: `.claude/architecture/{name}.md`
66
- - Then check: `~/.claude/architecture/{name}.md`
67
- 3. If file found proceed to Phase 1
68
- 4. If file NOT found **REJECT** with message:
69
-
70
- ```markdown
71
- ## Architecture Not Supported
72
-
73
- Architecture `{ARCHITECTURE_NAME}` is not available.
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 name resolved
116
- - [ ] Architecture file exists and is readable
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
- 1. **Read the architecture file** completely
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
- ### Output
139
- ```markdown
140
- ## Architecture Guideline Summary
67
+ ### Extract from architecture doc:
141
68
 
142
- ### Architecture: {name}
143
- ### Source: {file path}
144
-
145
- ### Key Principles
146
- 1. {principle 1}
147
- 2. {principle 2}
148
- 3. {principle 3}
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
- - [ ] Guideline fully read
171
- - [ ] Key criteria extracted
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: SCAN CODEBASE
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
- ## Phase 3: REVIEW
89
+ ### Standard Checks (all stacks)
234
90
 
235
- **Goal**: Detailed compliance review with findings
91
+ ```bash
92
+ echo "=== R1: Build ==="
93
+ {stack_build_command} && echo "PASS" || echo "FAIL"
236
94
 
237
- ### Review Dimensions
95
+ echo "=== R2: Lint/Vet ==="
96
+ {stack_lint_command} && echo "PASS" || echo "FAIL"
238
97
 
239
- #### 1. Layer Boundaries ⚠️ CRITICAL
98
+ echo "=== R3: Domain Purity (no framework imports) ==="
99
+ {grep_forbidden_imports_in_domain} && echo "FAIL" || echo "PASS"
240
100
 
241
- - [ ] Each layer only depends on allowed layers (per guideline)
242
- - [ ] No circular dependencies between layers
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
- #### 2. Directory Structure
104
+ echo "=== R5: No Circular Imports ==="
105
+ {build_and_check_cycles} && echo "FAIL" || echo "PASS"
248
106
 
249
- - [ ] Folders match guideline layout
250
- - [ ] Files are in correct locations
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
- #### 3. Naming Conventions
110
+ echo "=== R7: Tests Pass ==="
111
+ {stack_test_command} && echo "PASS" || echo "FAIL"
255
112
 
256
- - [ ] Files follow naming pattern from guideline
257
- - [ ] Classes/structs/types follow naming convention
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
- #### 4. Design Patterns
116
+ echo "=== R9: Event Names Match Registry ==="
117
+ {check_event_names_consistency}
263
118
 
264
- - [ ] Required patterns are implemented (Repository, UseCase, etc.)
265
- - [ ] Patterns are used correctly
266
- - [ ] No anti-patterns present
267
- - [ ] Dependency injection done properly
119
+ echo "=== R10: Async Context Safety ==="
120
+ {check_no_request_context_in_goroutines}
121
+ ```
268
122
 
269
- #### 5. Data Flow
123
+ ### Stack-Specific Check Scripts
270
124
 
271
- - [ ] Data flows in correct direction
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
- #### 6. Testing Structure
127
+ ### Output
128
+ Record PASS/FAIL for each check. Continue to Phase 3 regardless — manual review catches what automated checks miss.
277
129
 
278
- - [ ] Tests follow guideline test structure
279
- - [ ] Test files in correct locations
280
- - [ ] Mocking follows guideline patterns
281
- - [ ] Test naming conventions followed
130
+ ### Gate
131
+ - [ ] All automated checks executed
132
+ - [ ] Results recorded
282
133
 
283
- ### Severity Levels
134
+ ---
284
135
 
285
- | Level | Description | Action |
286
- |-------|-------------|--------|
287
- | 🚨 **Critical** | Core architecture violation | Must fix |
288
- | ⚠️ **Major** | Significant deviation from guideline | Should fix |
289
- | ℹ️ **Minor** | Small inconsistency | Nice to fix |
290
- | 💡 **Suggestion** | Improvement opportunity | Optional |
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 6 dimensions reviewed
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
- **Goal**: Generate comprehensive architecture compliance report
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
- # Architecture Compliance Report
307
-
308
- ## Overview
309
- - **Architecture**: {name}
310
- - **Guideline**: {file path}
311
- - **Project**: {project name/path}
312
- - **Date**: {date}
313
- - **Overall Score**: {A/B/C/D/F}
314
-
315
- ## Score Breakdown
316
-
317
- | Dimension | Score | Status |
318
- |-----------|-------|--------|
319
- | Layer Boundaries | {1-10} | {✅/⚠️/❌} |
320
- | Directory Structure | {1-10} | {✅/⚠️/❌} |
321
- | Naming Conventions | {1-10} | {✅/⚠️/❌} |
322
- | Design Patterns | {1-10} | {✅/⚠️/❌} |
323
- | Data Flow | {1-10} | {✅/⚠️/❌} |
324
- | Testing Structure | {1-10} | {✅/⚠️/❌} |
325
-
326
- ## Grading Scale
327
- - **A (9-10)**: Excellent compliance, follows guideline closely
328
- - **B (7-8)**: Good compliance, minor deviations
329
- - **C (5-6)**: Moderate compliance, notable gaps
330
- - **D (3-4)**: Poor compliance, significant violations
331
- - **F (1-2)**: Non-compliant, does not follow architecture
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
- ## 🚨 Critical Violations ({count})
299
+ ### Scoring
336
300
 
337
- ### Violation 1: {title}
338
- - **Dimension**: {Layer Boundaries / Design Patterns / etc.}
339
- - **Location**: `{file}:{line}`
340
- - **Guideline Says**: {what the guideline requires}
341
- - **Actual**: {what the code does}
342
- - **Impact**: {why this matters}
343
- - **Fix**:
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
- ### Violation 2: ...
309
+ ### Gate
310
+ - [ ] Report generated
311
+ - [ ] Score calculated
312
+ - [ ] All violations listed with file:line
349
313
 
350
314
  ---
351
315
 
352
- ## ⚠️ Major Issues ({count})
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
- ## ℹ️ Minor Issues ({count})
364
-
365
- - [{file}:{line}] - {description}
366
- - [{file}:{line}] - {description}
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
- ## 💡 Suggestions ({count})
338
+ # Verify tests still pass
339
+ {stack_test_command}
371
340
 
372
- - {suggestion 1}
373
- - {suggestion 2}
341
+ # Re-check domain purity
342
+ {grep_forbidden_imports_in_domain}
343
+ ```
374
344
 
375
345
  ---
376
346
 
377
- ## Compliance Summary
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
- #### Priority 3 (Minor - Fix When Possible)
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
- ### Gate
412
- - [ ] Report generated with all sections
413
- - [ ] Score calculated
414
- - [ ] Action plan provided
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
- | Phase | Agent | Purpose |
422
- |-------|-------|---------|
423
- | SCAN | `@clean-architect` | Architecture compliance analysis |
424
- | REVIEW | `@code-reviewer` | Code quality check |
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
- .claude/architecture/{name}.md
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
- ### Supported Architectures
376
+ ### Aliases
442
377
  ```
443
- clean-architecture (alias: clean)
444
- react-frontend (alias: react)
445
- go-backend (alias: go)
446
- laravel-backend (alias: laravel)
447
- remix-fullstack (alias: remix)
448
- flutter-mobile (alias: flutter)
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 Dimensions
453
- | # | Dimension | Weight |
454
- |---|-----------|--------|
455
- | 1 | Layer Boundaries | Critical |
456
- | 2 | Directory Structure | High |
457
- | 3 | Naming Conventions | Medium |
458
- | 4 | Design Patterns | High |
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
+ ```