@anhth2/spec-driven-dev-plugin 0.5.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/ARCHITECTURE.md +243 -0
- package/bin/build.js +230 -0
- package/bin/index.js +311 -0
- package/commands/debug.md +374 -0
- package/commands/debug.tmpl +77 -0
- package/commands/define-product.md +451 -0
- package/commands/define-product.tmpl +154 -0
- package/commands/fix-bug.md +379 -0
- package/commands/fix-bug.tmpl +82 -0
- package/commands/generate-bdd.md +591 -0
- package/commands/generate-bdd.tmpl +294 -0
- package/commands/generate-code.md +395 -0
- package/commands/generate-code.tmpl +98 -0
- package/commands/generate-prd.md +488 -0
- package/commands/generate-prd.tmpl +191 -0
- package/commands/generate-tech-docs.md +362 -0
- package/commands/generate-tech-docs.tmpl +65 -0
- package/commands/generate-tests.md +377 -0
- package/commands/generate-tests.tmpl +80 -0
- package/commands/refine-prd.md +408 -0
- package/commands/refine-prd.tmpl +111 -0
- package/commands/review-code.md +354 -0
- package/commands/review-code.tmpl +57 -0
- package/commands/review-context.md +646 -0
- package/commands/review-context.tmpl +349 -0
- package/commands/review-tech-docs.md +518 -0
- package/commands/review-tech-docs.tmpl +221 -0
- package/commands/run-tests.md +343 -0
- package/commands/run-tests.tmpl +46 -0
- package/commands/setup-ai-first.md +278 -0
- package/commands/setup-ai-first.tmpl +197 -0
- package/commands/smoke-test.md +366 -0
- package/commands/smoke-test.tmpl +69 -0
- package/commands/validate-traces.md +529 -0
- package/commands/validate-traces.tmpl +232 -0
- package/core/FRAMEWORK_VERSION +1 -0
- package/core/commands/debug.md +374 -0
- package/core/commands/define-product.md +451 -0
- package/core/commands/fix-bug.md +379 -0
- package/core/commands/generate-bdd.md +591 -0
- package/core/commands/generate-code.md +395 -0
- package/core/commands/generate-prd.md +488 -0
- package/core/commands/generate-tech-docs.md +362 -0
- package/core/commands/generate-tests.md +377 -0
- package/core/commands/refine-prd.md +408 -0
- package/core/commands/review-code.md +354 -0
- package/core/commands/review-context.md +646 -0
- package/core/commands/review-tech-docs.md +518 -0
- package/core/commands/run-tests.md +343 -0
- package/core/commands/setup-ai-first.md +278 -0
- package/core/commands/smoke-test.md +366 -0
- package/core/commands/validate-traces.md +529 -0
- package/core/hooks/data-guard.js +141 -0
- package/core/hooks/settings.json +18 -0
- package/core/modules/angular/architecture-snippets/component-patterns.md +187 -0
- package/core/modules/angular/module.yaml +6 -0
- package/core/modules/angular/stack-profile.yaml +38 -0
- package/core/modules/context-engineering/architecture-snippets/context-design.md +119 -0
- package/core/modules/context-engineering/module.yaml +9 -0
- package/core/modules/context-engineering/stack-profile.yaml +61 -0
- package/core/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
- package/core/modules/dotnet/module.yaml +6 -0
- package/core/modules/dotnet/stack-profile.yaml +50 -0
- package/core/modules/golang/architecture-snippets/domain-layout.md +283 -0
- package/core/modules/golang/module.yaml +6 -0
- package/core/modules/golang/stack-profile.yaml +40 -0
- package/core/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
- package/core/modules/java-spring/module.yaml +15 -0
- package/core/modules/java-spring/stack-profile.yaml +28 -0
- package/core/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
- package/core/modules/nextjs/module.yaml +14 -0
- package/core/modules/nextjs/stack-profile.yaml +74 -0
- package/core/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
- package/core/modules/php-laravel/module.yaml +15 -0
- package/core/modules/php-laravel/stack-profile.yaml +56 -0
- package/core/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
- package/core/modules/react/module.yaml +14 -0
- package/core/modules/react/stack-profile.yaml +63 -0
- package/core/rules/data-protection.md +80 -0
- package/core/rules/workflow.md +44 -0
- package/core/skills/code/SKILL.md +526 -0
- package/core/skills/debug/SKILL.md +584 -0
- package/core/skills/discovery/SKILL.md +363 -0
- package/core/skills/prd/SKILL.md +456 -0
- package/core/skills/setup-ai-first/SKILL.md +160 -0
- package/core/skills/spec/SKILL.md +361 -0
- package/core/skills/test/SKILL.md +862 -0
- package/core/steps/context-loader.md +163 -0
- package/core/steps/gate.md +81 -0
- package/core/steps/report-footer.md +53 -0
- package/core/steps/spawn-agent.md +123 -0
- package/core/templates/architecture.template.md +113 -0
- package/core/templates/feature.template +259 -0
- package/core/templates/platform-guide.template.md +145 -0
- package/core/templates/prd.template.md +312 -0
- package/core/templates/product-definition.template.md +168 -0
- package/core/templates/project-context.yaml +78 -0
- package/hooks/data-guard.js +141 -0
- package/hooks/settings.json +18 -0
- package/modules/angular/architecture-snippets/component-patterns.md +187 -0
- package/modules/angular/module.yaml +6 -0
- package/modules/angular/stack-profile.yaml +38 -0
- package/modules/context-engineering/architecture-snippets/context-design.md +119 -0
- package/modules/context-engineering/module.yaml +9 -0
- package/modules/context-engineering/stack-profile.yaml +61 -0
- package/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
- package/modules/dotnet/module.yaml +6 -0
- package/modules/dotnet/stack-profile.yaml +50 -0
- package/modules/golang/architecture-snippets/domain-layout.md +283 -0
- package/modules/golang/module.yaml +6 -0
- package/modules/golang/stack-profile.yaml +40 -0
- package/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
- package/modules/java-spring/module.yaml +15 -0
- package/modules/java-spring/stack-profile.yaml +28 -0
- package/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
- package/modules/nextjs/module.yaml +14 -0
- package/modules/nextjs/stack-profile.yaml +74 -0
- package/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
- package/modules/php-laravel/module.yaml +15 -0
- package/modules/php-laravel/stack-profile.yaml +56 -0
- package/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
- package/modules/react/module.yaml +14 -0
- package/modules/react/stack-profile.yaml +63 -0
- package/package.json +42 -0
- package/rules/data-protection.md +80 -0
- package/rules/workflow.md +44 -0
- package/scripts/init.sh +49 -0
- package/scripts/upgrade.sh +94 -0
- package/skills/code/SKILL.md +526 -0
- package/skills/code/SKILL.tmpl +176 -0
- package/skills/debug/SKILL.md +584 -0
- package/skills/debug/SKILL.tmpl +262 -0
- package/skills/discovery/SKILL.md +363 -0
- package/skills/discovery/SKILL.tmpl +147 -0
- package/skills/prd/SKILL.md +456 -0
- package/skills/prd/SKILL.tmpl +188 -0
- package/skills/setup-ai-first/SKILL.md +160 -0
- package/skills/setup-ai-first/SKILL.tmpl +107 -0
- package/skills/spec/SKILL.md +361 -0
- package/skills/spec/SKILL.tmpl +174 -0
- package/skills/test/SKILL.md +862 -0
- package/skills/test/SKILL.tmpl +296 -0
- package/steps/context-loader.md +163 -0
- package/steps/gate.md +81 -0
- package/steps/report-footer.md +53 -0
- package/steps/spawn-agent.md +123 -0
- package/templates/architecture.template.md +113 -0
- package/templates/feature.template +259 -0
- package/templates/platform-guide.template.md +145 -0
- package/templates/prd.template.md +312 -0
- package/templates/product-definition.template.md +168 -0
- package/templates/project-context.yaml +78 -0
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
# /review-tech-docs — Review Technical Design Document
|
|
2
|
+
|
|
3
|
+
**READ-ONLY analysis mode — writes a findings file, does NOT modify the target.**
|
|
4
|
+
**Use `--resume` to apply accepted findings.**
|
|
5
|
+
|
|
6
|
+
## Gate
|
|
7
|
+
# Gate — Universal Entry Procedure
|
|
8
|
+
|
|
9
|
+
Every command must execute this gate before proceeding with its specific logic.
|
|
10
|
+
|
|
11
|
+
## Step 0 — Sub-Agent Mode Check
|
|
12
|
+
|
|
13
|
+
Before anything else, check if `$ARGUMENTS` is a JSON payload from an orchestrator:
|
|
14
|
+
|
|
15
|
+
1. Attempt to parse `$ARGUMENTS` as JSON.
|
|
16
|
+
2. If it parses successfully **and** contains `"_agent_mode": true`:
|
|
17
|
+
- **Skip Steps 1, 2, and 3 of this Gate entirely.**
|
|
18
|
+
- Set target file = `payload.target_file`
|
|
19
|
+
- Set loaded context = `payload.context` (do NOT run context-loader.md)
|
|
20
|
+
- Set UC scope = `payload.uc_id` (process only this UC)
|
|
21
|
+
- Set line range = `payload.uc_section` (read only that PRD section)
|
|
22
|
+
- Proceed directly to the command-specific logic.
|
|
23
|
+
3. If `$ARGUMENTS` is not JSON or `_agent_mode` is absent → continue to Step 1 (normal mode).
|
|
24
|
+
|
|
25
|
+
## Step 0-B — Model Check
|
|
26
|
+
|
|
27
|
+
*Skip this step if `_agent_mode: true` (sub-agent — orchestrator already validated).*
|
|
28
|
+
|
|
29
|
+
Complex generation and review commands require strong reasoning.
|
|
30
|
+
Using a smaller model risks missed edge cases, incomplete spec analysis, and architecture violations.
|
|
31
|
+
|
|
32
|
+
Display and wait for response:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
⚙️ MODEL CHECK
|
|
36
|
+
──────────────────────────────────────────────────────────────────
|
|
37
|
+
Recommended : claude-opus-4-5 (or claude-opus-4)
|
|
38
|
+
Why needed : Spec analysis, architecture review, code generation
|
|
39
|
+
require deep reasoning. Smaller models miss edge cases.
|
|
40
|
+
|
|
41
|
+
To switch in Claude Code:
|
|
42
|
+
• Settings → Model → select "claude-opus"
|
|
43
|
+
• or: /model → choose claude-opus
|
|
44
|
+
|
|
45
|
+
Running on claude-opus?
|
|
46
|
+
Y — yes, on claude-opus → proceed
|
|
47
|
+
S — skip check (I accept lower quality risk with current model)
|
|
48
|
+
──────────────────────────────────────────────────────────────────
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- "Y" → proceed to Step 1.
|
|
52
|
+
- "S" → proceed to Step 1 (user accepts risk, add ⚠️ to final report).
|
|
53
|
+
- "N" or anything else → **STOP.** Output: "Please switch to claude-opus, then re-run this command."
|
|
54
|
+
|
|
55
|
+
## Step 1 — Resolve Target File
|
|
56
|
+
|
|
57
|
+
1. If `$ARGUMENTS` is provided and points to an existing file → use it directly as the target.
|
|
58
|
+
2. If `$ARGUMENTS` is a UC-ID, ticket ID, or partial name → search for matching files in the relevant directory.
|
|
59
|
+
3. If `$ARGUMENTS` is empty or no match found:
|
|
60
|
+
- List files in the relevant directory for this command (e.g., `specs/prd/**/*.md` for PRD commands, `specs/bdd/**/*.feature` for BDD commands).
|
|
61
|
+
- Present the list to the user and ask: "Which file do you want to work with? (Enter number or filename)"
|
|
62
|
+
- Wait for user selection before continuing.
|
|
63
|
+
|
|
64
|
+
## Step 2 — Execute Context Loader
|
|
65
|
+
|
|
66
|
+
Load all project context by following the procedure in `steps/context-loader.md`.
|
|
67
|
+
Store all loaded context in memory for use throughout this command session.
|
|
68
|
+
|
|
69
|
+
## Step 3 — CHECKPOINT
|
|
70
|
+
|
|
71
|
+
After completing Steps 1 and 2, display a summary and wait for confirmation:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
CHECKPOINT
|
|
75
|
+
-----------
|
|
76
|
+
Target : {resolved file path}
|
|
77
|
+
Project : {project.name from project-context.yaml}
|
|
78
|
+
Tech stack : {language} / {framework}
|
|
79
|
+
Module : {module if set, else "not configured"}
|
|
80
|
+
Domains : {comma-separated domain list}
|
|
81
|
+
|
|
82
|
+
Proceed? (Y/N)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Wait for explicit "Y" or "N" from the user before continuing.
|
|
86
|
+
- "Y" → proceed to the command-specific steps below.
|
|
87
|
+
- "N" → stop and ask what the user wants to change.
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
*Note: For this command, the target in Step 1 is a tech-design `.md` file in `{paths.tech_docs_dir}/{domain}/`.
|
|
91
|
+
If `$ARGUMENTS` contains `--resume` → skip to Resume Mode below.*
|
|
92
|
+
|
|
93
|
+
## Context
|
|
94
|
+
# Context Loader — Load All Project Context
|
|
95
|
+
|
|
96
|
+
Execute these steps in order. Store everything in memory for the duration of the command session.
|
|
97
|
+
|
|
98
|
+
**Priority guide (anti-lost-in-middle):**
|
|
99
|
+
- Steps 1–2 are PROJECT-CONFIG — loaded first, resolve all paths and metadata.
|
|
100
|
+
- Step 3 is CRITICAL — architecture + coding standards, the highest-priority facts for generation.
|
|
101
|
+
- Step 4 is SAFETY — data protection rules, enforced silently for the entire session.
|
|
102
|
+
- Steps 5–6 are DOMAIN KNOWLEDGE — terminology and entity definitions.
|
|
103
|
+
- Step 7 is the WORKING MEMORY RECAP — locks critical facts into the top of working memory.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Step 1 — [PROJECT-CONFIG] Load project-context.yaml
|
|
108
|
+
|
|
109
|
+
Read `.agent/project-context.yaml`. Extract and store:
|
|
110
|
+
|
|
111
|
+
**Tech Stack:**
|
|
112
|
+
- `tech_stack.language` → active language (e.g., Java 17, TypeScript, C#, Go)
|
|
113
|
+
- `tech_stack.framework` → active framework (e.g., Spring Boot 3.2, Angular 17, .NET 8)
|
|
114
|
+
- `tech_stack.build_tool` → build tool (e.g., Maven, npm, dotnet, go)
|
|
115
|
+
- `tech_stack.test_framework` → test framework (e.g., JUnit 5 + Mockito, Jest, xUnit)
|
|
116
|
+
- `tech_stack.database` → database (e.g., PostgreSQL, MySQL, MongoDB)
|
|
117
|
+
- `tech_stack.module` → active module profile (e.g., java-spring, angular, dotnet, golang, context-engineering)
|
|
118
|
+
|
|
119
|
+
**Conventions:**
|
|
120
|
+
- `conventions.build_command` → how to compile/build
|
|
121
|
+
- `conventions.test_command` → how to run tests
|
|
122
|
+
- `conventions.service_run` → how to start the service
|
|
123
|
+
- `conventions.ticket_prefix` → ticket ID prefix (e.g., PROJ, FEAT, UC)
|
|
124
|
+
|
|
125
|
+
**Domains:**
|
|
126
|
+
- `domains` → list of active business domains
|
|
127
|
+
|
|
128
|
+
**Paths (if present):**
|
|
129
|
+
- `paths.specs_dir` → BDD specs root
|
|
130
|
+
- `paths.prd_dir` → PRD documents root
|
|
131
|
+
- `paths.refinement_dir` → findings/review output dir
|
|
132
|
+
- `paths.product_definitions_dir` → product definitions root
|
|
133
|
+
- `paths.domain_knowledge_dir` → domain knowledge root
|
|
134
|
+
- `paths.business_dictionary` → path to business-dictionary.md
|
|
135
|
+
- `paths.core_entities` → path to core-entities.md
|
|
136
|
+
- `paths.tech_docs_dir` → technical documentation root
|
|
137
|
+
- `paths.trace_dir` → trace state directory
|
|
138
|
+
|
|
139
|
+
If `paths` section is absent, use these defaults:
|
|
140
|
+
- `specs_dir` = `specs/bdd`
|
|
141
|
+
- `prd_dir` = `specs/prd`
|
|
142
|
+
- `refinement_dir` = `.agent/review`
|
|
143
|
+
- `product_definitions_dir` = `specs/product-definition`
|
|
144
|
+
- `domain_knowledge_dir` = `specs/domain-knowledge`
|
|
145
|
+
- `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
|
|
146
|
+
- `core_entities` = `specs/domain-knowledge/core-entities.md`
|
|
147
|
+
- `tech_docs_dir` = `tech-docs`
|
|
148
|
+
- `trace_dir` = `.trace`
|
|
149
|
+
|
|
150
|
+
If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
|
|
155
|
+
|
|
156
|
+
If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
|
|
157
|
+
Merge framework-specific conventions (layer patterns, test patterns, naming rules) into the loaded context.
|
|
158
|
+
If the file does not exist → skip silently.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Step 3 — [CRITICAL] Load CLAUDE.md
|
|
163
|
+
|
|
164
|
+
*This is the highest-priority context — it defines HOW to write code and documents for this project.*
|
|
165
|
+
|
|
166
|
+
Read `CLAUDE.md`. Extract and store:
|
|
167
|
+
|
|
168
|
+
- **§1 Project Overview** → project name, language, framework, build/test commands, domains
|
|
169
|
+
- **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules
|
|
170
|
+
- **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns
|
|
171
|
+
- **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name
|
|
172
|
+
- **§7 Git Conventions** → branch naming pattern, commit message format
|
|
173
|
+
|
|
174
|
+
If `CLAUDE.md` does not exist → note it as missing and continue with project-context.yaml data only.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Step 4 — [SAFETY] Load Data Protection Rules
|
|
179
|
+
|
|
180
|
+
Read `.agent/rules/data-protection.md` (or `rules/data-protection.md` from the framework installation).
|
|
181
|
+
|
|
182
|
+
Store the sensitive file patterns — you must **never** read, write, display, or reference content from files matching those patterns for the entire session.
|
|
183
|
+
|
|
184
|
+
If neither file exists → apply built-in defaults: never access `.env*`, `*.key`, `*.pem`, `*secret*`, `*password*`, `*credential*`.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Step 5 — [DOMAIN] Load Business Dictionary (conditional)
|
|
189
|
+
|
|
190
|
+
Check if the business dictionary file exists (use `paths.business_dictionary` resolved in Step 1).
|
|
191
|
+
|
|
192
|
+
If it exists, read it and extract:
|
|
193
|
+
- **Canonical Terms** → complete list of approved terms and their definitions
|
|
194
|
+
- **Banned Terms** → complete list of banned terms and their canonical replacements
|
|
195
|
+
- **Status / Enum Registry** → allowed enum values per entity
|
|
196
|
+
|
|
197
|
+
Store the banned terms list for **active enforcement** throughout the command session:
|
|
198
|
+
- When generating any text (PRD, BDD, code comments, tech docs), verify no banned terms appear
|
|
199
|
+
- Replace banned terms with their canonical equivalents automatically
|
|
200
|
+
|
|
201
|
+
If the file does not exist → skip silently. Do not warn or block.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Step 6 — [DOMAIN] Load Core Entities (conditional)
|
|
206
|
+
|
|
207
|
+
Check if the core entities file exists at `paths.core_entities` (resolved in Step 1).
|
|
208
|
+
Default path: `specs/domain-knowledge/core-entities.md`.
|
|
209
|
+
|
|
210
|
+
If it exists, read it and store:
|
|
211
|
+
- **Entity catalog** → for each entity: its name, purpose, owner service, key fields (name + type), business invariants, and relationships
|
|
212
|
+
- **Field name registry** → canonical field names to use in generated code and documents
|
|
213
|
+
- **Relationship map** → how entities relate to each other (1:N, N:N, embedded, etc.)
|
|
214
|
+
|
|
215
|
+
**How to use this catalog:**
|
|
216
|
+
- When generating code: use the field names, types, and relationships defined here — do NOT infer from existing code
|
|
217
|
+
- When generating PRD/BDD: reference entity names from this catalog for consistency
|
|
218
|
+
- When generating tech-docs: use this catalog as the source-of-truth for entity definitions
|
|
219
|
+
|
|
220
|
+
If the file does not exist → skip silently.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
|
|
225
|
+
|
|
226
|
+
After loading all context, synthesize and output a compact summary block.
|
|
227
|
+
This recap ensures the most critical facts are stated at the END of context loading
|
|
228
|
+
(recency effect — freshest in working memory when the task begins).
|
|
229
|
+
|
|
230
|
+
Output exactly this block:
|
|
231
|
+
```
|
|
232
|
+
[CTX LOADED]
|
|
233
|
+
Stack : {language} / {framework} / {database}
|
|
234
|
+
Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
|
|
235
|
+
Ticket : {ticket_prefix}-
|
|
236
|
+
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
237
|
+
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
238
|
+
Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
If any CRITICAL file is missing (CLAUDE.md), flag it clearly so the user can decide whether to proceed.
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Context Load Complete
|
|
246
|
+
|
|
247
|
+
After completing all steps, you have loaded:
|
|
248
|
+
- Project identity, tech stack, module conventions
|
|
249
|
+
- Architecture rules and layer order ← **[CRITICAL — hold in working memory]**
|
|
250
|
+
- Coding standards and naming conventions ← **[CRITICAL — hold in working memory]**
|
|
251
|
+
- Data protection rules (sensitive file patterns to never access)
|
|
252
|
+
- Terminology rules with banned-term list ← **[DOMAIN — apply to every generated word]**
|
|
253
|
+
- Entity catalog (field names, types, invariants) ← **[DOMAIN — use for code generation]**
|
|
254
|
+
- All configured paths
|
|
255
|
+
|
|
256
|
+
Proceed to the next step of the calling command.
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Load Review Materials
|
|
262
|
+
|
|
263
|
+
After loading base context, read the following in order:
|
|
264
|
+
|
|
265
|
+
1. **Target tech-doc** — read fully. Extract from header:
|
|
266
|
+
- `@trace.id` → UC-ID
|
|
267
|
+
- `@trace.domain` → domain
|
|
268
|
+
- `@trace.prd` → source PRD ticket ID
|
|
269
|
+
- `@trace.status` → current status (draft / in-review / approved)
|
|
270
|
+
|
|
271
|
+
2. **Source feature file** — load `{paths.specs_dir}/{domain}/{UC-ID}*.feature` if exists.
|
|
272
|
+
|
|
273
|
+
3. **Other tech-docs in same domain** — list and load all `.md` files in
|
|
274
|
+
`{paths.tech_docs_dir}/{domain}/` excluding the target. Used for conflict checking (T4).
|
|
275
|
+
|
|
276
|
+
4. **Architecture reference** — re-confirm CLAUDE.md §2: layer order, architectural rules.
|
|
277
|
+
|
|
278
|
+
5. **Core entities** — already loaded in context (Step 6 of context-loader).
|
|
279
|
+
|
|
280
|
+
Derive findings filename:
|
|
281
|
+
`{paths.refinement_dir}/{uc-id}-tech-review-findings.yaml`
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Review Dimensions
|
|
286
|
+
|
|
287
|
+
### T1 — Architecture Alignment *(always CRITICAL if violated)*
|
|
288
|
+
|
|
289
|
+
Cross-reference the proposed design against CLAUDE.md §2 rules:
|
|
290
|
+
|
|
291
|
+
| Violation type | Severity |
|
|
292
|
+
|----------------|----------|
|
|
293
|
+
| Controller calls Repository directly (layer skip) | Critical |
|
|
294
|
+
| Business logic in Controller or DTO | Critical |
|
|
295
|
+
| Forbidden pattern from §3 | Critical |
|
|
296
|
+
| Dependency going upstream (Service → Controller DTO) | Critical |
|
|
297
|
+
| Transaction annotation on wrong layer | Major |
|
|
298
|
+
| Missing separation (no Facade when arch requires it) | Major |
|
|
299
|
+
|
|
300
|
+
For each finding:
|
|
301
|
+
```
|
|
302
|
+
Component: {class or method name}
|
|
303
|
+
Violates: "{rule text}" (CLAUDE.md §2)
|
|
304
|
+
Fix: {which layer/component should own this instead}
|
|
305
|
+
```
|
|
306
|
+
→ **Not auto-fixable.** Human must decide structural fix. Note required in Review Board.
|
|
307
|
+
|
|
308
|
+
### T2 — Entity Consistency
|
|
309
|
+
|
|
310
|
+
Using the loaded core-entities catalog:
|
|
311
|
+
|
|
312
|
+
| Issue | Severity | Auto-fixable? |
|
|
313
|
+
|-------|----------|---------------|
|
|
314
|
+
| Entity mentioned not in core-entities.md | Major | No — human confirms if DTO or domain entity |
|
|
315
|
+
| Field name differs from core-entities.md | Major | Yes — rename to canonical |
|
|
316
|
+
| Relationship described differently | Major | No — human decides |
|
|
317
|
+
| New entity introduced but not in core-entities.md | Minor | No — add to core-entities first |
|
|
318
|
+
|
|
319
|
+
### T3 — BDD Traceability
|
|
320
|
+
|
|
321
|
+
Cross-reference against the source `.feature` file:
|
|
322
|
+
|
|
323
|
+
| Issue | Severity | Auto-fixable? |
|
|
324
|
+
|-------|----------|---------------|
|
|
325
|
+
| Tech-doc proposes behavior not in any BDD scenario | Major | No — create scenario first |
|
|
326
|
+
| Tech-doc contradicts a BDD scenario | Critical | No — resolve conflict first |
|
|
327
|
+
| UC scenario has no corresponding design decision | Minor | Yes — add missing design note |
|
|
328
|
+
|
|
329
|
+
### T4 — Domain Conflict Check
|
|
330
|
+
|
|
331
|
+
Compare against other tech-docs in `{paths.tech_docs_dir}/{domain}/`:
|
|
332
|
+
|
|
333
|
+
| Issue | Severity | Auto-fixable? |
|
|
334
|
+
|-------|----------|---------------|
|
|
335
|
+
| Same endpoint defined with different request/response | Critical | No — human resolves |
|
|
336
|
+
| Same service method with different behavior | Critical | No — human resolves |
|
|
337
|
+
| Entity status transitions differ between docs | Critical | No — human resolves |
|
|
338
|
+
| Overlapping responsibility (both docs claim ownership of same logic) | Major | No — human resolves |
|
|
339
|
+
|
|
340
|
+
### T5 — Internal Consistency
|
|
341
|
+
|
|
342
|
+
Within the tech-doc itself:
|
|
343
|
+
|
|
344
|
+
| Check | Severity | Auto-fixable? |
|
|
345
|
+
|-------|----------|---------------|
|
|
346
|
+
| Sequence diagram shows different flow than written description | Major | No |
|
|
347
|
+
| API spec return type differs from code sketch | Major | Yes — align one to the other |
|
|
348
|
+
| Section references a component/concept never defined later | Minor | Yes — add definition |
|
|
349
|
+
| Assumption stated but no design addresses it | Minor | Yes — add note or remove assumption |
|
|
350
|
+
|
|
351
|
+
### T6 — Structural Completeness
|
|
352
|
+
|
|
353
|
+
Check all standard sections are present and non-empty:
|
|
354
|
+
|
|
355
|
+
| Section | Missing severity |
|
|
356
|
+
|---------|-----------------|
|
|
357
|
+
| Header (`@trace.id`, `@trace.prd`, `@trace.domain`, `@trace.status`) | Major |
|
|
358
|
+
| Overview / Context | Major |
|
|
359
|
+
| Architecture Decision with rationale | Major |
|
|
360
|
+
| Component Diagram or Layer Description | Major |
|
|
361
|
+
| Sequence Diagram or Flow Steps | Major |
|
|
362
|
+
| API Contract (if HTTP-facing) | Major |
|
|
363
|
+
| Data Model Changes (if entity changes) | Major |
|
|
364
|
+
| Error Handling Strategy | Major |
|
|
365
|
+
| Open Questions / Assumptions | Minor |
|
|
366
|
+
|
|
367
|
+
→ All T6 missing-section findings are **auto-fixable**: AI adds skeleton section with prompts.
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## Write Findings File
|
|
372
|
+
|
|
373
|
+
After running all checks, write findings to `{paths.refinement_dir}/{uc-id}-tech-review-findings.yaml`:
|
|
374
|
+
|
|
375
|
+
```yaml
|
|
376
|
+
source_file: "{absolute path to tech-doc}"
|
|
377
|
+
uc_id: "{UC-ID}"
|
|
378
|
+
domain: "{domain}"
|
|
379
|
+
generated_at: "{ISO datetime}"
|
|
380
|
+
review_type: "tech-design"
|
|
381
|
+
status: "pending_review"
|
|
382
|
+
|
|
383
|
+
findings:
|
|
384
|
+
- id: "F001"
|
|
385
|
+
check_id: "T1" # T1–T6
|
|
386
|
+
severity: "critical" # critical | major | minor
|
|
387
|
+
section: "{section heading or component name where issue was found}"
|
|
388
|
+
finding: "{clear description of the violation or gap}"
|
|
389
|
+
suggestion: "{specific fix — AI applies this in --resume if accepted}"
|
|
390
|
+
auto_fixable: false # true = AI can apply; false = human must write decision in note
|
|
391
|
+
status: "pending" # pending | accepted | modified | rejected | deferred
|
|
392
|
+
|
|
393
|
+
summary:
|
|
394
|
+
total_findings: {N}
|
|
395
|
+
by_severity: { critical: {N}, major: {N}, minor: {N} }
|
|
396
|
+
auto_fixable: {N}
|
|
397
|
+
requires_human_decision: {N}
|
|
398
|
+
recommendation: "APPROVED | NEEDS_REVISION | BLOCKED"
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
## Report
|
|
402
|
+
|
|
403
|
+
# Report Footer — Standard Command Output Format
|
|
404
|
+
|
|
405
|
+
Every command report must end with this standard footer section.
|
|
406
|
+
|
|
407
|
+
## Status Badge
|
|
408
|
+
|
|
409
|
+
Choose one based on outcome:
|
|
410
|
+
- `✅ Complete` — all steps succeeded, no issues found
|
|
411
|
+
- `❌ Failed` — command could not complete due to a blocking error
|
|
412
|
+
- `⚠️ Warnings` — completed with non-blocking issues that should be reviewed
|
|
413
|
+
|
|
414
|
+
## Output Artifacts
|
|
415
|
+
|
|
416
|
+
List every file created or modified by this command:
|
|
417
|
+
```
|
|
418
|
+
Output Artifacts:
|
|
419
|
+
{created|updated} {file-path} ({brief description})
|
|
420
|
+
{created|updated} {file-path} ({brief description})
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
|
|
424
|
+
|
|
425
|
+
## Next Command Suggestion
|
|
426
|
+
|
|
427
|
+
Suggest the logical next command based on workflow phase:
|
|
428
|
+
|
|
429
|
+
| Current command | Suggest next |
|
|
430
|
+
|-------------------------|-----------------------------------------------|
|
|
431
|
+
| /define-product | `/generate-prd {product-definition-file}` |
|
|
432
|
+
| /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
|
|
433
|
+
| /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
|
|
434
|
+
| /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
|
|
435
|
+
| /generate-bdd | `/review-context {feature-file}` to verify coverage |
|
|
436
|
+
| /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
|
|
437
|
+
| /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
|
|
438
|
+
| /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
|
|
439
|
+
| /generate-code | `/generate-tests {UC-ID}` |
|
|
440
|
+
| /generate-tests | `/run-tests {UC-ID}` |
|
|
441
|
+
| /run-tests (passing) | `/review-code {UC-ID}` |
|
|
442
|
+
| /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
|
|
443
|
+
| /review-code | `/smoke-test {UC-ID}` or create PR |
|
|
444
|
+
| /smoke-test | Create PR and link to ticket |
|
|
445
|
+
| /validate-traces | `/generate-code {UC-ID}` for gaps |
|
|
446
|
+
| /fix-bug | Create PR and link to ticket |
|
|
447
|
+
| /debug | `/fix-bug {ticket-id}` if fix needed |
|
|
448
|
+
|
|
449
|
+
Format the footer as:
|
|
450
|
+
```
|
|
451
|
+
---
|
|
452
|
+
Status : {badge}
|
|
453
|
+
{Output Artifacts block}
|
|
454
|
+
Next : {suggested command with example arguments}
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
```
|
|
459
|
+
/review-tech-docs Complete — {target file}
|
|
460
|
+
UC: {UC-ID} | Domain: {domain}
|
|
461
|
+
Findings: {total} | 🔴 Critical: {N} | 🟡 Major: {N} | 🟢 Minor: {N}
|
|
462
|
+
Auto-fixable: {N} | Needs human decision: {N}
|
|
463
|
+
|
|
464
|
+
Findings file: {paths.refinement_dir}/{uc-id}-tech-review-findings.yaml
|
|
465
|
+
Next: Open in Review Board → Accept/Modify/Reject each finding
|
|
466
|
+
Then run: /review-tech-docs --resume {tech-design-file}
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
## Resume Mode — Apply Accepted Findings
|
|
472
|
+
|
|
473
|
+
*Triggered when `$ARGUMENTS` contains `--resume`.*
|
|
474
|
+
*Example: `/review-tech-docs --resume tech-docs/payment/PAY-UC1-tech-design.md`*
|
|
475
|
+
|
|
476
|
+
### Phase 1 — Read accepted findings
|
|
477
|
+
|
|
478
|
+
1. Derive findings file from target: `{paths.refinement_dir}/{uc-id}-tech-review-findings.yaml`
|
|
479
|
+
2. Read the file. Collect findings where `status: "accepted"` or `status: "modified"`.
|
|
480
|
+
3. If none → report "No accepted findings. File unchanged." and stop.
|
|
481
|
+
|
|
482
|
+
### Phase 2 — Apply fixes
|
|
483
|
+
|
|
484
|
+
Apply in order: critical → major → minor.
|
|
485
|
+
|
|
486
|
+
| check_id | What to do |
|
|
487
|
+
|----------|-----------|
|
|
488
|
+
| T1 (Architecture) | Apply the structural fix from finding note — move logic to correct layer, update component description |
|
|
489
|
+
| T2 (Field name) | Rename field to canonical name from core-entities.md throughout the document |
|
|
490
|
+
| T3 (Missing design note) | Add design decision note for the uncovered scenario |
|
|
491
|
+
| T5 (Internal inconsistency) | Align the conflicting sections to the decision stated in the note |
|
|
492
|
+
| T6 (Missing section) | Add skeleton section with placeholder prompts for the tech lead to fill |
|
|
493
|
+
|
|
494
|
+
**T1, T2, T4 findings with `auto_fixable: false`:** require a human-written resolution in the
|
|
495
|
+
Review Board "Modify" note. Apply exactly what the note says. Do not invent the fix.
|
|
496
|
+
|
|
497
|
+
### Phase 3 — Update header + Report
|
|
498
|
+
|
|
499
|
+
1. Increment `@trace.revision` in the tech-doc header by 1.
|
|
500
|
+
2. Update `@trace.status` to `draft` (reset — must be re-approved after changes).
|
|
501
|
+
|
|
502
|
+
```
|
|
503
|
+
/review-tech-docs --resume Applied — {target file}
|
|
504
|
+
UC: {UC-ID}
|
|
505
|
+
|
|
506
|
+
Applied : {N} findings ({critical} critical, {major} major, {minor} minor)
|
|
507
|
+
Skipped : {N} rejected/deferred
|
|
508
|
+
|
|
509
|
+
Changes:
|
|
510
|
+
- {change 1}
|
|
511
|
+
- {change 2}
|
|
512
|
+
|
|
513
|
+
Revision : {old} → {new}
|
|
514
|
+
Status : reset to draft (re-approval required)
|
|
515
|
+
|
|
516
|
+
Re-run /review-tech-docs {file} to confirm 0 remaining critical findings.
|
|
517
|
+
Next: /generate-code {feature-file}
|
|
518
|
+
```
|