@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,77 @@
|
|
|
1
|
+
# /debug — Quick Debug Analysis
|
|
2
|
+
|
|
3
|
+
Use for: IDE errors, test failures, strange behavior, or "why does this code do X?"
|
|
4
|
+
Different from `/fix-bug`: analysis only, no full workflow, no ticket needed.
|
|
5
|
+
|
|
6
|
+
## Gate
|
|
7
|
+
{{include:steps/gate.md}}
|
|
8
|
+
|
|
9
|
+
*Note: For this command, the target in Step 1 is user-provided input (stack trace, test failure output, file path + description, or code question). No file discovery needed — go straight to context loading.*
|
|
10
|
+
|
|
11
|
+
## Context
|
|
12
|
+
{{include:steps/context-loader.md}}
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Input — Paste one of:
|
|
17
|
+
1. Stack trace / error log
|
|
18
|
+
2. Test failure output
|
|
19
|
+
3. File path + description of unexpected behavior
|
|
20
|
+
4. A specific question about a code snippet
|
|
21
|
+
|
|
22
|
+
## Stack Trace Analysis
|
|
23
|
+
Read from **bottom up** — `Caused by:` is the real root cause:
|
|
24
|
+
```
|
|
25
|
+
Caused by: {RealException} ← start here
|
|
26
|
+
at {class}.{method}({file}:{line})
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Common Error Patterns
|
|
30
|
+
|
|
31
|
+
| Error | Likely Cause | Fix Direction |
|
|
32
|
+
|-------|-------------|---------------|
|
|
33
|
+
| NullPointerException | Null object access; Optional not handled | Check Optional.orElseThrow, null guards |
|
|
34
|
+
| ClassCastException | Wrong type assumption | Check type at assignment/return |
|
|
35
|
+
| OutOfMemoryError | Loading too much data | Add pagination |
|
|
36
|
+
| StackOverflowError | Infinite recursion | Find recursive call with no base case |
|
|
37
|
+
| Connection refused | Dependency not running | Check config URLs |
|
|
38
|
+
| 401 Unauthorized | Token expired, wrong config | Verify token, check auth config |
|
|
39
|
+
| 403 Forbidden | Wrong role | Check auth annotations |
|
|
40
|
+
| DB constraint violation | Duplicate key, null in NOT NULL | Check data and constraints |
|
|
41
|
+
| Serialization error | Circular reference | Check DTO/mapper config |
|
|
42
|
+
| Test assertion mismatch | Wrong mock or wrong expected | Re-read mock setup |
|
|
43
|
+
|
|
44
|
+
## Test Failure Analysis
|
|
45
|
+
```
|
|
46
|
+
Expected: {value}
|
|
47
|
+
Actual : {value}
|
|
48
|
+
at {test}.{method}(line {N})
|
|
49
|
+
```
|
|
50
|
+
1. What is the gap? 2. Is mock setup correct? 3. Is assertion logically correct?
|
|
51
|
+
|
|
52
|
+
## Output
|
|
53
|
+
|
|
54
|
+
{{include:steps/report-footer.md}}
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
/debug Analysis
|
|
58
|
+
|
|
59
|
+
## Error
|
|
60
|
+
{description}
|
|
61
|
+
|
|
62
|
+
## Root Cause
|
|
63
|
+
{technical explanation}
|
|
64
|
+
|
|
65
|
+
## Location
|
|
66
|
+
File: {path} | Line: {N} | Layer: {Controller/Service/Repository/Test}
|
|
67
|
+
|
|
68
|
+
## Suggested Fix
|
|
69
|
+
{specific code change}
|
|
70
|
+
|
|
71
|
+
## Related Rule
|
|
72
|
+
See CLAUDE.md §{section}
|
|
73
|
+
|
|
74
|
+
## Next Step
|
|
75
|
+
- To fully fix → /fix-bug {TICKET_ID}
|
|
76
|
+
- Just needed analysis → done
|
|
77
|
+
```
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
# /define-product — Feature Discovery (8-Phase Q&A)
|
|
2
|
+
|
|
3
|
+
## Gate
|
|
4
|
+
# Gate — Universal Entry Procedure
|
|
5
|
+
|
|
6
|
+
Every command must execute this gate before proceeding with its specific logic.
|
|
7
|
+
|
|
8
|
+
## Step 0 — Sub-Agent Mode Check
|
|
9
|
+
|
|
10
|
+
Before anything else, check if `$ARGUMENTS` is a JSON payload from an orchestrator:
|
|
11
|
+
|
|
12
|
+
1. Attempt to parse `$ARGUMENTS` as JSON.
|
|
13
|
+
2. If it parses successfully **and** contains `"_agent_mode": true`:
|
|
14
|
+
- **Skip Steps 1, 2, and 3 of this Gate entirely.**
|
|
15
|
+
- Set target file = `payload.target_file`
|
|
16
|
+
- Set loaded context = `payload.context` (do NOT run context-loader.md)
|
|
17
|
+
- Set UC scope = `payload.uc_id` (process only this UC)
|
|
18
|
+
- Set line range = `payload.uc_section` (read only that PRD section)
|
|
19
|
+
- Proceed directly to the command-specific logic.
|
|
20
|
+
3. If `$ARGUMENTS` is not JSON or `_agent_mode` is absent → continue to Step 1 (normal mode).
|
|
21
|
+
|
|
22
|
+
## Step 0-B — Model Check
|
|
23
|
+
|
|
24
|
+
*Skip this step if `_agent_mode: true` (sub-agent — orchestrator already validated).*
|
|
25
|
+
|
|
26
|
+
Complex generation and review commands require strong reasoning.
|
|
27
|
+
Using a smaller model risks missed edge cases, incomplete spec analysis, and architecture violations.
|
|
28
|
+
|
|
29
|
+
Display and wait for response:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
⚙️ MODEL CHECK
|
|
33
|
+
──────────────────────────────────────────────────────────────────
|
|
34
|
+
Recommended : claude-opus-4-5 (or claude-opus-4)
|
|
35
|
+
Why needed : Spec analysis, architecture review, code generation
|
|
36
|
+
require deep reasoning. Smaller models miss edge cases.
|
|
37
|
+
|
|
38
|
+
To switch in Claude Code:
|
|
39
|
+
• Settings → Model → select "claude-opus"
|
|
40
|
+
• or: /model → choose claude-opus
|
|
41
|
+
|
|
42
|
+
Running on claude-opus?
|
|
43
|
+
Y — yes, on claude-opus → proceed
|
|
44
|
+
S — skip check (I accept lower quality risk with current model)
|
|
45
|
+
──────────────────────────────────────────────────────────────────
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- "Y" → proceed to Step 1.
|
|
49
|
+
- "S" → proceed to Step 1 (user accepts risk, add ⚠️ to final report).
|
|
50
|
+
- "N" or anything else → **STOP.** Output: "Please switch to claude-opus, then re-run this command."
|
|
51
|
+
|
|
52
|
+
## Step 1 — Resolve Target File
|
|
53
|
+
|
|
54
|
+
1. If `$ARGUMENTS` is provided and points to an existing file → use it directly as the target.
|
|
55
|
+
2. If `$ARGUMENTS` is a UC-ID, ticket ID, or partial name → search for matching files in the relevant directory.
|
|
56
|
+
3. If `$ARGUMENTS` is empty or no match found:
|
|
57
|
+
- List files in the relevant directory for this command (e.g., `specs/prd/**/*.md` for PRD commands, `specs/bdd/**/*.feature` for BDD commands).
|
|
58
|
+
- Present the list to the user and ask: "Which file do you want to work with? (Enter number or filename)"
|
|
59
|
+
- Wait for user selection before continuing.
|
|
60
|
+
|
|
61
|
+
## Step 2 — Execute Context Loader
|
|
62
|
+
|
|
63
|
+
Load all project context by following the procedure in `steps/context-loader.md`.
|
|
64
|
+
Store all loaded context in memory for use throughout this command session.
|
|
65
|
+
|
|
66
|
+
## Step 3 — CHECKPOINT
|
|
67
|
+
|
|
68
|
+
After completing Steps 1 and 2, display a summary and wait for confirmation:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
CHECKPOINT
|
|
72
|
+
-----------
|
|
73
|
+
Target : {resolved file path}
|
|
74
|
+
Project : {project.name from project-context.yaml}
|
|
75
|
+
Tech stack : {language} / {framework}
|
|
76
|
+
Module : {module if set, else "not configured"}
|
|
77
|
+
Domains : {comma-separated domain list}
|
|
78
|
+
|
|
79
|
+
Proceed? (Y/N)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Wait for explicit "Y" or "N" from the user before continuing.
|
|
83
|
+
- "Y" → proceed to the command-specific steps below.
|
|
84
|
+
- "N" → stop and ask what the user wants to change.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
*Note: For this command, there is no input file to resolve in Step 1. Skip to Step 2 (context load) and then ask: **"Ticket ID and feature name? (e.g., LOYAL-29 Loyalty Points)"***
|
|
88
|
+
|
|
89
|
+
## Context
|
|
90
|
+
# Context Loader — Load All Project Context
|
|
91
|
+
|
|
92
|
+
Execute these steps in order. Store everything in memory for the duration of the command session.
|
|
93
|
+
|
|
94
|
+
**Priority guide (anti-lost-in-middle):**
|
|
95
|
+
- Steps 1–2 are PROJECT-CONFIG — loaded first, resolve all paths and metadata.
|
|
96
|
+
- Step 3 is CRITICAL — architecture + coding standards, the highest-priority facts for generation.
|
|
97
|
+
- Step 4 is SAFETY — data protection rules, enforced silently for the entire session.
|
|
98
|
+
- Steps 5–6 are DOMAIN KNOWLEDGE — terminology and entity definitions.
|
|
99
|
+
- Step 7 is the WORKING MEMORY RECAP — locks critical facts into the top of working memory.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Step 1 — [PROJECT-CONFIG] Load project-context.yaml
|
|
104
|
+
|
|
105
|
+
Read `.agent/project-context.yaml`. Extract and store:
|
|
106
|
+
|
|
107
|
+
**Tech Stack:**
|
|
108
|
+
- `tech_stack.language` → active language (e.g., Java 17, TypeScript, C#, Go)
|
|
109
|
+
- `tech_stack.framework` → active framework (e.g., Spring Boot 3.2, Angular 17, .NET 8)
|
|
110
|
+
- `tech_stack.build_tool` → build tool (e.g., Maven, npm, dotnet, go)
|
|
111
|
+
- `tech_stack.test_framework` → test framework (e.g., JUnit 5 + Mockito, Jest, xUnit)
|
|
112
|
+
- `tech_stack.database` → database (e.g., PostgreSQL, MySQL, MongoDB)
|
|
113
|
+
- `tech_stack.module` → active module profile (e.g., java-spring, angular, dotnet, golang, context-engineering)
|
|
114
|
+
|
|
115
|
+
**Conventions:**
|
|
116
|
+
- `conventions.build_command` → how to compile/build
|
|
117
|
+
- `conventions.test_command` → how to run tests
|
|
118
|
+
- `conventions.service_run` → how to start the service
|
|
119
|
+
- `conventions.ticket_prefix` → ticket ID prefix (e.g., PROJ, FEAT, UC)
|
|
120
|
+
|
|
121
|
+
**Domains:**
|
|
122
|
+
- `domains` → list of active business domains
|
|
123
|
+
|
|
124
|
+
**Paths (if present):**
|
|
125
|
+
- `paths.specs_dir` → BDD specs root
|
|
126
|
+
- `paths.prd_dir` → PRD documents root
|
|
127
|
+
- `paths.refinement_dir` → findings/review output dir
|
|
128
|
+
- `paths.product_definitions_dir` → product definitions root
|
|
129
|
+
- `paths.domain_knowledge_dir` → domain knowledge root
|
|
130
|
+
- `paths.business_dictionary` → path to business-dictionary.md
|
|
131
|
+
- `paths.core_entities` → path to core-entities.md
|
|
132
|
+
- `paths.tech_docs_dir` → technical documentation root
|
|
133
|
+
- `paths.trace_dir` → trace state directory
|
|
134
|
+
|
|
135
|
+
If `paths` section is absent, use these defaults:
|
|
136
|
+
- `specs_dir` = `specs/bdd`
|
|
137
|
+
- `prd_dir` = `specs/prd`
|
|
138
|
+
- `refinement_dir` = `.agent/review`
|
|
139
|
+
- `product_definitions_dir` = `specs/product-definition`
|
|
140
|
+
- `domain_knowledge_dir` = `specs/domain-knowledge`
|
|
141
|
+
- `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
|
|
142
|
+
- `core_entities` = `specs/domain-knowledge/core-entities.md`
|
|
143
|
+
- `tech_docs_dir` = `tech-docs`
|
|
144
|
+
- `trace_dir` = `.trace`
|
|
145
|
+
|
|
146
|
+
If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
|
|
151
|
+
|
|
152
|
+
If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
|
|
153
|
+
Merge framework-specific conventions (layer patterns, test patterns, naming rules) into the loaded context.
|
|
154
|
+
If the file does not exist → skip silently.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Step 3 — [CRITICAL] Load CLAUDE.md
|
|
159
|
+
|
|
160
|
+
*This is the highest-priority context — it defines HOW to write code and documents for this project.*
|
|
161
|
+
|
|
162
|
+
Read `CLAUDE.md`. Extract and store:
|
|
163
|
+
|
|
164
|
+
- **§1 Project Overview** → project name, language, framework, build/test commands, domains
|
|
165
|
+
- **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules
|
|
166
|
+
- **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns
|
|
167
|
+
- **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name
|
|
168
|
+
- **§7 Git Conventions** → branch naming pattern, commit message format
|
|
169
|
+
|
|
170
|
+
If `CLAUDE.md` does not exist → note it as missing and continue with project-context.yaml data only.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Step 4 — [SAFETY] Load Data Protection Rules
|
|
175
|
+
|
|
176
|
+
Read `.agent/rules/data-protection.md` (or `rules/data-protection.md` from the framework installation).
|
|
177
|
+
|
|
178
|
+
Store the sensitive file patterns — you must **never** read, write, display, or reference content from files matching those patterns for the entire session.
|
|
179
|
+
|
|
180
|
+
If neither file exists → apply built-in defaults: never access `.env*`, `*.key`, `*.pem`, `*secret*`, `*password*`, `*credential*`.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Step 5 — [DOMAIN] Load Business Dictionary (conditional)
|
|
185
|
+
|
|
186
|
+
Check if the business dictionary file exists (use `paths.business_dictionary` resolved in Step 1).
|
|
187
|
+
|
|
188
|
+
If it exists, read it and extract:
|
|
189
|
+
- **Canonical Terms** → complete list of approved terms and their definitions
|
|
190
|
+
- **Banned Terms** → complete list of banned terms and their canonical replacements
|
|
191
|
+
- **Status / Enum Registry** → allowed enum values per entity
|
|
192
|
+
|
|
193
|
+
Store the banned terms list for **active enforcement** throughout the command session:
|
|
194
|
+
- When generating any text (PRD, BDD, code comments, tech docs), verify no banned terms appear
|
|
195
|
+
- Replace banned terms with their canonical equivalents automatically
|
|
196
|
+
|
|
197
|
+
If the file does not exist → skip silently. Do not warn or block.
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Step 6 — [DOMAIN] Load Core Entities (conditional)
|
|
202
|
+
|
|
203
|
+
Check if the core entities file exists at `paths.core_entities` (resolved in Step 1).
|
|
204
|
+
Default path: `specs/domain-knowledge/core-entities.md`.
|
|
205
|
+
|
|
206
|
+
If it exists, read it and store:
|
|
207
|
+
- **Entity catalog** → for each entity: its name, purpose, owner service, key fields (name + type), business invariants, and relationships
|
|
208
|
+
- **Field name registry** → canonical field names to use in generated code and documents
|
|
209
|
+
- **Relationship map** → how entities relate to each other (1:N, N:N, embedded, etc.)
|
|
210
|
+
|
|
211
|
+
**How to use this catalog:**
|
|
212
|
+
- When generating code: use the field names, types, and relationships defined here — do NOT infer from existing code
|
|
213
|
+
- When generating PRD/BDD: reference entity names from this catalog for consistency
|
|
214
|
+
- When generating tech-docs: use this catalog as the source-of-truth for entity definitions
|
|
215
|
+
|
|
216
|
+
If the file does not exist → skip silently.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
|
|
221
|
+
|
|
222
|
+
After loading all context, synthesize and output a compact summary block.
|
|
223
|
+
This recap ensures the most critical facts are stated at the END of context loading
|
|
224
|
+
(recency effect — freshest in working memory when the task begins).
|
|
225
|
+
|
|
226
|
+
Output exactly this block:
|
|
227
|
+
```
|
|
228
|
+
[CTX LOADED]
|
|
229
|
+
Stack : {language} / {framework} / {database}
|
|
230
|
+
Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
|
|
231
|
+
Ticket : {ticket_prefix}-
|
|
232
|
+
Dict : {loaded — N canonical terms, M banned terms | missing}
|
|
233
|
+
Entities : {loaded — EntityA, EntityB, EntityC | missing}
|
|
234
|
+
Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
If any CRITICAL file is missing (CLAUDE.md), flag it clearly so the user can decide whether to proceed.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Context Load Complete
|
|
242
|
+
|
|
243
|
+
After completing all steps, you have loaded:
|
|
244
|
+
- Project identity, tech stack, module conventions
|
|
245
|
+
- Architecture rules and layer order ← **[CRITICAL — hold in working memory]**
|
|
246
|
+
- Coding standards and naming conventions ← **[CRITICAL — hold in working memory]**
|
|
247
|
+
- Data protection rules (sensitive file patterns to never access)
|
|
248
|
+
- Terminology rules with banned-term list ← **[DOMAIN — apply to every generated word]**
|
|
249
|
+
- Entity catalog (field names, types, invariants) ← **[DOMAIN — use for code generation]**
|
|
250
|
+
- All configured paths
|
|
251
|
+
|
|
252
|
+
Proceed to the next step of the calling command.
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Phase 0 — Knowledge Sync *(AI fills automatically, no PO input needed)*
|
|
258
|
+
|
|
259
|
+
AI scans the project and writes:
|
|
260
|
+
|
|
261
|
+
- **Related Entities** — list entities from existing PRDs/domain-knowledge that relate to this feature.
|
|
262
|
+
- **Related Modules** — list affected modules/services.
|
|
263
|
+
- **Existing Rules / Logic** — rules from existing PRDs that this feature must respect.
|
|
264
|
+
- **Terminology Normalization** — map any terms found in PO input to canonical terms from business-dictionary.md.
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
| Term in PO input | Canonical term (business-dictionary) |
|
|
268
|
+
|------------------|--------------------------------------|
|
|
269
|
+
| {original} | {canonical} |
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Phase 1 — Feature Definition *(CHECKPOINT 1)*
|
|
275
|
+
|
|
276
|
+
Ask in order, one at a time:
|
|
277
|
+
|
|
278
|
+
1. **Context**: Background / reason why this feature is needed?
|
|
279
|
+
2. **Problem**: Specific problem to solve?
|
|
280
|
+
3. **Goal**: What objective does this feature achieve?
|
|
281
|
+
4. **Actors**: Who are the users? (list roles, mark Primary/Secondary)
|
|
282
|
+
5. **Scope**: What does this feature do? (one function per line — only what is in this ticket)
|
|
283
|
+
6. **User Story**: Confirm in format:
|
|
284
|
+
```
|
|
285
|
+
As a {User role}
|
|
286
|
+
I want to {User goal}
|
|
287
|
+
So that {Business value}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Summarize → confirm → write `✅ PO Confirmed: Yes` → proceed.
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Phase 2 — User Flow Definition *(CHECKPOINT 2)*
|
|
295
|
+
|
|
296
|
+
Ask:
|
|
297
|
+
1. **Entry Point**: Where does the user start interacting with this feature?
|
|
298
|
+
2. **Flow Steps**: Describe each step (use table):
|
|
299
|
+
```
|
|
300
|
+
| Step | Action (user) | Screen / State | Notes |
|
|
301
|
+
```
|
|
302
|
+
3. **Exit Point**: What is the final result when the flow completes?
|
|
303
|
+
|
|
304
|
+
Confirm → write `✅ PO Confirmed: Yes` → proceed.
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## Phase 3 — Clarification Log
|
|
309
|
+
|
|
310
|
+
Based on Phases 1-2, AI identifies gaps and asks follow-up questions. Continue rounds until no Unresolved Items remain.
|
|
311
|
+
|
|
312
|
+
```
|
|
313
|
+
### Round {N}
|
|
314
|
+
| # | Category | Question | PO Answer |
|
|
315
|
+
|---|----------------|------------|------------|
|
|
316
|
+
| 1 | Context/Flow/Logic | {question} | {answer} |
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**BLOCK**: If Unresolved Items remain → MUST NOT proceed to Phase 4.
|
|
320
|
+
|
|
321
|
+
### Unresolved Items
|
|
322
|
+
- {item — or "None"}
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Phase 4 — Business Rules *(CHECKPOINT 4)*
|
|
327
|
+
|
|
328
|
+
Derive from Phases 1-3. Each BR = one rule (WHAT the system must/must not do):
|
|
329
|
+
|
|
330
|
+
```
|
|
331
|
+
| Rule ID | Action / Trigger | Rule | Condition |
|
|
332
|
+
|---------|---------------------|-------------------------------|---------------------|
|
|
333
|
+
| BR-1 | {action from flow} | System MUST/MUST NOT... | {applicable condition} |
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Confirm → write `✅ PO Confirmed: Yes` → proceed.
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Phase 5 — Business Logic *(CHECKPOINT 5)*
|
|
341
|
+
|
|
342
|
+
Map each BR to HOW the system executes it:
|
|
343
|
+
|
|
344
|
+
```
|
|
345
|
+
| Rule ID | System Behavior | Data State Change | UI Behavior | Error Handling |
|
|
346
|
+
|---------|---------------------------------------|---------------------|-------------------------|------------------------|
|
|
347
|
+
| BR-1 | {how system processes when triggers} | {what data changes} | {enable/disable/show...}| {error message/action} |
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Confirm → write `✅ PO Confirmed: Yes` → proceed.
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Phase 6 — Acceptance Criteria *(CHECKPOINT 6)*
|
|
355
|
+
|
|
356
|
+
Derive from BRs + User Story. Each AC must be testable (clear pass/fail):
|
|
357
|
+
|
|
358
|
+
```
|
|
359
|
+
| AC ID | Description | Expected Behavior | Derived from |
|
|
360
|
+
|-------|-------------------------|---------------------------|--------------|
|
|
361
|
+
| AC-1 | {criterion description} | {what system should do} | BR-{N} |
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
Confirm → write `✅ PO Confirmed: Yes` → proceed.
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Phase 7 — Validation Report
|
|
369
|
+
|
|
370
|
+
Generate coverage matrix automatically:
|
|
371
|
+
|
|
372
|
+
```
|
|
373
|
+
| Flow Action | Has Rule? | Has Logic? | Has AC? | Status |
|
|
374
|
+
|-------------|-----------|------------|---------|---------|
|
|
375
|
+
| {Action 1} | ✅/❌ | ✅/❌ | ✅/❌ | OK/GAP |
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
- **Conflicts Detected**: list any conflicting rules, or "None".
|
|
379
|
+
- **Missing Items**: list gaps, or "None".
|
|
380
|
+
|
|
381
|
+
If any GAP found → alert PO and resolve before marking completed.
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## Output
|
|
386
|
+
|
|
387
|
+
Write `{paths.product_definitions_dir}/{TICKET-ID}-{slug}.md` following `templates/product-definition.template.md`.
|
|
388
|
+
|
|
389
|
+
Fill all sections with data gathered across phases.
|
|
390
|
+
Set `Status: completed` when Phase 7 passes with no GAPs.
|
|
391
|
+
|
|
392
|
+
# Report Footer — Standard Command Output Format
|
|
393
|
+
|
|
394
|
+
Every command report must end with this standard footer section.
|
|
395
|
+
|
|
396
|
+
## Status Badge
|
|
397
|
+
|
|
398
|
+
Choose one based on outcome:
|
|
399
|
+
- `✅ Complete` — all steps succeeded, no issues found
|
|
400
|
+
- `❌ Failed` — command could not complete due to a blocking error
|
|
401
|
+
- `⚠️ Warnings` — completed with non-blocking issues that should be reviewed
|
|
402
|
+
|
|
403
|
+
## Output Artifacts
|
|
404
|
+
|
|
405
|
+
List every file created or modified by this command:
|
|
406
|
+
```
|
|
407
|
+
Output Artifacts:
|
|
408
|
+
{created|updated} {file-path} ({brief description})
|
|
409
|
+
{created|updated} {file-path} ({brief description})
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
|
|
413
|
+
|
|
414
|
+
## Next Command Suggestion
|
|
415
|
+
|
|
416
|
+
Suggest the logical next command based on workflow phase:
|
|
417
|
+
|
|
418
|
+
| Current command | Suggest next |
|
|
419
|
+
|-------------------------|-----------------------------------------------|
|
|
420
|
+
| /define-product | `/generate-prd {product-definition-file}` |
|
|
421
|
+
| /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
|
|
422
|
+
| /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
|
|
423
|
+
| /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
|
|
424
|
+
| /generate-bdd | `/review-context {feature-file}` to verify coverage |
|
|
425
|
+
| /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
|
|
426
|
+
| /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
|
|
427
|
+
| /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
|
|
428
|
+
| /generate-code | `/generate-tests {UC-ID}` |
|
|
429
|
+
| /generate-tests | `/run-tests {UC-ID}` |
|
|
430
|
+
| /run-tests (passing) | `/review-code {UC-ID}` |
|
|
431
|
+
| /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
|
|
432
|
+
| /review-code | `/smoke-test {UC-ID}` or create PR |
|
|
433
|
+
| /smoke-test | Create PR and link to ticket |
|
|
434
|
+
| /validate-traces | `/generate-code {UC-ID}` for gaps |
|
|
435
|
+
| /fix-bug | Create PR and link to ticket |
|
|
436
|
+
| /debug | `/fix-bug {ticket-id}` if fix needed |
|
|
437
|
+
|
|
438
|
+
Format the footer as:
|
|
439
|
+
```
|
|
440
|
+
---
|
|
441
|
+
Status : {badge}
|
|
442
|
+
{Output Artifacts block}
|
|
443
|
+
Next : {suggested command with example arguments}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
```
|
|
448
|
+
/define-product Complete ✅
|
|
449
|
+
File: {paths.product_definitions_dir}/{TICKET-ID}-{slug}.md
|
|
450
|
+
Next: /generate-prd {paths.product_definitions_dir}/{TICKET-ID}-{slug}.md
|
|
451
|
+
```
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# /define-product — Feature Discovery (8-Phase Q&A)
|
|
2
|
+
|
|
3
|
+
## Gate
|
|
4
|
+
{{include:steps/gate.md}}
|
|
5
|
+
|
|
6
|
+
*Note: For this command, there is no input file to resolve in Step 1. Skip to Step 2 (context load) and then ask: **"Ticket ID and feature name? (e.g., LOYAL-29 Loyalty Points)"***
|
|
7
|
+
|
|
8
|
+
## Context
|
|
9
|
+
{{include:steps/context-loader.md}}
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Phase 0 — Knowledge Sync *(AI fills automatically, no PO input needed)*
|
|
14
|
+
|
|
15
|
+
AI scans the project and writes:
|
|
16
|
+
|
|
17
|
+
- **Related Entities** — list entities from existing PRDs/domain-knowledge that relate to this feature.
|
|
18
|
+
- **Related Modules** — list affected modules/services.
|
|
19
|
+
- **Existing Rules / Logic** — rules from existing PRDs that this feature must respect.
|
|
20
|
+
- **Terminology Normalization** — map any terms found in PO input to canonical terms from business-dictionary.md.
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
| Term in PO input | Canonical term (business-dictionary) |
|
|
24
|
+
|------------------|--------------------------------------|
|
|
25
|
+
| {original} | {canonical} |
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Phase 1 — Feature Definition *(CHECKPOINT 1)*
|
|
31
|
+
|
|
32
|
+
Ask in order, one at a time:
|
|
33
|
+
|
|
34
|
+
1. **Context**: Background / reason why this feature is needed?
|
|
35
|
+
2. **Problem**: Specific problem to solve?
|
|
36
|
+
3. **Goal**: What objective does this feature achieve?
|
|
37
|
+
4. **Actors**: Who are the users? (list roles, mark Primary/Secondary)
|
|
38
|
+
5. **Scope**: What does this feature do? (one function per line — only what is in this ticket)
|
|
39
|
+
6. **User Story**: Confirm in format:
|
|
40
|
+
```
|
|
41
|
+
As a {User role}
|
|
42
|
+
I want to {User goal}
|
|
43
|
+
So that {Business value}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Summarize → confirm → write `✅ PO Confirmed: Yes` → proceed.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Phase 2 — User Flow Definition *(CHECKPOINT 2)*
|
|
51
|
+
|
|
52
|
+
Ask:
|
|
53
|
+
1. **Entry Point**: Where does the user start interacting with this feature?
|
|
54
|
+
2. **Flow Steps**: Describe each step (use table):
|
|
55
|
+
```
|
|
56
|
+
| Step | Action (user) | Screen / State | Notes |
|
|
57
|
+
```
|
|
58
|
+
3. **Exit Point**: What is the final result when the flow completes?
|
|
59
|
+
|
|
60
|
+
Confirm → write `✅ PO Confirmed: Yes` → proceed.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Phase 3 — Clarification Log
|
|
65
|
+
|
|
66
|
+
Based on Phases 1-2, AI identifies gaps and asks follow-up questions. Continue rounds until no Unresolved Items remain.
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
### Round {N}
|
|
70
|
+
| # | Category | Question | PO Answer |
|
|
71
|
+
|---|----------------|------------|------------|
|
|
72
|
+
| 1 | Context/Flow/Logic | {question} | {answer} |
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**BLOCK**: If Unresolved Items remain → MUST NOT proceed to Phase 4.
|
|
76
|
+
|
|
77
|
+
### Unresolved Items
|
|
78
|
+
- {item — or "None"}
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Phase 4 — Business Rules *(CHECKPOINT 4)*
|
|
83
|
+
|
|
84
|
+
Derive from Phases 1-3. Each BR = one rule (WHAT the system must/must not do):
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
| Rule ID | Action / Trigger | Rule | Condition |
|
|
88
|
+
|---------|---------------------|-------------------------------|---------------------|
|
|
89
|
+
| BR-1 | {action from flow} | System MUST/MUST NOT... | {applicable condition} |
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Confirm → write `✅ PO Confirmed: Yes` → proceed.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Phase 5 — Business Logic *(CHECKPOINT 5)*
|
|
97
|
+
|
|
98
|
+
Map each BR to HOW the system executes it:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
| Rule ID | System Behavior | Data State Change | UI Behavior | Error Handling |
|
|
102
|
+
|---------|---------------------------------------|---------------------|-------------------------|------------------------|
|
|
103
|
+
| BR-1 | {how system processes when triggers} | {what data changes} | {enable/disable/show...}| {error message/action} |
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Confirm → write `✅ PO Confirmed: Yes` → proceed.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Phase 6 — Acceptance Criteria *(CHECKPOINT 6)*
|
|
111
|
+
|
|
112
|
+
Derive from BRs + User Story. Each AC must be testable (clear pass/fail):
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
| AC ID | Description | Expected Behavior | Derived from |
|
|
116
|
+
|-------|-------------------------|---------------------------|--------------|
|
|
117
|
+
| AC-1 | {criterion description} | {what system should do} | BR-{N} |
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Confirm → write `✅ PO Confirmed: Yes` → proceed.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Phase 7 — Validation Report
|
|
125
|
+
|
|
126
|
+
Generate coverage matrix automatically:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
| Flow Action | Has Rule? | Has Logic? | Has AC? | Status |
|
|
130
|
+
|-------------|-----------|------------|---------|---------|
|
|
131
|
+
| {Action 1} | ✅/❌ | ✅/❌ | ✅/❌ | OK/GAP |
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
- **Conflicts Detected**: list any conflicting rules, or "None".
|
|
135
|
+
- **Missing Items**: list gaps, or "None".
|
|
136
|
+
|
|
137
|
+
If any GAP found → alert PO and resolve before marking completed.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Output
|
|
142
|
+
|
|
143
|
+
Write `{paths.product_definitions_dir}/{TICKET-ID}-{slug}.md` following `templates/product-definition.template.md`.
|
|
144
|
+
|
|
145
|
+
Fill all sections with data gathered across phases.
|
|
146
|
+
Set `Status: completed` when Phase 7 passes with no GAPs.
|
|
147
|
+
|
|
148
|
+
{{include:steps/report-footer.md}}
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
/define-product Complete ✅
|
|
152
|
+
File: {paths.product_definitions_dir}/{TICKET-ID}-{slug}.md
|
|
153
|
+
Next: /generate-prd {paths.product_definitions_dir}/{TICKET-ID}-{slug}.md
|
|
154
|
+
```
|