@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,147 @@
|
|
|
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
|
+
{{include:steps/context-loader.md}}
|
|
12
|
+
|
|
13
|
+
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?"
|
|
14
|
+
|
|
15
|
+
## Phase 1 — Problem & Goal
|
|
16
|
+
**CHECKPOINT 1/9**
|
|
17
|
+
|
|
18
|
+
Ask:
|
|
19
|
+
1. What problem does this feature solve? What pain point are users experiencing?
|
|
20
|
+
2. Who is the primary user (persona/role)?
|
|
21
|
+
3. What is the desired outcome?
|
|
22
|
+
|
|
23
|
+
Summarize → confirm → proceed.
|
|
24
|
+
|
|
25
|
+
## Phase 2 — User Flow
|
|
26
|
+
**CHECKPOINT 2/9**
|
|
27
|
+
|
|
28
|
+
Ask the user to describe the end-to-end flow from the user's perspective:
|
|
29
|
+
- Trigger: what initiates this flow?
|
|
30
|
+
- Steps: what does the user do?
|
|
31
|
+
- End state: what does the user see/have?
|
|
32
|
+
|
|
33
|
+
Confirm flow is complete before proceeding.
|
|
34
|
+
|
|
35
|
+
## Phase 3 — Use Case List
|
|
36
|
+
**CHECKPOINT 3/9**
|
|
37
|
+
|
|
38
|
+
Derive use cases from the flow. Present as:
|
|
39
|
+
```
|
|
40
|
+
{DOMAIN}-UC1: {Use Case Name}
|
|
41
|
+
{DOMAIN}-UC2: {Use Case Name}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Ask: "Does this cover everything? Any missing use cases?"
|
|
45
|
+
|
|
46
|
+
## Phase 4 — Business Rules
|
|
47
|
+
**CHECKPOINT 4/9**
|
|
48
|
+
|
|
49
|
+
For each use case, identify constraints:
|
|
50
|
+
- Validation rules (what inputs are required/invalid?)
|
|
51
|
+
- Business logic rules (what calculations/decisions happen?)
|
|
52
|
+
- State rules (what must be true before this UC runs?)
|
|
53
|
+
|
|
54
|
+
Format:
|
|
55
|
+
```
|
|
56
|
+
BR-{N}: {Rule description} → applies to UC{N}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Phase 5 — Acceptance Criteria
|
|
60
|
+
**CHECKPOINT 5/9**
|
|
61
|
+
|
|
62
|
+
For each use case, define measurable acceptance criteria:
|
|
63
|
+
```
|
|
64
|
+
AC-UC{N}-{M}: Given {context}, when {action}, then {expected result}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Phase 6 — Edge Cases
|
|
68
|
+
**CHECKPOINT 6/9**
|
|
69
|
+
|
|
70
|
+
Explore failure scenarios:
|
|
71
|
+
- What if required data is missing?
|
|
72
|
+
- What if concurrent requests happen?
|
|
73
|
+
- What if an upstream dependency fails?
|
|
74
|
+
- What are the boundary conditions?
|
|
75
|
+
|
|
76
|
+
## Phase 7 — Scope Boundary
|
|
77
|
+
**CHECKPOINT 7/9**
|
|
78
|
+
|
|
79
|
+
Explicitly define what is OUT of scope for this feature iteration. This prevents scope creep.
|
|
80
|
+
|
|
81
|
+
Format:
|
|
82
|
+
```
|
|
83
|
+
OUT OF SCOPE:
|
|
84
|
+
- {thing}: deferred to {reason/future phase}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Phase 8 — Cross-Service / Cross-Module Dependencies
|
|
88
|
+
**CHECKPOINT 8/9**
|
|
89
|
+
|
|
90
|
+
Identify dependencies on other modules or services:
|
|
91
|
+
- What data does this feature need from other services?
|
|
92
|
+
- What events/callbacks does it produce?
|
|
93
|
+
- What APIs must it call?
|
|
94
|
+
|
|
95
|
+
## Phase 9 — Validation & Summary
|
|
96
|
+
**CHECKPOINT 9/9**
|
|
97
|
+
|
|
98
|
+
Produce final summary:
|
|
99
|
+
```
|
|
100
|
+
Feature: {name}
|
|
101
|
+
Domain: {domain}
|
|
102
|
+
Primary Persona: {role}
|
|
103
|
+
Use Cases: {N} (list)
|
|
104
|
+
Business Rules: {N}
|
|
105
|
+
Dependencies: {list}
|
|
106
|
+
Estimated Complexity: Low / Medium / High
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Ask: "Approved? Or any changes needed?"
|
|
110
|
+
|
|
111
|
+
## Output
|
|
112
|
+
|
|
113
|
+
On approval, write file: `specs/product-definition/{feature-slug}.md`
|
|
114
|
+
|
|
115
|
+
```markdown
|
|
116
|
+
# Product Definition — {Feature Name}
|
|
117
|
+
|
|
118
|
+
**Date**: {date}
|
|
119
|
+
**Domain**: {domain}
|
|
120
|
+
**Status**: draft
|
|
121
|
+
|
|
122
|
+
## Problem Statement
|
|
123
|
+
{from Phase 1}
|
|
124
|
+
|
|
125
|
+
## User Flow
|
|
126
|
+
{from Phase 2}
|
|
127
|
+
|
|
128
|
+
## Use Cases
|
|
129
|
+
| UC-ID | Name | Priority |
|
|
130
|
+
|-------|------|----------|
|
|
131
|
+
| {DOMAIN}-UC1 | {name} | High |
|
|
132
|
+
|
|
133
|
+
## Business Rules
|
|
134
|
+
| BR-ID | Rule | Applies To |
|
|
135
|
+
|-------|------|-----------|
|
|
136
|
+
|
|
137
|
+
## Acceptance Criteria
|
|
138
|
+
{from Phase 5}
|
|
139
|
+
|
|
140
|
+
## Out of Scope
|
|
141
|
+
{from Phase 7}
|
|
142
|
+
|
|
143
|
+
## Cross-Service Dependencies
|
|
144
|
+
{from Phase 8}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
{{include:steps/report-footer.md}}
|
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generates a PRD from a product definition, or analyzes an existing PRD through 4 review lenses (QA, DEV, SA, PO) to find gaps and risks. Trigger when: "/generate-prd", "/refine-prd", "tạo PRD", "generate PRD", "phân tích PRD", "review PRD", "refine PRD", "PRD có vấn đề gì không", "check PRD quality".
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# PRD Skills — Generate & Refine
|
|
6
|
+
|
|
7
|
+
This skill handles two commands: `/generate-prd` to create a PRD, and `/refine-prd` to analyze it for gaps.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## /generate-prd — Generate Product Requirements Document
|
|
12
|
+
|
|
13
|
+
### Gate
|
|
14
|
+
|
|
15
|
+
<!-- Directory: specs/product-definition/**/*.md -->
|
|
16
|
+
# Gate — Universal Entry Procedure
|
|
17
|
+
|
|
18
|
+
Every command must execute this gate before proceeding with its specific logic.
|
|
19
|
+
|
|
20
|
+
## Step 0 — Sub-Agent Mode Check
|
|
21
|
+
|
|
22
|
+
Before anything else, check if `$ARGUMENTS` is a JSON payload from an orchestrator:
|
|
23
|
+
|
|
24
|
+
1. Attempt to parse `$ARGUMENTS` as JSON.
|
|
25
|
+
2. If it parses successfully **and** contains `"_agent_mode": true`:
|
|
26
|
+
- **Skip Steps 1, 2, and 3 of this Gate entirely.**
|
|
27
|
+
- Set target file = `payload.target_file`
|
|
28
|
+
- Set loaded context = `payload.context` (do NOT run context-loader.md)
|
|
29
|
+
- Set UC scope = `payload.uc_id` (process only this UC)
|
|
30
|
+
- Set line range = `payload.uc_section` (read only that PRD section)
|
|
31
|
+
- Proceed directly to the command-specific logic.
|
|
32
|
+
3. If `$ARGUMENTS` is not JSON or `_agent_mode` is absent → continue to Step 1 (normal mode).
|
|
33
|
+
|
|
34
|
+
## Step 0-B — Model Check
|
|
35
|
+
|
|
36
|
+
*Skip this step if `_agent_mode: true` (sub-agent — orchestrator already validated).*
|
|
37
|
+
|
|
38
|
+
Complex generation and review commands require strong reasoning.
|
|
39
|
+
Using a smaller model risks missed edge cases, incomplete spec analysis, and architecture violations.
|
|
40
|
+
|
|
41
|
+
Display and wait for response:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
⚙️ MODEL CHECK
|
|
45
|
+
──────────────────────────────────────────────────────────────────
|
|
46
|
+
Recommended : claude-opus-4-5 (or claude-opus-4)
|
|
47
|
+
Why needed : Spec analysis, architecture review, code generation
|
|
48
|
+
require deep reasoning. Smaller models miss edge cases.
|
|
49
|
+
|
|
50
|
+
To switch in Claude Code:
|
|
51
|
+
• Settings → Model → select "claude-opus"
|
|
52
|
+
• or: /model → choose claude-opus
|
|
53
|
+
|
|
54
|
+
Running on claude-opus?
|
|
55
|
+
Y — yes, on claude-opus → proceed
|
|
56
|
+
S — skip check (I accept lower quality risk with current model)
|
|
57
|
+
──────────────────────────────────────────────────────────────────
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- "Y" → proceed to Step 1.
|
|
61
|
+
- "S" → proceed to Step 1 (user accepts risk, add ⚠️ to final report).
|
|
62
|
+
- "N" or anything else → **STOP.** Output: "Please switch to claude-opus, then re-run this command."
|
|
63
|
+
|
|
64
|
+
## Step 1 — Resolve Target File
|
|
65
|
+
|
|
66
|
+
1. If `$ARGUMENTS` is provided and points to an existing file → use it directly as the target.
|
|
67
|
+
2. If `$ARGUMENTS` is a UC-ID, ticket ID, or partial name → search for matching files in the relevant directory.
|
|
68
|
+
3. If `$ARGUMENTS` is empty or no match found:
|
|
69
|
+
- List files in the relevant directory for this command (e.g., `specs/prd/**/*.md` for PRD commands, `specs/bdd/**/*.feature` for BDD commands).
|
|
70
|
+
- Present the list to the user and ask: "Which file do you want to work with? (Enter number or filename)"
|
|
71
|
+
- Wait for user selection before continuing.
|
|
72
|
+
|
|
73
|
+
## Step 2 — Execute Context Loader
|
|
74
|
+
|
|
75
|
+
Load all project context by following the procedure in `steps/context-loader.md`.
|
|
76
|
+
Store all loaded context in memory for use throughout this command session.
|
|
77
|
+
|
|
78
|
+
## Step 3 — CHECKPOINT
|
|
79
|
+
|
|
80
|
+
After completing Steps 1 and 2, display a summary and wait for confirmation:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
CHECKPOINT
|
|
84
|
+
-----------
|
|
85
|
+
Target : {resolved file path}
|
|
86
|
+
Project : {project.name from project-context.yaml}
|
|
87
|
+
Tech stack : {language} / {framework}
|
|
88
|
+
Module : {module if set, else "not configured"}
|
|
89
|
+
Domains : {comma-separated domain list}
|
|
90
|
+
|
|
91
|
+
Proceed? (Y/N)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Wait for explicit "Y" or "N" from the user before continuing.
|
|
95
|
+
- "Y" → proceed to the command-specific steps below.
|
|
96
|
+
- "N" → stop and ask what the user wants to change.
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### Generate
|
|
100
|
+
|
|
101
|
+
Write `specs/prd/{domain}/{slug}.md`:
|
|
102
|
+
|
|
103
|
+
```markdown
|
|
104
|
+
# PRD — {Feature Name}
|
|
105
|
+
|
|
106
|
+
**Version**: 1.0
|
|
107
|
+
**Status**: draft
|
|
108
|
+
**Domain**: {domain}
|
|
109
|
+
**Ticket**: {TICKET_PREFIX}-{N} (if available)
|
|
110
|
+
**Date**: {date}
|
|
111
|
+
|
|
112
|
+
## 1. Problem Statement
|
|
113
|
+
{from product-definition}
|
|
114
|
+
|
|
115
|
+
## 2. Goals & Non-Goals
|
|
116
|
+
|
|
117
|
+
### Goals
|
|
118
|
+
- {goal 1}
|
|
119
|
+
|
|
120
|
+
### Non-Goals
|
|
121
|
+
- {non-goal 1}
|
|
122
|
+
|
|
123
|
+
## 3. User Stories
|
|
124
|
+
|
|
125
|
+
As a {persona}, I want to {action} so that {benefit}.
|
|
126
|
+
|
|
127
|
+
## 4. Use Cases
|
|
128
|
+
|
|
129
|
+
| UC-ID | Name | Priority | Description |
|
|
130
|
+
|-------|------|----------|-------------|
|
|
131
|
+
| {DOMAIN}-UC1 | {name} | High | {description} |
|
|
132
|
+
|
|
133
|
+
## 5. Business Rules
|
|
134
|
+
|
|
135
|
+
| BR-ID | Rule | UC |
|
|
136
|
+
|-------|------|----|
|
|
137
|
+
| BR-1 | {rule} | UC1 |
|
|
138
|
+
|
|
139
|
+
## 6. Acceptance Criteria
|
|
140
|
+
|
|
141
|
+
### {DOMAIN}-UC1: {Name}
|
|
142
|
+
- AC1: Given {context}, when {action}, then {result}
|
|
143
|
+
|
|
144
|
+
## 7. Out of Scope
|
|
145
|
+
{from product-definition}
|
|
146
|
+
|
|
147
|
+
## 8. Cross-Service Dependencies
|
|
148
|
+
{from product-definition}
|
|
149
|
+
|
|
150
|
+
## 9. Open Questions
|
|
151
|
+
- [ ] {question requiring clarification}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Output
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
✅ PRD created: specs/prd/{domain}/{slug}.md
|
|
158
|
+
Status: draft
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
# Report Footer — Standard Command Output Format
|
|
162
|
+
|
|
163
|
+
Every command report must end with this standard footer section.
|
|
164
|
+
|
|
165
|
+
## Status Badge
|
|
166
|
+
|
|
167
|
+
Choose one based on outcome:
|
|
168
|
+
- `✅ Complete` — all steps succeeded, no issues found
|
|
169
|
+
- `❌ Failed` — command could not complete due to a blocking error
|
|
170
|
+
- `⚠️ Warnings` — completed with non-blocking issues that should be reviewed
|
|
171
|
+
|
|
172
|
+
## Output Artifacts
|
|
173
|
+
|
|
174
|
+
List every file created or modified by this command:
|
|
175
|
+
```
|
|
176
|
+
Output Artifacts:
|
|
177
|
+
{created|updated} {file-path} ({brief description})
|
|
178
|
+
{created|updated} {file-path} ({brief description})
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
|
|
182
|
+
|
|
183
|
+
## Next Command Suggestion
|
|
184
|
+
|
|
185
|
+
Suggest the logical next command based on workflow phase:
|
|
186
|
+
|
|
187
|
+
| Current command | Suggest next |
|
|
188
|
+
|-------------------------|-----------------------------------------------|
|
|
189
|
+
| /define-product | `/generate-prd {product-definition-file}` |
|
|
190
|
+
| /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
|
|
191
|
+
| /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
|
|
192
|
+
| /review-context (PRD) | `/generate-bdd {prd-file}` if APPROVED; fix PRD if NEEDS_FIX |
|
|
193
|
+
| /generate-bdd | `/review-context {feature-file}` to verify coverage |
|
|
194
|
+
| /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
|
|
195
|
+
| /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
|
|
196
|
+
| /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
|
|
197
|
+
| /generate-code | `/generate-tests {UC-ID}` |
|
|
198
|
+
| /generate-tests | `/run-tests {UC-ID}` |
|
|
199
|
+
| /run-tests (passing) | `/review-code {UC-ID}` |
|
|
200
|
+
| /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
|
|
201
|
+
| /review-code | `/smoke-test {UC-ID}` or create PR |
|
|
202
|
+
| /smoke-test | Create PR and link to ticket |
|
|
203
|
+
| /validate-traces | `/generate-code {UC-ID}` for gaps |
|
|
204
|
+
| /fix-bug | Create PR and link to ticket |
|
|
205
|
+
| /debug | `/fix-bug {ticket-id}` if fix needed |
|
|
206
|
+
|
|
207
|
+
Format the footer as:
|
|
208
|
+
```
|
|
209
|
+
---
|
|
210
|
+
Status : {badge}
|
|
211
|
+
{Output Artifacts block}
|
|
212
|
+
Next : {suggested command with example arguments}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## /refine-prd — Analyze PRD Through 4 Review Lenses
|
|
219
|
+
|
|
220
|
+
Performs a structured multi-perspective analysis of a PRD and writes findings to a YAML file for human review.
|
|
221
|
+
|
|
222
|
+
### Gate
|
|
223
|
+
|
|
224
|
+
<!-- Directory: specs/prd/**/*.md -->
|
|
225
|
+
# Gate — Universal Entry Procedure
|
|
226
|
+
|
|
227
|
+
Every command must execute this gate before proceeding with its specific logic.
|
|
228
|
+
|
|
229
|
+
## Step 0 — Sub-Agent Mode Check
|
|
230
|
+
|
|
231
|
+
Before anything else, check if `$ARGUMENTS` is a JSON payload from an orchestrator:
|
|
232
|
+
|
|
233
|
+
1. Attempt to parse `$ARGUMENTS` as JSON.
|
|
234
|
+
2. If it parses successfully **and** contains `"_agent_mode": true`:
|
|
235
|
+
- **Skip Steps 1, 2, and 3 of this Gate entirely.**
|
|
236
|
+
- Set target file = `payload.target_file`
|
|
237
|
+
- Set loaded context = `payload.context` (do NOT run context-loader.md)
|
|
238
|
+
- Set UC scope = `payload.uc_id` (process only this UC)
|
|
239
|
+
- Set line range = `payload.uc_section` (read only that PRD section)
|
|
240
|
+
- Proceed directly to the command-specific logic.
|
|
241
|
+
3. If `$ARGUMENTS` is not JSON or `_agent_mode` is absent → continue to Step 1 (normal mode).
|
|
242
|
+
|
|
243
|
+
## Step 0-B — Model Check
|
|
244
|
+
|
|
245
|
+
*Skip this step if `_agent_mode: true` (sub-agent — orchestrator already validated).*
|
|
246
|
+
|
|
247
|
+
Complex generation and review commands require strong reasoning.
|
|
248
|
+
Using a smaller model risks missed edge cases, incomplete spec analysis, and architecture violations.
|
|
249
|
+
|
|
250
|
+
Display and wait for response:
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
⚙️ MODEL CHECK
|
|
254
|
+
──────────────────────────────────────────────────────────────────
|
|
255
|
+
Recommended : claude-opus-4-5 (or claude-opus-4)
|
|
256
|
+
Why needed : Spec analysis, architecture review, code generation
|
|
257
|
+
require deep reasoning. Smaller models miss edge cases.
|
|
258
|
+
|
|
259
|
+
To switch in Claude Code:
|
|
260
|
+
• Settings → Model → select "claude-opus"
|
|
261
|
+
• or: /model → choose claude-opus
|
|
262
|
+
|
|
263
|
+
Running on claude-opus?
|
|
264
|
+
Y — yes, on claude-opus → proceed
|
|
265
|
+
S — skip check (I accept lower quality risk with current model)
|
|
266
|
+
──────────────────────────────────────────────────────────────────
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
- "Y" → proceed to Step 1.
|
|
270
|
+
- "S" → proceed to Step 1 (user accepts risk, add ⚠️ to final report).
|
|
271
|
+
- "N" or anything else → **STOP.** Output: "Please switch to claude-opus, then re-run this command."
|
|
272
|
+
|
|
273
|
+
## Step 1 — Resolve Target File
|
|
274
|
+
|
|
275
|
+
1. If `$ARGUMENTS` is provided and points to an existing file → use it directly as the target.
|
|
276
|
+
2. If `$ARGUMENTS` is a UC-ID, ticket ID, or partial name → search for matching files in the relevant directory.
|
|
277
|
+
3. If `$ARGUMENTS` is empty or no match found:
|
|
278
|
+
- List files in the relevant directory for this command (e.g., `specs/prd/**/*.md` for PRD commands, `specs/bdd/**/*.feature` for BDD commands).
|
|
279
|
+
- Present the list to the user and ask: "Which file do you want to work with? (Enter number or filename)"
|
|
280
|
+
- Wait for user selection before continuing.
|
|
281
|
+
|
|
282
|
+
## Step 2 — Execute Context Loader
|
|
283
|
+
|
|
284
|
+
Load all project context by following the procedure in `steps/context-loader.md`.
|
|
285
|
+
Store all loaded context in memory for use throughout this command session.
|
|
286
|
+
|
|
287
|
+
## Step 3 — CHECKPOINT
|
|
288
|
+
|
|
289
|
+
After completing Steps 1 and 2, display a summary and wait for confirmation:
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
CHECKPOINT
|
|
293
|
+
-----------
|
|
294
|
+
Target : {resolved file path}
|
|
295
|
+
Project : {project.name from project-context.yaml}
|
|
296
|
+
Tech stack : {language} / {framework}
|
|
297
|
+
Module : {module if set, else "not configured"}
|
|
298
|
+
Domains : {comma-separated domain list}
|
|
299
|
+
|
|
300
|
+
Proceed? (Y/N)
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Wait for explicit "Y" or "N" from the user before continuing.
|
|
304
|
+
- "Y" → proceed to the command-specific steps below.
|
|
305
|
+
- "N" → stop and ask what the user wants to change.
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
### Analyze — 4 Lenses (run all four perspectives)
|
|
309
|
+
|
|
310
|
+
#### QA Lens — Test Coverage & Edge Cases
|
|
311
|
+
Evaluate:
|
|
312
|
+
- Are all acceptance criteria testable and measurable?
|
|
313
|
+
- Are edge cases and error scenarios specified?
|
|
314
|
+
- Are boundary conditions defined?
|
|
315
|
+
- Is there ambiguity in expected behavior?
|
|
316
|
+
|
|
317
|
+
#### DEV Lens — Technical Clarity & Feasibility
|
|
318
|
+
Evaluate:
|
|
319
|
+
- Are API inputs/outputs clearly defined?
|
|
320
|
+
- Are business rules unambiguous enough to implement?
|
|
321
|
+
- Are there performance or scalability concerns?
|
|
322
|
+
- Are cross-service dependencies fully described?
|
|
323
|
+
- Is there anything technically infeasible or risky?
|
|
324
|
+
|
|
325
|
+
#### SA Lens — Architecture & Design
|
|
326
|
+
Evaluate:
|
|
327
|
+
- Does this fit the existing architecture?
|
|
328
|
+
- Are there design patterns or constraints to apply?
|
|
329
|
+
- Is data modeling clear (entities, relationships)?
|
|
330
|
+
- Are there security or auth implications?
|
|
331
|
+
|
|
332
|
+
#### PO Lens — Business Value & Scope
|
|
333
|
+
Evaluate:
|
|
334
|
+
- Is scope clearly bounded?
|
|
335
|
+
- Are priorities clear?
|
|
336
|
+
- Are success metrics defined?
|
|
337
|
+
- Are stakeholder needs fully captured?
|
|
338
|
+
- Any scope creep risk?
|
|
339
|
+
|
|
340
|
+
### Write Output
|
|
341
|
+
|
|
342
|
+
Derive the output filename from the PRD slug:
|
|
343
|
+
- PRD file: `specs/prd/payment/create-invoice.md` → output: `.agent/review/create-invoice-findings.yaml`
|
|
344
|
+
- Rule: take the PRD filename (without `.md`), append `-findings.yaml`
|
|
345
|
+
|
|
346
|
+
Write findings to `.agent/review/{prd-slug}-findings.yaml`:
|
|
347
|
+
|
|
348
|
+
```yaml
|
|
349
|
+
# Generated by /refine-prd
|
|
350
|
+
# Review each finding and mark: accepted / rejected / needs_discussion
|
|
351
|
+
prd_source: "specs/prd/{domain}/{slug}.md"
|
|
352
|
+
generated_at: "{ISO datetime}"
|
|
353
|
+
status: "pending_review"
|
|
354
|
+
|
|
355
|
+
findings:
|
|
356
|
+
- id: "F001"
|
|
357
|
+
lens: "QA" # QA | DEV | SA | PO
|
|
358
|
+
severity: "major" # critical | major | minor
|
|
359
|
+
section: "§6. Acceptance Criteria"
|
|
360
|
+
finding: "{Clear description of the gap or issue}"
|
|
361
|
+
suggestion: "{Specific actionable improvement}"
|
|
362
|
+
status: "pending" # pending | accepted | rejected | needs_discussion
|
|
363
|
+
|
|
364
|
+
- id: "F002"
|
|
365
|
+
lens: "DEV"
|
|
366
|
+
severity: "minor"
|
|
367
|
+
section: "§8. Cross-Service Dependencies"
|
|
368
|
+
finding: "{finding}"
|
|
369
|
+
suggestion: "{suggestion}"
|
|
370
|
+
status: "pending"
|
|
371
|
+
|
|
372
|
+
summary:
|
|
373
|
+
total_findings: {N}
|
|
374
|
+
by_severity:
|
|
375
|
+
critical: {N}
|
|
376
|
+
major: {N}
|
|
377
|
+
minor: {N}
|
|
378
|
+
by_lens:
|
|
379
|
+
QA: {N}
|
|
380
|
+
DEV: {N}
|
|
381
|
+
SA: {N}
|
|
382
|
+
PO: {N}
|
|
383
|
+
recommendation: "APPROVED_WITH_MINOR_CHANGES | NEEDS_REVISION | BLOCKED"
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### Report to User
|
|
387
|
+
|
|
388
|
+
```
|
|
389
|
+
/refine-prd Complete — {PRD name}
|
|
390
|
+
|
|
391
|
+
Findings: {total} total
|
|
392
|
+
🔴 Critical: {N} 🟡 Major: {N} 🟢 Minor: {N}
|
|
393
|
+
|
|
394
|
+
Top issues:
|
|
395
|
+
[F001] QA/major — {brief description}
|
|
396
|
+
[F002] DEV/minor — {brief description}
|
|
397
|
+
|
|
398
|
+
Review file: .agent/review/{prd-slug}-findings.yaml
|
|
399
|
+
→ Open with Review Board extension (right-click file) to accept/reject each finding
|
|
400
|
+
→ After review: update PRD and run /generate-bdd
|
|
401
|
+
```
|
|
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
|
+
|