@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,262 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Fixes bugs with full workflow (branch, test, commit), performs quick debug analysis of errors or unexpected behavior, or validates traceability coverage between specs and code. Trigger when: "/fix-bug", "/debug", "/validate-traces", "fix bug", "sửa bug", "debug lỗi", "phân tích lỗi", "tại sao lỗi này", "validate traces", "kiểm tra traceability", "coverage matrix", "trace drift".
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Debug & Quality Skills — Fix Bug, Debug, Validate Traces
|
|
6
|
+
|
|
7
|
+
This skill handles: `/fix-bug` (full bug fix workflow), `/debug` (quick analysis), and `/validate-traces` (traceability coverage check).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## /fix-bug — Full Bug Fix Workflow
|
|
12
|
+
|
|
13
|
+
### Input
|
|
14
|
+
|
|
15
|
+
Accept: ticket ID (e.g. `PROJ-123`) or a direct bug description.
|
|
16
|
+
|
|
17
|
+
### Phase 1 — Gather Information
|
|
18
|
+
|
|
19
|
+
If ticket ID provided:
|
|
20
|
+
- Fetch ticket details if Jira/issue tracker is connected
|
|
21
|
+
- Otherwise ask user to paste: title, steps to reproduce, expected vs actual
|
|
22
|
+
|
|
23
|
+
If no ticket:
|
|
24
|
+
**CHECKPOINT** — Ask:
|
|
25
|
+
1. Where does the bug occur? (service, endpoint, flow)
|
|
26
|
+
2. Steps to reproduce?
|
|
27
|
+
3. Expected vs Actual behavior?
|
|
28
|
+
4. Error log / stack trace (if any)?
|
|
29
|
+
|
|
30
|
+
### Phase 2 — Root Cause Analysis
|
|
31
|
+
|
|
32
|
+
{{include:steps/context-loader.md}}
|
|
33
|
+
|
|
34
|
+
Trace through layers (from CLAUDE.md architecture):
|
|
35
|
+
1. Identify the service/module from the failing endpoint/feature
|
|
36
|
+
2. Read relevant code files, layer by layer
|
|
37
|
+
3. Match against common bug patterns:
|
|
38
|
+
|
|
39
|
+
| Bug Type | Common Location | How to Check |
|
|
40
|
+
|----------|----------------|--------------|
|
|
41
|
+
| Wrong response data | Data mapping layer | Check field mapping, DTO conversions |
|
|
42
|
+
| 400 Bad Request | Input validation | Check DTO constraints, required fields |
|
|
43
|
+
| 403 Forbidden | Auth configuration | Check role-based access rules |
|
|
44
|
+
| 404 Not Found | Repository query | Check find method, ID types |
|
|
45
|
+
| Slow query / N+1 | Data access layer | Check for missing JOIN FETCH or batch loading |
|
|
46
|
+
| Null Pointer | Missing null checks, optional not handled | Check Optional.orElseThrow usage |
|
|
47
|
+
| Transaction rollback | Missing/wrong transaction scope | Check @Transactional on service methods |
|
|
48
|
+
| Stale cache | Missing cache eviction after write | Check cache invalidation on write operations |
|
|
49
|
+
| Type mismatch in query | Filter/specification code | Check field types in query predicates |
|
|
50
|
+
| Cross-service timeout | External service call | Check URL config, fallback behavior |
|
|
51
|
+
|
|
52
|
+
**CHECKPOINT — Root Cause Report:**
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
Root Cause Analysis — {TICKET_ID}:
|
|
56
|
+
|
|
57
|
+
Bug: {description}
|
|
58
|
+
Affected module: {module/service}
|
|
59
|
+
Root cause: {specific technical analysis}
|
|
60
|
+
Affected files:
|
|
61
|
+
- {file}: {what's wrong}
|
|
62
|
+
|
|
63
|
+
Proposed fix:
|
|
64
|
+
- {file}: {what to change}
|
|
65
|
+
|
|
66
|
+
Regression risk: Low / Medium / High
|
|
67
|
+
→ Reason: {explanation}
|
|
68
|
+
|
|
69
|
+
Proceed with fix? (Y/N)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Wait for user confirmation.
|
|
73
|
+
|
|
74
|
+
### Phase 3 — Implement Fix
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git checkout -b fix/{TICKET_ID}-{short-description}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Apply the fix exactly as analyzed. Follow CLAUDE.md coding standards — do not introduce new violations.
|
|
81
|
+
|
|
82
|
+
Add traceability annotation if the file has `@trace.implements`:
|
|
83
|
+
```
|
|
84
|
+
// @trace.implements={UC-ID}-SC{N}
|
|
85
|
+
// @trace.fixes={TICKET_ID}
|
|
86
|
+
// @trace.root_cause={brief description}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Phase 4 — Regression Test
|
|
90
|
+
|
|
91
|
+
Generate a regression test if one doesn't exist:
|
|
92
|
+
```
|
|
93
|
+
// @trace.verifies={UC-ID}
|
|
94
|
+
// @trace.regression={TICKET_ID}
|
|
95
|
+
Test: "Regression {TICKET_ID}: {bug description}"
|
|
96
|
+
→ Reproduce the exact bug scenario
|
|
97
|
+
→ Assert the fix works correctly
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Run the test: `{TEST_COMMAND_FOR_CLASS}`
|
|
101
|
+
|
|
102
|
+
If test fails → debug and fix (max 3 iterations).
|
|
103
|
+
|
|
104
|
+
### Phase 5 — Build Verify
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
{BUILD_COMMAND} # max 3 retries
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Phase 6 — Commit & Push
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
git add {changed files}
|
|
114
|
+
git commit -m "fix({TICKET_ID}): {brief description}"
|
|
115
|
+
git push -u origin fix/{TICKET_ID}-{slug}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Output
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
/fix-bug Complete — {TICKET_ID}
|
|
122
|
+
|
|
123
|
+
## Root Cause
|
|
124
|
+
{analysis}
|
|
125
|
+
|
|
126
|
+
## Changes
|
|
127
|
+
- {file}: {what changed and why}
|
|
128
|
+
|
|
129
|
+
## Regression Test
|
|
130
|
+
✅ Added: {TestClass}.{method}
|
|
131
|
+
✅ Build: SUCCESS
|
|
132
|
+
|
|
133
|
+
## Branch
|
|
134
|
+
fix/{TICKET_ID}-{slug}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
{{include:steps/report-footer.md}}
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## /debug — Quick Debug Analysis
|
|
142
|
+
|
|
143
|
+
Use when: IDE shows an error, test fails unexpectedly, behavior is strange, or you need to understand why code does something.
|
|
144
|
+
|
|
145
|
+
**Different from `/fix-bug`**: This is analysis only, no full workflow, no ticket required.
|
|
146
|
+
|
|
147
|
+
### Input
|
|
148
|
+
|
|
149
|
+
Paste one of:
|
|
150
|
+
1. Stack trace / error log
|
|
151
|
+
2. Test failure output
|
|
152
|
+
3. File path + description of unexpected behavior
|
|
153
|
+
4. A specific question about a code snippet
|
|
154
|
+
|
|
155
|
+
### Stack Trace Analysis
|
|
156
|
+
|
|
157
|
+
Read stack trace from **bottom up** — the `Caused by:` line is the real root cause.
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
Caused by: {RealException} ← start here
|
|
161
|
+
at {class}.{method}({file}:{line}) ← trace from here
|
|
162
|
+
...
|
|
163
|
+
at {entrypoint} ← where it was called from
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Common Error Patterns
|
|
167
|
+
|
|
168
|
+
| Error | Likely Cause | Fix Direction |
|
|
169
|
+
|-------|-------------|---------------|
|
|
170
|
+
| NullPointerException | Accessing field on null object; Optional not handled | Check Optional.orElseThrow, null guards |
|
|
171
|
+
| ClassCastException | Wrong type assumption; incorrect generic usage | Check type at assignment/return point |
|
|
172
|
+
| OutOfMemoryError | Loading too much data; memory leak | Add pagination, check collection sizes |
|
|
173
|
+
| StackOverflowError | Infinite recursion | Find recursive call with no base case |
|
|
174
|
+
| Connection refused | Dependency service not running | Check config URLs, start dependent service |
|
|
175
|
+
| Authentication/401 | Token expired, wrong config, missing header | Verify token, check auth config |
|
|
176
|
+
| Permission denied/403 | Wrong role in request or misconfigured access rules | Check auth annotations and role config |
|
|
177
|
+
| Database constraint violation | Duplicate key, missing FK, null in NOT NULL column | Check data and constraint definitions |
|
|
178
|
+
| Serialization error | Circular reference, unmapped field | Check DTO/mapper configuration |
|
|
179
|
+
| Test assertion mismatch | Wrong mock setup or wrong expected value | Re-read mock setup and assertion logic |
|
|
180
|
+
|
|
181
|
+
### Test Failure Analysis
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
Expected: {expected value}
|
|
185
|
+
Actual : {actual value}
|
|
186
|
+
at {test class}.{method}(line {N})
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
1. What is the gap between Expected and Actual?
|
|
190
|
+
2. Trace to the exact test line
|
|
191
|
+
3. Is the mock setup correct? (`given(...).willReturn(...)`)
|
|
192
|
+
4. Is the assertion logically correct?
|
|
193
|
+
|
|
194
|
+
### Output
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
/debug Analysis
|
|
198
|
+
|
|
199
|
+
## Error Encountered
|
|
200
|
+
{description}
|
|
201
|
+
|
|
202
|
+
## Root Cause
|
|
203
|
+
{technical explanation}
|
|
204
|
+
|
|
205
|
+
## Location in Code
|
|
206
|
+
File: {path}
|
|
207
|
+
Line: {line number if available}
|
|
208
|
+
Layer: {Controller/Service/Repository/Test}
|
|
209
|
+
|
|
210
|
+
## Suggested Fix
|
|
211
|
+
{specific code change}
|
|
212
|
+
|
|
213
|
+
## Related Rule
|
|
214
|
+
See CLAUDE.md §{section} — {section name}
|
|
215
|
+
|
|
216
|
+
## Next Step
|
|
217
|
+
- To fully fix → run /fix-bug {TICKET_ID}
|
|
218
|
+
- Just needed analysis → done here
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
{{include:steps/report-footer.md}}
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## /validate-traces — Traceability Coverage Matrix
|
|
226
|
+
|
|
227
|
+
Read-only check of coverage between specs, code, and tests.
|
|
228
|
+
|
|
229
|
+
### Input
|
|
230
|
+
|
|
231
|
+
Accept: domain name or specific UC-ID.
|
|
232
|
+
|
|
233
|
+
### Process
|
|
234
|
+
|
|
235
|
+
1. **Read .feature files** → collect all SC-IDs for the domain/UC
|
|
236
|
+
2. **Scan controller files** → find `@trace.implements` tags
|
|
237
|
+
3. **Scan test files** → find `@trace.verifies` tags
|
|
238
|
+
4. **Read `.trace/{UC-ID}.tsv`** → check for drift (scenario text changed since last code gen)
|
|
239
|
+
|
|
240
|
+
### Output
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
/validate-traces — {domain}
|
|
244
|
+
|
|
245
|
+
| UC-ID | SC | Spec | Code | Test | Status |
|
|
246
|
+
|-------|----|------|------|------|--------|
|
|
247
|
+
| {UC}-UC1 | SC1 | ✅ | ✅ {ControllerClass} | ✅ {TestClass} | synced |
|
|
248
|
+
| {UC}-UC1 | SC2 | ✅ | ✅ {ControllerClass} | ❌ MISSING | gap |
|
|
249
|
+
| {UC}-UC2 | SC1 | ✅ | ❌ MISSING | ❌ MISSING | gap |
|
|
250
|
+
|
|
251
|
+
Gaps:
|
|
252
|
+
Missing code: [{UC-ID}-SC2, {UC-ID2}-SC1]
|
|
253
|
+
Missing tests: [{UC-ID}-SC1]
|
|
254
|
+
Drifted (spec changed, code not updated): [{list}]
|
|
255
|
+
|
|
256
|
+
Recommendations:
|
|
257
|
+
- /generate-code {UC-ID} SC2
|
|
258
|
+
- /generate-tests {UC-ID}
|
|
259
|
+
- Re-run /generate-code {UC-ID} for drifted scenarios
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
{{include:steps/report-footer.md}}
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Guides product discovery for a new feature through structured Q&A. Trigger when: "/define-product", "khám phá tính năng", "define new feature", "start new feature", "product discovery", "tôi muốn build tính năng mới", "let's define a feature", "begin feature discovery".
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /define-product — Feature Discovery (9-Phase Q&A)
|
|
6
|
+
|
|
7
|
+
Lead the user through 9 structured checkpoints to fully define a new feature before writing any code. Each phase ends with a summary and confirmation before proceeding.
|
|
8
|
+
|
|
9
|
+
## Pre-check
|
|
10
|
+
|
|
11
|
+
# Context Loader — Load All Project Context
|
|
12
|
+
|
|
13
|
+
Execute these steps in order. Store everything in memory for the duration of the command session.
|
|
14
|
+
|
|
15
|
+
**Priority guide (anti-lost-in-middle):**
|
|
16
|
+
- Steps 1–2 are PROJECT-CONFIG — loaded first, resolve all paths and metadata.
|
|
17
|
+
- Step 3 is CRITICAL — architecture + coding standards, the highest-priority facts for generation.
|
|
18
|
+
- Step 4 is SAFETY — data protection rules, enforced silently for the entire session.
|
|
19
|
+
- Steps 5–6 are DOMAIN KNOWLEDGE — terminology and entity definitions.
|
|
20
|
+
- Step 7 is the WORKING MEMORY RECAP — locks critical facts into the top of working memory.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Step 1 — [PROJECT-CONFIG] Load project-context.yaml
|
|
25
|
+
|
|
26
|
+
Read `.agent/project-context.yaml`. Extract and store:
|
|
27
|
+
|
|
28
|
+
**Tech Stack:**
|
|
29
|
+
- `tech_stack.language` → active language (e.g., Java 17, TypeScript, C#, Go)
|
|
30
|
+
- `tech_stack.framework` → active framework (e.g., Spring Boot 3.2, Angular 17, .NET 8)
|
|
31
|
+
- `tech_stack.build_tool` → build tool (e.g., Maven, npm, dotnet, go)
|
|
32
|
+
- `tech_stack.test_framework` → test framework (e.g., JUnit 5 + Mockito, Jest, xUnit)
|
|
33
|
+
- `tech_stack.database` → database (e.g., PostgreSQL, MySQL, MongoDB)
|
|
34
|
+
- `tech_stack.module` → active module profile (e.g., java-spring, angular, dotnet, golang, context-engineering)
|
|
35
|
+
|
|
36
|
+
**Conventions:**
|
|
37
|
+
- `conventions.build_command` → how to compile/build
|
|
38
|
+
- `conventions.test_command` → how to run tests
|
|
39
|
+
- `conventions.service_run` → how to start the service
|
|
40
|
+
- `conventions.ticket_prefix` → ticket ID prefix (e.g., PROJ, FEAT, UC)
|
|
41
|
+
|
|
42
|
+
**Domains:**
|
|
43
|
+
- `domains` → list of active business domains
|
|
44
|
+
|
|
45
|
+
**Paths (if present):**
|
|
46
|
+
- `paths.specs_dir` → BDD specs root
|
|
47
|
+
- `paths.prd_dir` → PRD documents root
|
|
48
|
+
- `paths.refinement_dir` → findings/review output dir
|
|
49
|
+
- `paths.product_definitions_dir` → product definitions root
|
|
50
|
+
- `paths.domain_knowledge_dir` → domain knowledge root
|
|
51
|
+
- `paths.business_dictionary` → path to business-dictionary.md
|
|
52
|
+
- `paths.core_entities` → path to core-entities.md
|
|
53
|
+
- `paths.tech_docs_dir` → technical documentation root
|
|
54
|
+
- `paths.trace_dir` → trace state directory
|
|
55
|
+
|
|
56
|
+
If `paths` section is absent, use these defaults:
|
|
57
|
+
- `specs_dir` = `specs/bdd`
|
|
58
|
+
- `prd_dir` = `specs/prd`
|
|
59
|
+
- `refinement_dir` = `.agent/review`
|
|
60
|
+
- `product_definitions_dir` = `specs/product-definition`
|
|
61
|
+
- `domain_knowledge_dir` = `specs/domain-knowledge`
|
|
62
|
+
- `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
|
|
63
|
+
- `core_entities` = `specs/domain-knowledge/core-entities.md`
|
|
64
|
+
- `tech_docs_dir` = `tech-docs`
|
|
65
|
+
- `trace_dir` = `.trace`
|
|
66
|
+
|
|
67
|
+
If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
|
|
72
|
+
|
|
73
|
+
If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
|
|
74
|
+
Merge framework-specific conventions (layer patterns, test patterns, naming rules) into the loaded context.
|
|
75
|
+
If the file does not exist → skip silently.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Step 3 — [CRITICAL] Load CLAUDE.md
|
|
80
|
+
|
|
81
|
+
*This is the highest-priority context — it defines HOW to write code and documents for this project.*
|
|
82
|
+
|
|
83
|
+
Read `CLAUDE.md`. Extract and store:
|
|
84
|
+
|
|
85
|
+
- **§1 Project Overview** → project name, language, framework, build/test commands, domains
|
|
86
|
+
- **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules
|
|
87
|
+
- **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns
|
|
88
|
+
- **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name
|
|
89
|
+
- **§7 Git Conventions** → branch naming pattern, commit message format
|
|
90
|
+
|
|
91
|
+
If `CLAUDE.md` does not exist → note it as missing and continue with project-context.yaml data only.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Step 4 — [SAFETY] Load Data Protection Rules
|
|
96
|
+
|
|
97
|
+
Read `.agent/rules/data-protection.md` (or `rules/data-protection.md` from the framework installation).
|
|
98
|
+
|
|
99
|
+
Store the sensitive file patterns — you must **never** read, write, display, or reference content from files matching those patterns for the entire session.
|
|
100
|
+
|
|
101
|
+
If neither file exists → apply built-in defaults: never access `.env*`, `*.key`, `*.pem`, `*secret*`, `*password*`, `*credential*`.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Step 5 — [DOMAIN] Load Business Dictionary (conditional)
|
|
106
|
+
|
|
107
|
+
Check if the business dictionary file exists (use `paths.business_dictionary` resolved in Step 1).
|
|
108
|
+
|
|
109
|
+
If it exists, read it and extract:
|
|
110
|
+
- **Canonical Terms** → complete list of approved terms and their definitions
|
|
111
|
+
- **Banned Terms** → complete list of banned terms and their canonical replacements
|
|
112
|
+
- **Status / Enum Registry** → allowed enum values per entity
|
|
113
|
+
|
|
114
|
+
Store the banned terms list for **active enforcement** throughout the command session:
|
|
115
|
+
- When generating any text (PRD, BDD, code comments, tech docs), verify no banned terms appear
|
|
116
|
+
- Replace banned terms with their canonical equivalents automatically
|
|
117
|
+
|
|
118
|
+
If the file does not exist → skip silently. Do not warn or block.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Step 6 — [DOMAIN] Load Core Entities (conditional)
|
|
123
|
+
|
|
124
|
+
Check if the core entities file exists at `paths.core_entities` (resolved in Step 1).
|
|
125
|
+
Default path: `specs/domain-knowledge/core-entities.md`.
|
|
126
|
+
|
|
127
|
+
If it exists, read it and store:
|
|
128
|
+
- **Entity catalog** → for each entity: its name, purpose, owner service, key fields (name + type), business invariants, and relationships
|
|
129
|
+
- **Field name registry** → canonical field names to use in generated code and documents
|
|
130
|
+
- **Relationship map** → how entities relate to each other (1:N, N:N, embedded, etc.)
|
|
131
|
+
|
|
132
|
+
**How to use this catalog:**
|
|
133
|
+
- When generating code: use the field names, types, and relationships defined here — do NOT infer from existing code
|
|
134
|
+
- When generating PRD/BDD: reference entity names from this catalog for consistency
|
|
135
|
+
- When generating tech-docs: use this catalog as the source-of-truth for entity definitions
|
|
136
|
+
|
|
137
|
+
If the file does not exist → skip silently.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
|
|
142
|
+
|
|
143
|
+
After loading all context, synthesize and output a compact summary block.
|
|
144
|
+
This recap ensures the most critical facts are stated at the END of context loading
|
|
145
|
+
(recency effect — freshest in working memory when the task begins).
|
|
146
|
+
|
|
147
|
+
Output exactly this block:
|
|
148
|
+
```
|
|
149
|
+
[CTX LOADED]
|
|
150
|
+
Stack : {language} / {framework} / {database}
|
|
151
|
+
Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
|
|
152
|
+
Ticket : {ticket_prefix}-
|
|
153
|
+
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
154
|
+
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
155
|
+
Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
If any CRITICAL file is missing (CLAUDE.md), flag it clearly so the user can decide whether to proceed.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Context Load Complete
|
|
163
|
+
|
|
164
|
+
After completing all steps, you have loaded:
|
|
165
|
+
- Project identity, tech stack, module conventions
|
|
166
|
+
- Architecture rules and layer order ← **[CRITICAL — hold in working memory]**
|
|
167
|
+
- Coding standards and naming conventions ← **[CRITICAL — hold in working memory]**
|
|
168
|
+
- Data protection rules (sensitive file patterns to never access)
|
|
169
|
+
- Terminology rules with banned-term list ← **[DOMAIN — apply to every generated word]**
|
|
170
|
+
- Entity catalog (field names, types, invariants) ← **[DOMAIN — use for code generation]**
|
|
171
|
+
- All configured paths
|
|
172
|
+
|
|
173
|
+
Proceed to the next step of the calling command.
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
If `.agent/project-context.yaml` does not exist, ask for basic context upfront: "What domain does this feature belong to? Who are the main user types in your system?"
|
|
177
|
+
|
|
178
|
+
## Phase 1 — Problem & Goal
|
|
179
|
+
**CHECKPOINT 1/9**
|
|
180
|
+
|
|
181
|
+
Ask:
|
|
182
|
+
1. What problem does this feature solve? What pain point are users experiencing?
|
|
183
|
+
2. Who is the primary user (persona/role)?
|
|
184
|
+
3. What is the desired outcome?
|
|
185
|
+
|
|
186
|
+
Summarize → confirm → proceed.
|
|
187
|
+
|
|
188
|
+
## Phase 2 — User Flow
|
|
189
|
+
**CHECKPOINT 2/9**
|
|
190
|
+
|
|
191
|
+
Ask the user to describe the end-to-end flow from the user's perspective:
|
|
192
|
+
- Trigger: what initiates this flow?
|
|
193
|
+
- Steps: what does the user do?
|
|
194
|
+
- End state: what does the user see/have?
|
|
195
|
+
|
|
196
|
+
Confirm flow is complete before proceeding.
|
|
197
|
+
|
|
198
|
+
## Phase 3 — Use Case List
|
|
199
|
+
**CHECKPOINT 3/9**
|
|
200
|
+
|
|
201
|
+
Derive use cases from the flow. Present as:
|
|
202
|
+
```
|
|
203
|
+
{DOMAIN}-UC1: {Use Case Name}
|
|
204
|
+
{DOMAIN}-UC2: {Use Case Name}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Ask: "Does this cover everything? Any missing use cases?"
|
|
208
|
+
|
|
209
|
+
## Phase 4 — Business Rules
|
|
210
|
+
**CHECKPOINT 4/9**
|
|
211
|
+
|
|
212
|
+
For each use case, identify constraints:
|
|
213
|
+
- Validation rules (what inputs are required/invalid?)
|
|
214
|
+
- Business logic rules (what calculations/decisions happen?)
|
|
215
|
+
- State rules (what must be true before this UC runs?)
|
|
216
|
+
|
|
217
|
+
Format:
|
|
218
|
+
```
|
|
219
|
+
BR-{N}: {Rule description} → applies to UC{N}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Phase 5 — Acceptance Criteria
|
|
223
|
+
**CHECKPOINT 5/9**
|
|
224
|
+
|
|
225
|
+
For each use case, define measurable acceptance criteria:
|
|
226
|
+
```
|
|
227
|
+
AC-UC{N}-{M}: Given {context}, when {action}, then {expected result}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Phase 6 — Edge Cases
|
|
231
|
+
**CHECKPOINT 6/9**
|
|
232
|
+
|
|
233
|
+
Explore failure scenarios:
|
|
234
|
+
- What if required data is missing?
|
|
235
|
+
- What if concurrent requests happen?
|
|
236
|
+
- What if an upstream dependency fails?
|
|
237
|
+
- What are the boundary conditions?
|
|
238
|
+
|
|
239
|
+
## Phase 7 — Scope Boundary
|
|
240
|
+
**CHECKPOINT 7/9**
|
|
241
|
+
|
|
242
|
+
Explicitly define what is OUT of scope for this feature iteration. This prevents scope creep.
|
|
243
|
+
|
|
244
|
+
Format:
|
|
245
|
+
```
|
|
246
|
+
OUT OF SCOPE:
|
|
247
|
+
- {thing}: deferred to {reason/future phase}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Phase 8 — Cross-Service / Cross-Module Dependencies
|
|
251
|
+
**CHECKPOINT 8/9**
|
|
252
|
+
|
|
253
|
+
Identify dependencies on other modules or services:
|
|
254
|
+
- What data does this feature need from other services?
|
|
255
|
+
- What events/callbacks does it produce?
|
|
256
|
+
- What APIs must it call?
|
|
257
|
+
|
|
258
|
+
## Phase 9 — Validation & Summary
|
|
259
|
+
**CHECKPOINT 9/9**
|
|
260
|
+
|
|
261
|
+
Produce final summary:
|
|
262
|
+
```
|
|
263
|
+
Feature: {name}
|
|
264
|
+
Domain: {domain}
|
|
265
|
+
Primary Persona: {role}
|
|
266
|
+
Use Cases: {N} (list)
|
|
267
|
+
Business Rules: {N}
|
|
268
|
+
Dependencies: {list}
|
|
269
|
+
Estimated Complexity: Low / Medium / High
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
Ask: "Approved? Or any changes needed?"
|
|
273
|
+
|
|
274
|
+
## Output
|
|
275
|
+
|
|
276
|
+
On approval, write file: `specs/product-definition/{feature-slug}.md`
|
|
277
|
+
|
|
278
|
+
```markdown
|
|
279
|
+
# Product Definition — {Feature Name}
|
|
280
|
+
|
|
281
|
+
**Date**: {date}
|
|
282
|
+
**Domain**: {domain}
|
|
283
|
+
**Status**: draft
|
|
284
|
+
|
|
285
|
+
## Problem Statement
|
|
286
|
+
{from Phase 1}
|
|
287
|
+
|
|
288
|
+
## User Flow
|
|
289
|
+
{from Phase 2}
|
|
290
|
+
|
|
291
|
+
## Use Cases
|
|
292
|
+
| UC-ID | Name | Priority |
|
|
293
|
+
|-------|------|----------|
|
|
294
|
+
| {DOMAIN}-UC1 | {name} | High |
|
|
295
|
+
|
|
296
|
+
## Business Rules
|
|
297
|
+
| BR-ID | Rule | Applies To |
|
|
298
|
+
|-------|------|-----------|
|
|
299
|
+
|
|
300
|
+
## Acceptance Criteria
|
|
301
|
+
{from Phase 5}
|
|
302
|
+
|
|
303
|
+
## Out of Scope
|
|
304
|
+
{from Phase 7}
|
|
305
|
+
|
|
306
|
+
## Cross-Service Dependencies
|
|
307
|
+
{from Phase 8}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
# Report Footer — Standard Command Output Format
|
|
311
|
+
|
|
312
|
+
Every command report must end with this standard footer section.
|
|
313
|
+
|
|
314
|
+
## Status Badge
|
|
315
|
+
|
|
316
|
+
Choose one based on outcome:
|
|
317
|
+
- `✅ Complete` — all steps succeeded, no issues found
|
|
318
|
+
- `❌ Failed` — command could not complete due to a blocking error
|
|
319
|
+
- `⚠️ Warnings` — completed with non-blocking issues that should be reviewed
|
|
320
|
+
|
|
321
|
+
## Output Artifacts
|
|
322
|
+
|
|
323
|
+
List every file created or modified by this command:
|
|
324
|
+
```
|
|
325
|
+
Output Artifacts:
|
|
326
|
+
{created|updated} {file-path} ({brief description})
|
|
327
|
+
{created|updated} {file-path} ({brief description})
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
|
|
331
|
+
|
|
332
|
+
## Next Command Suggestion
|
|
333
|
+
|
|
334
|
+
Suggest the logical next command based on workflow phase:
|
|
335
|
+
|
|
336
|
+
| Current command | Suggest next |
|
|
337
|
+
|-------------------------|-----------------------------------------------|
|
|
338
|
+
| /define-product | `/generate-prd {product-definition-file}` |
|
|
339
|
+
| /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
|
|
340
|
+
| /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
|
|
341
|
+
| /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
|
|
342
|
+
| /generate-bdd | `/review-context {feature-file}` to verify coverage |
|
|
343
|
+
| /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
|
|
344
|
+
| /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
|
|
345
|
+
| /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
|
|
346
|
+
| /generate-code | `/generate-tests {UC-ID}` |
|
|
347
|
+
| /generate-tests | `/run-tests {UC-ID}` |
|
|
348
|
+
| /run-tests (passing) | `/review-code {UC-ID}` |
|
|
349
|
+
| /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
|
|
350
|
+
| /review-code | `/smoke-test {UC-ID}` or create PR |
|
|
351
|
+
| /smoke-test | Create PR and link to ticket |
|
|
352
|
+
| /validate-traces | `/generate-code {UC-ID}` for gaps |
|
|
353
|
+
| /fix-bug | Create PR and link to ticket |
|
|
354
|
+
| /debug | `/fix-bug {ticket-id}` if fix needed |
|
|
355
|
+
|
|
356
|
+
Format the footer as:
|
|
357
|
+
```
|
|
358
|
+
---
|
|
359
|
+
Status : {badge}
|
|
360
|
+
{Output Artifacts block}
|
|
361
|
+
Next : {suggested command with example arguments}
|
|
362
|
+
```
|
|
363
|
+
|