specflow-cc 1.3.1 → 1.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/CHANGELOG.md +32 -0
- package/README.md +73 -194
- package/agents/discusser.md +190 -0
- package/agents/researcher.md +201 -0
- package/commands/sf/audit.md +2 -0
- package/commands/sf/discuss.md +174 -0
- package/commands/sf/help.md +37 -5
- package/commands/sf/init.md +7 -1
- package/commands/sf/new.md +19 -1
- package/commands/sf/research.md +158 -0
- package/package.json +1 -1
- package/templates/research.md +75 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,38 @@ All notable changes to SpecFlow will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.5.0] - 2026-01-22
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `/sf:discuss` — Interactive Q&A to clarify requirements and resolve ambiguities
|
|
13
|
+
- `discusser` agent — Conducts focused discussions with clear options
|
|
14
|
+
- `.specflow/discussions/` directory for discussion records
|
|
15
|
+
- Discuss hints after `/sf:new` and `/sf:audit` (NEEDS_REVISION)
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Help section "Research & Analysis" renamed to "Research & Clarification"
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## [1.4.0] - 2026-01-21
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- `/sf:research` — Research topics before creating specifications
|
|
28
|
+
- `researcher` agent — Explores codebase and web for findings
|
|
29
|
+
- `research.md` template — Structured research document format
|
|
30
|
+
- `--research RES-XXX` flag for `/sf:new` — Include research as spec context
|
|
31
|
+
- `.specflow/research/` directory created on init
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- `/sf:help` now includes Research & Analysis section
|
|
36
|
+
- Quick start guide updated with optional research step
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
8
40
|
## [1.3.1] - 2026-01-21
|
|
9
41
|
|
|
10
42
|
### Fixed
|
package/README.md
CHANGED
|
@@ -1,252 +1,131 @@
|
|
|
1
1
|
# SpecFlow
|
|
2
2
|
|
|
3
|
-
**Spec-driven development
|
|
3
|
+
**Spec-driven development for Claude Code**
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## Philosophy
|
|
8
|
-
|
|
9
|
-
| Principle | Description |
|
|
10
|
-
|-----------|-------------|
|
|
11
|
-
| **Spec-first** | Write specifications before code |
|
|
12
|
-
| **Explicit audit** | Dedicated audit phase, not just verification |
|
|
13
|
-
| **Fresh context** | Auditors don't see the creation process (no bias) |
|
|
14
|
-
| **Lean process** | Minimal commands, maximum value |
|
|
15
|
-
| **Human gate** | You control when to proceed (soft blocking) |
|
|
16
|
-
| **Token awareness** | Specs sized for single sessions (~150k tokens) |
|
|
5
|
+
Write specs first, audit them, then implement. Quality through explicit review cycles.
|
|
17
6
|
|
|
18
7
|
## Installation
|
|
19
8
|
|
|
20
9
|
```bash
|
|
21
|
-
# Interactive mode (prompts for location)
|
|
22
|
-
npx specflow-cc
|
|
23
|
-
|
|
24
|
-
# Install globally (recommended)
|
|
25
10
|
npx specflow-cc --global
|
|
26
|
-
|
|
27
|
-
# Install to current project only
|
|
28
|
-
npx specflow-cc --local
|
|
29
11
|
```
|
|
30
12
|
|
|
31
|
-
### Options
|
|
32
|
-
|
|
33
|
-
| Flag | Description |
|
|
34
|
-
|------|-------------|
|
|
35
|
-
| `-g, --global` | Install to `~/.claude` (available in all projects) |
|
|
36
|
-
| `-l, --local` | Install to `./.claude` (current project only) |
|
|
37
|
-
| `--force-statusline` | Replace existing statusline configuration |
|
|
38
|
-
| `-h, --help` | Show help |
|
|
39
|
-
|
|
40
13
|
## Quick Start
|
|
41
14
|
|
|
42
15
|
```bash
|
|
43
|
-
#
|
|
44
|
-
/sf:
|
|
45
|
-
|
|
46
|
-
#
|
|
47
|
-
/sf:
|
|
48
|
-
|
|
49
|
-
# 3. Audit the specification (fresh context)
|
|
50
|
-
/sf:audit
|
|
51
|
-
|
|
52
|
-
# 4. Revise if needed
|
|
53
|
-
/sf:revise
|
|
54
|
-
|
|
55
|
-
# 5. Execute when approved
|
|
56
|
-
/sf:run
|
|
57
|
-
|
|
58
|
-
# 6. Review implementation (fresh context)
|
|
59
|
-
/sf:review
|
|
60
|
-
|
|
61
|
-
# 7. Fix if needed
|
|
62
|
-
/sf:fix
|
|
63
|
-
|
|
64
|
-
# 8. Complete and archive
|
|
65
|
-
/sf:done
|
|
16
|
+
/sf:init # Initialize project (once)
|
|
17
|
+
/sf:new "add user auth" # Create specification
|
|
18
|
+
/sf:audit # Audit spec (fresh context)
|
|
19
|
+
/sf:run # Implement
|
|
20
|
+
/sf:review # Review implementation
|
|
21
|
+
/sf:done # Complete and archive
|
|
66
22
|
```
|
|
67
23
|
|
|
68
|
-
##
|
|
69
|
-
|
|
70
|
-
### Core Workflow
|
|
24
|
+
## Workflow
|
|
71
25
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
| `/sf:run` | Execute specification |
|
|
79
|
-
| `/sf:review` | Review implementation (fresh context) |
|
|
80
|
-
| `/sf:fix [instructions]` | Fix based on review |
|
|
81
|
-
| `/sf:done` | Complete, commit, and archive |
|
|
82
|
-
| `/sf:status` | Show current state and next step |
|
|
26
|
+
```
|
|
27
|
+
/sf:new → /sf:audit → /sf:run → /sf:review → /sf:done
|
|
28
|
+
↓ ↓
|
|
29
|
+
/sf:revise /sf:fix
|
|
30
|
+
(if needed) (if needed)
|
|
31
|
+
```
|
|
83
32
|
|
|
84
|
-
|
|
33
|
+
**Key principle:** Audits and reviews run in fresh context — no bias from creation.
|
|
85
34
|
|
|
86
|
-
|
|
87
|
-
|---------|-------------|
|
|
88
|
-
| `/sf:list` | List all specifications |
|
|
89
|
-
| `/sf:show [ID]` | Show specification details |
|
|
90
|
-
| `/sf:next` | Switch to next priority task |
|
|
35
|
+
## Commands
|
|
91
36
|
|
|
92
|
-
###
|
|
37
|
+
### Core Flow
|
|
93
38
|
|
|
94
39
|
| Command | Description |
|
|
95
40
|
|---------|-------------|
|
|
96
|
-
| `/sf:
|
|
97
|
-
| `/sf:
|
|
98
|
-
| `/sf:
|
|
99
|
-
| `/sf:
|
|
41
|
+
| `/sf:init` | Initialize project |
|
|
42
|
+
| `/sf:new` | Create specification |
|
|
43
|
+
| `/sf:audit` | Audit spec (fresh context) |
|
|
44
|
+
| `/sf:revise` | Revise based on audit |
|
|
45
|
+
| `/sf:run` | Implement spec |
|
|
46
|
+
| `/sf:review` | Review implementation |
|
|
47
|
+
| `/sf:fix` | Fix based on review |
|
|
48
|
+
| `/sf:done` | Complete and archive |
|
|
100
49
|
|
|
101
|
-
###
|
|
50
|
+
### Before You Spec
|
|
102
51
|
|
|
103
52
|
| Command | Description |
|
|
104
53
|
|---------|-------------|
|
|
105
|
-
| `/sf:
|
|
106
|
-
| `/sf:
|
|
54
|
+
| `/sf:research` | Research topic, save findings |
|
|
55
|
+
| `/sf:discuss` | Clarify requirements via Q&A |
|
|
56
|
+
| `/sf:scan` | Analyze codebase for issues |
|
|
107
57
|
|
|
108
|
-
###
|
|
58
|
+
### Navigation
|
|
109
59
|
|
|
110
60
|
| Command | Description |
|
|
111
61
|
|---------|-------------|
|
|
112
|
-
| `/sf:
|
|
113
|
-
| `/sf:
|
|
62
|
+
| `/sf:status` | Current state and next step |
|
|
63
|
+
| `/sf:list` | All specifications |
|
|
64
|
+
| `/sf:next` | Switch to priority task |
|
|
65
|
+
| `/sf:show` | View spec details |
|
|
114
66
|
|
|
115
|
-
###
|
|
67
|
+
### Backlog
|
|
116
68
|
|
|
117
69
|
| Command | Description |
|
|
118
70
|
|---------|-------------|
|
|
119
|
-
| `/sf:
|
|
71
|
+
| `/sf:todo` | Add future idea |
|
|
72
|
+
| `/sf:todos` | List all todos |
|
|
73
|
+
| `/sf:plan` | Convert todo to spec |
|
|
74
|
+
| `/sf:priority` | Reprioritize |
|
|
120
75
|
|
|
121
76
|
### Utilities
|
|
122
77
|
|
|
123
78
|
| Command | Description |
|
|
124
79
|
|---------|-------------|
|
|
125
|
-
| `/sf:
|
|
126
|
-
| `/sf:
|
|
127
|
-
| `/sf:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
```
|
|
132
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
133
|
-
│ SPECFLOW WORKFLOW │
|
|
134
|
-
├─────────────────────────────────────────────────────────────┤
|
|
135
|
-
│ │
|
|
136
|
-
│ /sf:init ──→ Initialize project (once) │
|
|
137
|
-
│ ↓ │
|
|
138
|
-
│ /sf:new ──→ Create specification │
|
|
139
|
-
│ ↓ │
|
|
140
|
-
│ ┌─────────────────────────────────────┐ │
|
|
141
|
-
│ │ SPEC AUDIT LOOP │ │
|
|
142
|
-
│ │ /sf:audit ──→ APPROVED? ──yes──→ ──┼──→ │
|
|
143
|
-
│ │ │ │ ↓ │
|
|
144
|
-
│ │ no │ │
|
|
145
|
-
│ │ ↓ │ │
|
|
146
|
-
│ │ /sf:revise ────────→ loop back │ │
|
|
147
|
-
│ └─────────────────────────────────────┘ │
|
|
148
|
-
│ ↓ │
|
|
149
|
-
│ /sf:run ──→ Execute specification │
|
|
150
|
-
│ ↓ │
|
|
151
|
-
│ ┌─────────────────────────────────────┐ │
|
|
152
|
-
│ │ IMPL REVIEW LOOP │ │
|
|
153
|
-
│ │ /sf:review ──→ APPROVED? ──yes──→ ─┼──→ │
|
|
154
|
-
│ │ │ │ ↓ │
|
|
155
|
-
│ │ no │ │
|
|
156
|
-
│ │ ↓ │ │
|
|
157
|
-
│ │ /sf:fix ───────────→ loop back │ │
|
|
158
|
-
│ └─────────────────────────────────────┘ │
|
|
159
|
-
│ ↓ │
|
|
160
|
-
│ /sf:done ──→ Complete and archive │
|
|
161
|
-
│ │
|
|
162
|
-
└─────────────────────────────────────────────────────────────┘
|
|
163
|
-
```
|
|
80
|
+
| `/sf:split` | Break large spec into parts |
|
|
81
|
+
| `/sf:deps` | Show dependencies |
|
|
82
|
+
| `/sf:pause` | Save session context |
|
|
83
|
+
| `/sf:resume` | Restore session |
|
|
84
|
+
| `/sf:help` | Command reference |
|
|
164
85
|
|
|
165
86
|
## Project Structure
|
|
166
87
|
|
|
167
|
-
After `/sf:init`, SpecFlow creates:
|
|
168
|
-
|
|
169
88
|
```
|
|
170
89
|
.specflow/
|
|
171
|
-
├── PROJECT.md
|
|
172
|
-
├── STATE.md
|
|
173
|
-
├──
|
|
174
|
-
├──
|
|
175
|
-
├──
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
├── todos/ # Future ideas
|
|
179
|
-
│ └── TODO.md
|
|
180
|
-
└── archive/ # Completed specifications
|
|
90
|
+
├── PROJECT.md # Project context
|
|
91
|
+
├── STATE.md # Current state
|
|
92
|
+
├── specs/ # Active specs
|
|
93
|
+
├── research/ # Research documents
|
|
94
|
+
├── discussions/ # Clarification records
|
|
95
|
+
├── audits/ # Audit reports
|
|
96
|
+
└── archive/ # Completed specs
|
|
181
97
|
```
|
|
182
98
|
|
|
183
|
-
##
|
|
184
|
-
|
|
185
|
-
```markdown
|
|
186
|
-
---
|
|
187
|
-
id: SPEC-001
|
|
188
|
-
type: feature | refactor | bugfix
|
|
189
|
-
status: draft | audited | running | review | done
|
|
190
|
-
priority: high | medium | low
|
|
191
|
-
complexity: small | medium | large
|
|
192
|
-
created: 2026-01-20
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
# Task Title
|
|
99
|
+
## Typical Session
|
|
196
100
|
|
|
197
|
-
|
|
198
|
-
|
|
101
|
+
```bash
|
|
102
|
+
# Check where you are
|
|
103
|
+
/sf:status
|
|
199
104
|
|
|
200
|
-
|
|
201
|
-
|
|
105
|
+
# Research if needed
|
|
106
|
+
/sf:research "auth options"
|
|
202
107
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
### Files to Create/Modify
|
|
206
|
-
### Files to Delete
|
|
108
|
+
# Create spec with research context
|
|
109
|
+
/sf:new --research RES-001 "add OAuth"
|
|
207
110
|
|
|
208
|
-
|
|
209
|
-
-
|
|
210
|
-
- [ ] Criterion 2
|
|
111
|
+
# Clarify assumptions if needed
|
|
112
|
+
/sf:discuss SPEC-001
|
|
211
113
|
|
|
212
|
-
|
|
213
|
-
|
|
114
|
+
# Audit (use /clear first for fresh context)
|
|
115
|
+
/sf:audit
|
|
214
116
|
|
|
215
|
-
|
|
216
|
-
|
|
117
|
+
# Implement and review
|
|
118
|
+
/sf:run
|
|
119
|
+
/sf:review
|
|
120
|
+
/sf:done
|
|
217
121
|
```
|
|
218
122
|
|
|
219
|
-
##
|
|
220
|
-
|
|
221
|
-
| Size | Tokens | Action |
|
|
222
|
-
|------|--------|--------|
|
|
223
|
-
| Small | ≤50k | Execute directly |
|
|
224
|
-
| Medium | 50-150k | Warning, proceed |
|
|
225
|
-
| Large | >150k | Requires `/sf:split` |
|
|
226
|
-
|
|
227
|
-
## Statusline
|
|
228
|
-
|
|
229
|
-
SpecFlow includes a statusline hook showing:
|
|
230
|
-
- Current model
|
|
231
|
-
- Active specification status `[SF: SPEC-001 running]`
|
|
232
|
-
- Context window usage (color-coded)
|
|
233
|
-
|
|
234
|
-
## Comparison with GSD
|
|
235
|
-
|
|
236
|
-
| Aspect | GSD | SpecFlow |
|
|
237
|
-
|--------|-----|----------|
|
|
238
|
-
| Commands | 25 | 23 |
|
|
239
|
-
| Agents | 11 | 7 |
|
|
240
|
-
| Phases per task | 5+ | 3-4 |
|
|
241
|
-
| Quality audit | No | Yes (explicit) |
|
|
242
|
-
| Revision loop | No | Yes |
|
|
243
|
-
| Code deletion | Not verified | Explicit checklist |
|
|
244
|
-
| Blocking | Hard | Soft (warning) |
|
|
245
|
-
|
|
246
|
-
## Documentation
|
|
123
|
+
## Philosophy
|
|
247
124
|
|
|
248
|
-
-
|
|
249
|
-
-
|
|
125
|
+
- **Spec-first** — Write specs before code
|
|
126
|
+
- **Fresh audits** — Auditors don't see creation (no bias)
|
|
127
|
+
- **Soft blocking** — Warnings, not hard stops
|
|
128
|
+
- **Token-aware** — Specs sized for single sessions
|
|
250
129
|
|
|
251
130
|
## License
|
|
252
131
|
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sf-discusser
|
|
3
|
+
description: Conducts interactive discussions to clarify requirements and resolve ambiguities
|
|
4
|
+
tools: Read, Write, Glob, Grep, AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<role>
|
|
8
|
+
You are a SpecFlow discusser. Your job is to conduct focused, interactive discussions that clarify requirements and resolve ambiguities before or during specification work.
|
|
9
|
+
|
|
10
|
+
Your approach:
|
|
11
|
+
1. Identify key decision points and ambiguities
|
|
12
|
+
2. Ask focused questions with clear options
|
|
13
|
+
3. Document decisions for spec creation/revision
|
|
14
|
+
4. Keep discussions efficient (3-7 questions max)
|
|
15
|
+
</role>
|
|
16
|
+
|
|
17
|
+
<philosophy>
|
|
18
|
+
|
|
19
|
+
## Question Quality
|
|
20
|
+
|
|
21
|
+
Good questions:
|
|
22
|
+
- Have clear, mutually exclusive options
|
|
23
|
+
- Focus on decisions that affect implementation
|
|
24
|
+
- Are specific and actionable
|
|
25
|
+
- Include reasoning for why it matters
|
|
26
|
+
|
|
27
|
+
Bad questions:
|
|
28
|
+
- Vague or open-ended without options
|
|
29
|
+
- About implementation details (that's for the spec)
|
|
30
|
+
- Already answerable from project context
|
|
31
|
+
- Too many at once (>4 options)
|
|
32
|
+
|
|
33
|
+
## Discussion Efficiency
|
|
34
|
+
|
|
35
|
+
- Start with the most important decision
|
|
36
|
+
- Group related questions when possible
|
|
37
|
+
- Stop when core decisions are made
|
|
38
|
+
- Don't ask about things that can be assumed
|
|
39
|
+
|
|
40
|
+
## Output Quality
|
|
41
|
+
|
|
42
|
+
Discussion records should:
|
|
43
|
+
- Be scannable (bullet points, not prose)
|
|
44
|
+
- Link decisions to their rationale
|
|
45
|
+
- Be usable as context for spec creation/revision
|
|
46
|
+
|
|
47
|
+
</philosophy>
|
|
48
|
+
|
|
49
|
+
<process>
|
|
50
|
+
|
|
51
|
+
## Step 1: Analyze Context
|
|
52
|
+
|
|
53
|
+
Read the provided context:
|
|
54
|
+
- If spec mode: understand the specification and any audit comments
|
|
55
|
+
- If requirements mode: understand the topic and project patterns
|
|
56
|
+
|
|
57
|
+
Identify:
|
|
58
|
+
- Key ambiguities or missing decisions
|
|
59
|
+
- Trade-offs that need user input
|
|
60
|
+
- Assumptions that should be validated
|
|
61
|
+
|
|
62
|
+
## Step 2: Prioritize Questions
|
|
63
|
+
|
|
64
|
+
Select 3-7 questions that:
|
|
65
|
+
1. Would fundamentally change the approach
|
|
66
|
+
2. Have no clear default from project context
|
|
67
|
+
3. User must decide (not technical details)
|
|
68
|
+
|
|
69
|
+
Order by importance — most critical first.
|
|
70
|
+
|
|
71
|
+
## Step 3: Conduct Discussion
|
|
72
|
+
|
|
73
|
+
For each question, use AskUserQuestion with:
|
|
74
|
+
- Clear header (2-3 words)
|
|
75
|
+
- Specific question ending with ?
|
|
76
|
+
- 2-4 options with descriptions
|
|
77
|
+
- Each option explains the implication
|
|
78
|
+
|
|
79
|
+
**Example:**
|
|
80
|
+
```
|
|
81
|
+
header: "Auth Method"
|
|
82
|
+
question: "How should users authenticate?"
|
|
83
|
+
options:
|
|
84
|
+
- label: "JWT tokens"
|
|
85
|
+
description: "Stateless, good for APIs, tokens stored client-side"
|
|
86
|
+
- label: "Session cookies"
|
|
87
|
+
description: "Server-side state, simpler for web apps"
|
|
88
|
+
- label: "OAuth only"
|
|
89
|
+
description: "Delegate to external provider (Google, GitHub)"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Step 4: Document Decisions
|
|
93
|
+
|
|
94
|
+
After each answer, record:
|
|
95
|
+
- The question asked
|
|
96
|
+
- The decision made
|
|
97
|
+
- The rationale (from user or inferred)
|
|
98
|
+
|
|
99
|
+
## Step 5: Generate Discussion ID
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
mkdir -p .specflow/discussions
|
|
103
|
+
LAST=$(ls .specflow/discussions/DISC-*.md 2>/dev/null | grep -oP 'DISC-\K\d+' | sort -n | tail -1)
|
|
104
|
+
NEXT=$(printf "%03d" $((${LAST:-0} + 1)))
|
|
105
|
+
echo "DISC-$NEXT"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
For spec-related discussions, use: `SPEC-XXX-discuss.md`
|
|
109
|
+
|
|
110
|
+
## Step 6: Write Discussion Record
|
|
111
|
+
|
|
112
|
+
Create `.specflow/discussions/{id}.md`:
|
|
113
|
+
|
|
114
|
+
```markdown
|
|
115
|
+
---
|
|
116
|
+
id: DISC-XXX
|
|
117
|
+
topic: [topic or SPEC-XXX reference]
|
|
118
|
+
created: YYYY-MM-DD
|
|
119
|
+
status: complete
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
# Discussion: [Topic]
|
|
123
|
+
|
|
124
|
+
## Context
|
|
125
|
+
|
|
126
|
+
[Brief description of what prompted this discussion]
|
|
127
|
+
|
|
128
|
+
## Decisions
|
|
129
|
+
|
|
130
|
+
### 1. [Question Summary]
|
|
131
|
+
|
|
132
|
+
**Question:** [Full question]
|
|
133
|
+
|
|
134
|
+
**Decision:** [Chosen option]
|
|
135
|
+
|
|
136
|
+
**Rationale:** [Why this was chosen]
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### 2. [Question Summary]
|
|
141
|
+
|
|
142
|
+
...
|
|
143
|
+
|
|
144
|
+
## Summary
|
|
145
|
+
|
|
146
|
+
[2-3 sentence summary of key decisions and their impact]
|
|
147
|
+
|
|
148
|
+
## Next Steps
|
|
149
|
+
|
|
150
|
+
- [Action 1]
|
|
151
|
+
- [Action 2]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
</process>
|
|
155
|
+
|
|
156
|
+
<output>
|
|
157
|
+
|
|
158
|
+
Return structured result:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
## DISCUSSION COMPLETE
|
|
162
|
+
|
|
163
|
+
**ID:** DISC-XXX (or SPEC-XXX-discuss)
|
|
164
|
+
**Topic:** [topic]
|
|
165
|
+
**Questions:** [count]
|
|
166
|
+
**Decisions:** [count]
|
|
167
|
+
|
|
168
|
+
### Key Decisions
|
|
169
|
+
|
|
170
|
+
1. **[Topic]:** [Decision] — [Brief rationale]
|
|
171
|
+
2. **[Topic]:** [Decision] — [Brief rationale]
|
|
172
|
+
3. **[Topic]:** [Decision] — [Brief rationale]
|
|
173
|
+
|
|
174
|
+
### File
|
|
175
|
+
.specflow/discussions/{filename}.md
|
|
176
|
+
|
|
177
|
+
### Next Step
|
|
178
|
+
{Contextual recommendation}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
</output>
|
|
182
|
+
|
|
183
|
+
<success_criteria>
|
|
184
|
+
- [ ] Context analyzed for ambiguities
|
|
185
|
+
- [ ] 3-7 focused questions with options
|
|
186
|
+
- [ ] All questions use AskUserQuestion tool
|
|
187
|
+
- [ ] Decisions documented with rationale
|
|
188
|
+
- [ ] Discussion file created
|
|
189
|
+
- [ ] Clear next step provided
|
|
190
|
+
</success_criteria>
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sf-researcher
|
|
3
|
+
description: Researches topics and creates structured findings documents for specification context
|
|
4
|
+
tools: Read, Write, Glob, Grep, WebSearch, WebFetch
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<role>
|
|
8
|
+
You are a SpecFlow researcher. Your job is to thoroughly research a topic and create a structured findings document that can be used as context when creating specifications.
|
|
9
|
+
|
|
10
|
+
Your research should:
|
|
11
|
+
1. Explore the existing codebase for relevant patterns and code
|
|
12
|
+
2. Search the web for best practices and approaches (when applicable)
|
|
13
|
+
3. Identify multiple options with clear trade-offs
|
|
14
|
+
4. Make recommendations based on project context
|
|
15
|
+
</role>
|
|
16
|
+
|
|
17
|
+
<philosophy>
|
|
18
|
+
|
|
19
|
+
## Research Depth
|
|
20
|
+
|
|
21
|
+
Research should be:
|
|
22
|
+
- **Practical:** Focused on implementation, not theory
|
|
23
|
+
- **Contextual:** Consider the project's existing patterns and constraints
|
|
24
|
+
- **Actionable:** Clear recommendations that can inform specs
|
|
25
|
+
- **Balanced:** Present multiple options, not just one
|
|
26
|
+
|
|
27
|
+
## Output Quality
|
|
28
|
+
|
|
29
|
+
Good research documents:
|
|
30
|
+
- Summarize findings concisely (spec-creator can read quickly)
|
|
31
|
+
- List concrete options with pros/cons
|
|
32
|
+
- Reference specific files in codebase when relevant
|
|
33
|
+
- Provide clear recommendations with reasoning
|
|
34
|
+
|
|
35
|
+
</philosophy>
|
|
36
|
+
|
|
37
|
+
<process>
|
|
38
|
+
|
|
39
|
+
## Step 1: Load Project Context
|
|
40
|
+
|
|
41
|
+
Read `.specflow/PROJECT.md` to understand:
|
|
42
|
+
- Tech stack (what technologies are in play)
|
|
43
|
+
- Existing patterns (what conventions to follow)
|
|
44
|
+
- Constraints (what limitations exist)
|
|
45
|
+
|
|
46
|
+
## Step 2: Generate Research ID
|
|
47
|
+
|
|
48
|
+
Find next available RES-XXX number:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
mkdir -p .specflow/research
|
|
52
|
+
LAST=$(ls .specflow/research/RES-*.md 2>/dev/null | sort -V | tail -1 | grep -oP 'RES-\K\d+')
|
|
53
|
+
NEXT=$(printf "%03d" $((${LAST:-0} + 1)))
|
|
54
|
+
echo "RES-$NEXT"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Step 3: Codebase Research
|
|
58
|
+
|
|
59
|
+
Search the codebase for relevant code:
|
|
60
|
+
- Find existing implementations of similar features
|
|
61
|
+
- Identify patterns used in the project
|
|
62
|
+
- Note dependencies and constraints
|
|
63
|
+
|
|
64
|
+
Use Glob and Grep to find:
|
|
65
|
+
- Related files
|
|
66
|
+
- Similar implementations
|
|
67
|
+
- Configuration patterns
|
|
68
|
+
|
|
69
|
+
## Step 4: External Research (if needed)
|
|
70
|
+
|
|
71
|
+
For topics requiring external knowledge:
|
|
72
|
+
- Use WebSearch for best practices
|
|
73
|
+
- Use WebFetch for documentation
|
|
74
|
+
- Focus on authoritative sources
|
|
75
|
+
|
|
76
|
+
**Skip web research if:**
|
|
77
|
+
- Topic is purely internal (refactoring, bugfix)
|
|
78
|
+
- Project patterns are sufficient
|
|
79
|
+
|
|
80
|
+
## Step 5: Synthesize Findings
|
|
81
|
+
|
|
82
|
+
Organize research into:
|
|
83
|
+
1. **Summary:** 2-3 sentences on what was found
|
|
84
|
+
2. **Background:** Why this topic matters
|
|
85
|
+
3. **Options:** Different approaches considered
|
|
86
|
+
4. **Trade-offs:** Pros/cons of each option
|
|
87
|
+
5. **Codebase Findings:** What exists in the project
|
|
88
|
+
6. **Recommendations:** What approach to take and why
|
|
89
|
+
7. **References:** Links to docs, similar code in project
|
|
90
|
+
|
|
91
|
+
## Step 6: Write Research Document
|
|
92
|
+
|
|
93
|
+
Create `.specflow/research/RES-XXX.md`:
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
---
|
|
97
|
+
id: RES-XXX
|
|
98
|
+
topic: [short topic name]
|
|
99
|
+
created: YYYY-MM-DD
|
|
100
|
+
status: complete
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
# Research: [Topic]
|
|
104
|
+
|
|
105
|
+
## Summary
|
|
106
|
+
|
|
107
|
+
[2-3 sentence summary of findings and recommendation]
|
|
108
|
+
|
|
109
|
+
## Background
|
|
110
|
+
|
|
111
|
+
[Why this research was needed, what problem it addresses]
|
|
112
|
+
|
|
113
|
+
## Options Explored
|
|
114
|
+
|
|
115
|
+
### Option 1: [Name]
|
|
116
|
+
|
|
117
|
+
**Description:** [What this approach involves]
|
|
118
|
+
|
|
119
|
+
**Pros:**
|
|
120
|
+
- [Pro 1]
|
|
121
|
+
- [Pro 2]
|
|
122
|
+
|
|
123
|
+
**Cons:**
|
|
124
|
+
- [Con 1]
|
|
125
|
+
- [Con 2]
|
|
126
|
+
|
|
127
|
+
### Option 2: [Name]
|
|
128
|
+
|
|
129
|
+
...
|
|
130
|
+
|
|
131
|
+
## Codebase Findings
|
|
132
|
+
|
|
133
|
+
[What was found in the existing codebase]
|
|
134
|
+
|
|
135
|
+
- `path/to/file.ts` — [what it does, how it's relevant]
|
|
136
|
+
- `path/to/other.ts` — [what it does, how it's relevant]
|
|
137
|
+
|
|
138
|
+
## Trade-offs Analysis
|
|
139
|
+
|
|
140
|
+
| Aspect | Option 1 | Option 2 |
|
|
141
|
+
|--------|----------|----------|
|
|
142
|
+
| Complexity | Low | High |
|
|
143
|
+
| Flexibility | Medium | High |
|
|
144
|
+
| ... | ... | ... |
|
|
145
|
+
|
|
146
|
+
## Recommendations
|
|
147
|
+
|
|
148
|
+
**Recommended approach:** [Option X]
|
|
149
|
+
|
|
150
|
+
**Reasoning:**
|
|
151
|
+
- [Reason 1]
|
|
152
|
+
- [Reason 2]
|
|
153
|
+
|
|
154
|
+
**Implementation notes:**
|
|
155
|
+
- [Note 1]
|
|
156
|
+
- [Note 2]
|
|
157
|
+
|
|
158
|
+
## References
|
|
159
|
+
|
|
160
|
+
- [Link or file reference 1]
|
|
161
|
+
- [Link or file reference 2]
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
</process>
|
|
165
|
+
|
|
166
|
+
<output>
|
|
167
|
+
|
|
168
|
+
Return structured result:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
## RESEARCH COMPLETE
|
|
172
|
+
|
|
173
|
+
**ID:** RES-XXX
|
|
174
|
+
**Topic:** [topic]
|
|
175
|
+
**Created:** [date]
|
|
176
|
+
|
|
177
|
+
### Summary
|
|
178
|
+
[2-3 sentence summary]
|
|
179
|
+
|
|
180
|
+
### Key Findings
|
|
181
|
+
- [Finding 1]
|
|
182
|
+
- [Finding 2]
|
|
183
|
+
- [Finding 3]
|
|
184
|
+
|
|
185
|
+
### Recommendation
|
|
186
|
+
[Brief recommendation]
|
|
187
|
+
|
|
188
|
+
### File
|
|
189
|
+
.specflow/research/RES-XXX.md
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
</output>
|
|
193
|
+
|
|
194
|
+
<success_criteria>
|
|
195
|
+
- [ ] PROJECT.md read for context
|
|
196
|
+
- [ ] Codebase explored for relevant patterns
|
|
197
|
+
- [ ] Web research done (if applicable)
|
|
198
|
+
- [ ] Multiple options identified with trade-offs
|
|
199
|
+
- [ ] RES-XXX.md created with all sections
|
|
200
|
+
- [ ] Clear recommendation provided
|
|
201
|
+
</success_criteria>
|
package/commands/sf/audit.md
CHANGED
|
@@ -174,6 +174,8 @@ Options:
|
|
|
174
174
|
- `/sf:revise all` — apply all feedback
|
|
175
175
|
- `/sf:revise 1,2` — fix specific issues
|
|
176
176
|
- `/sf:revise [instructions]` — custom changes
|
|
177
|
+
|
|
178
|
+
<sub>Optional: `/sf:discuss SPEC-XXX` — clarify requirements before revising</sub>
|
|
177
179
|
```
|
|
178
180
|
|
|
179
181
|
</workflow>
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sf:discuss
|
|
3
|
+
description: Interactive Q&A to clarify requirements or resolve specification ambiguities
|
|
4
|
+
argument-hint: "[SPEC-XXX | topic]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
Conduct an interactive discussion to clarify requirements, resolve ambiguities, or gather additional context. Results are saved and can be used when creating or revising specifications.
|
|
9
|
+
|
|
10
|
+
Use cases:
|
|
11
|
+
- Before `/sf:new`: Clarify requirements before creating a spec
|
|
12
|
+
- After `/sf:new`: Discuss assumptions made in the spec
|
|
13
|
+
- After `/sf:audit`: Resolve issues that need user decision
|
|
14
|
+
</purpose>
|
|
15
|
+
|
|
16
|
+
<context>
|
|
17
|
+
@.specflow/PROJECT.md
|
|
18
|
+
@.specflow/STATE.md
|
|
19
|
+
@~/.claude/specflow-cc/agents/discusser.md
|
|
20
|
+
</context>
|
|
21
|
+
|
|
22
|
+
<workflow>
|
|
23
|
+
|
|
24
|
+
## 1. Verify Initialization
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
[ -d .specflow ] && echo "OK" || echo "NOT_INITIALIZED"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**If NOT_INITIALIZED:**
|
|
31
|
+
```
|
|
32
|
+
SpecFlow not initialized.
|
|
33
|
+
|
|
34
|
+
Run `/sf:init` first.
|
|
35
|
+
```
|
|
36
|
+
Exit.
|
|
37
|
+
|
|
38
|
+
## 2. Parse Arguments
|
|
39
|
+
|
|
40
|
+
Determine discussion mode from arguments:
|
|
41
|
+
|
|
42
|
+
**Case A: `SPEC-XXX` provided**
|
|
43
|
+
- Load the specification
|
|
44
|
+
- Discussion focuses on clarifying that spec
|
|
45
|
+
- Mode: `spec-clarification`
|
|
46
|
+
|
|
47
|
+
**Case B: Topic string provided (not SPEC-XXX)**
|
|
48
|
+
- Discussion about requirements before spec creation
|
|
49
|
+
- Mode: `requirements-gathering`
|
|
50
|
+
|
|
51
|
+
**Case C: No arguments**
|
|
52
|
+
- Check STATE.md for active spec
|
|
53
|
+
- If active spec exists: discuss that spec
|
|
54
|
+
- If no active spec: ask what to discuss
|
|
55
|
+
|
|
56
|
+
## 3. Load Context
|
|
57
|
+
|
|
58
|
+
**For spec-clarification mode:**
|
|
59
|
+
```bash
|
|
60
|
+
[ -f .specflow/specs/SPEC-XXX.md ] && echo "FOUND" || echo "NOT_FOUND"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Read the spec and any associated audit comments.
|
|
64
|
+
|
|
65
|
+
**For requirements-gathering mode:**
|
|
66
|
+
- Load PROJECT.md for context
|
|
67
|
+
- Check for related research in `.specflow/research/`
|
|
68
|
+
|
|
69
|
+
## 4. Spawn Discusser Agent
|
|
70
|
+
|
|
71
|
+
Launch the discusser agent:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
Task(prompt="
|
|
75
|
+
<mode>{mode}</mode>
|
|
76
|
+
|
|
77
|
+
<topic_or_spec>
|
|
78
|
+
{spec content or topic description}
|
|
79
|
+
</topic_or_spec>
|
|
80
|
+
|
|
81
|
+
<project_context>
|
|
82
|
+
@.specflow/PROJECT.md
|
|
83
|
+
</project_context>
|
|
84
|
+
|
|
85
|
+
{If spec mode and audit exists:}
|
|
86
|
+
<audit_context>
|
|
87
|
+
@.specflow/audits/SPEC-XXX-audit.md
|
|
88
|
+
</audit_context>
|
|
89
|
+
|
|
90
|
+
Conduct an interactive discussion to clarify requirements.
|
|
91
|
+
Ask focused questions with clear options when possible.
|
|
92
|
+
", subagent_type="sf-discusser", description="Discuss requirements")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## 5. Handle Discussion Results
|
|
96
|
+
|
|
97
|
+
The agent will:
|
|
98
|
+
1. Ask 3-7 focused questions with options
|
|
99
|
+
2. Document decisions and clarifications
|
|
100
|
+
3. Save results to `.specflow/discussions/`
|
|
101
|
+
|
|
102
|
+
## 6. Save Discussion
|
|
103
|
+
|
|
104
|
+
**For spec-clarification:**
|
|
105
|
+
Append to spec file or create discussion record:
|
|
106
|
+
```
|
|
107
|
+
.specflow/discussions/SPEC-XXX-discuss.md
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**For requirements-gathering:**
|
|
111
|
+
Create discussion record:
|
|
112
|
+
```
|
|
113
|
+
.specflow/discussions/DISC-XXX-{topic-slug}.md
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## 7. Display Result
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
120
|
+
DISCUSSION COMPLETE
|
|
121
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
122
|
+
|
|
123
|
+
**Topic:** [topic or SPEC-XXX]
|
|
124
|
+
**Questions Asked:** [count]
|
|
125
|
+
**Decisions Made:** [count]
|
|
126
|
+
|
|
127
|
+
### Key Decisions
|
|
128
|
+
|
|
129
|
+
1. [Decision 1]
|
|
130
|
+
2. [Decision 2]
|
|
131
|
+
3. [Decision 3]
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
📄 **File:** `.specflow/discussions/{filename}.md`
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Next Step
|
|
140
|
+
|
|
141
|
+
{If requirements-gathering mode:}
|
|
142
|
+
`/sf:new --discuss DISC-XXX "task"` — create spec with discussion context
|
|
143
|
+
|
|
144
|
+
{If spec-clarification mode:}
|
|
145
|
+
`/sf:revise` — apply clarifications to specification
|
|
146
|
+
|
|
147
|
+
{If from audit:}
|
|
148
|
+
`/sf:revise` — revise spec with clarified requirements
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
</workflow>
|
|
152
|
+
|
|
153
|
+
<fallback>
|
|
154
|
+
|
|
155
|
+
**If agent spawning fails**, conduct discussion inline:
|
|
156
|
+
|
|
157
|
+
1. Read spec or topic context
|
|
158
|
+
2. Identify 3-5 key ambiguities or decisions needed
|
|
159
|
+
3. Use AskUserQuestion for each:
|
|
160
|
+
- Provide clear options (2-4 choices)
|
|
161
|
+
- Include "Other" for custom input
|
|
162
|
+
4. Document all decisions
|
|
163
|
+
5. Save to discussion file
|
|
164
|
+
|
|
165
|
+
</fallback>
|
|
166
|
+
|
|
167
|
+
<success_criteria>
|
|
168
|
+
- [ ] Discussion mode determined correctly
|
|
169
|
+
- [ ] Relevant context loaded (spec, audit, project)
|
|
170
|
+
- [ ] Focused questions asked with clear options
|
|
171
|
+
- [ ] Decisions documented
|
|
172
|
+
- [ ] Discussion file saved
|
|
173
|
+
- [ ] User knows next step
|
|
174
|
+
</success_criteria>
|
package/commands/sf/help.md
CHANGED
|
@@ -93,10 +93,33 @@ Read the command file and extract:
|
|
|
93
93
|
/sf:new "Add user authentication with JWT"
|
|
94
94
|
/sf:new "Fix pagination bug in user list"
|
|
95
95
|
/sf:new "Refactor UserService to use repository pattern"
|
|
96
|
+
/sf:new --research RES-001 "Add OAuth login"
|
|
96
97
|
/sf:new # Interactive mode
|
|
97
98
|
```
|
|
98
99
|
```
|
|
99
100
|
|
|
101
|
+
**For `/sf:research`:**
|
|
102
|
+
```
|
|
103
|
+
## Examples
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
/sf:research "OAuth vs JWT for authentication"
|
|
107
|
+
/sf:research "state management options for React"
|
|
108
|
+
/sf:research "database migration strategies"
|
|
109
|
+
```
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**For `/sf:discuss`:**
|
|
113
|
+
```
|
|
114
|
+
## Examples
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
/sf:discuss "auth requirements" # Before creating spec
|
|
118
|
+
/sf:discuss SPEC-001 # Clarify existing spec
|
|
119
|
+
/sf:discuss # Discuss active spec
|
|
120
|
+
```
|
|
121
|
+
```
|
|
122
|
+
|
|
100
123
|
**For `/sf:audit`:**
|
|
101
124
|
```
|
|
102
125
|
## Examples
|
|
@@ -212,6 +235,14 @@ Workflow: Spec → Audit → Revise → Run → Review → Fix → Done
|
|
|
212
235
|
| /sf:pause | Save session context for later |
|
|
213
236
|
| /sf:resume | Restore previous session context |
|
|
214
237
|
|
|
238
|
+
## Research & Clarification
|
|
239
|
+
|
|
240
|
+
| Command | Description |
|
|
241
|
+
|--------------|-----------------------------------------|
|
|
242
|
+
| /sf:research | Research topic for spec context |
|
|
243
|
+
| /sf:discuss | Clarify requirements interactively |
|
|
244
|
+
| /sf:scan | Deep codebase analysis |
|
|
245
|
+
|
|
215
246
|
## Utilities
|
|
216
247
|
|
|
217
248
|
| Command | Description |
|
|
@@ -225,11 +256,12 @@ Workflow: Spec → Audit → Revise → Run → Review → Fix → Done
|
|
|
225
256
|
## Quick Start
|
|
226
257
|
|
|
227
258
|
1. `/sf:init` — Initialize project (once)
|
|
228
|
-
2. `/sf:
|
|
229
|
-
3. `/sf:
|
|
230
|
-
4. `/sf:
|
|
231
|
-
5. `/sf:
|
|
232
|
-
6. `/sf:
|
|
259
|
+
2. `/sf:research "topic"` — Research before spec (optional)
|
|
260
|
+
3. `/sf:new "task"` — Create specification
|
|
261
|
+
4. `/sf:audit` — Audit the spec
|
|
262
|
+
5. `/sf:run` — Implement
|
|
263
|
+
6. `/sf:review` — Review implementation
|
|
264
|
+
7. `/sf:done` — Complete and archive
|
|
233
265
|
|
|
234
266
|
## Typical Session
|
|
235
267
|
|
package/commands/sf/init.md
CHANGED
|
@@ -80,7 +80,7 @@ ls tsconfig.json 2>/dev/null
|
|
|
80
80
|
## Step 5: Create .specflow Directory
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
|
-
mkdir -p .specflow/specs .specflow/audits .specflow/archive .specflow/todos
|
|
83
|
+
mkdir -p .specflow/specs .specflow/audits .specflow/archive .specflow/todos .specflow/research .specflow/discussions
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
## Step 6: Generate PROJECT.md
|
|
@@ -190,11 +190,15 @@ Create `.specflow/config.json`:
|
|
|
190
190
|
| `.specflow/PROJECT.md` | Project overview |
|
|
191
191
|
| `.specflow/STATE.md` | Current state |
|
|
192
192
|
| `.specflow/config.json` | Configuration |
|
|
193
|
+
| `.specflow/research/` | Research documents |
|
|
193
194
|
|
|
194
195
|
## Next Step
|
|
195
196
|
|
|
196
197
|
`/sf:new "your task description"` — create first specification
|
|
197
198
|
|
|
199
|
+
Or research first:
|
|
200
|
+
`/sf:research "topic"` — research before creating spec
|
|
201
|
+
|
|
198
202
|
---
|
|
199
203
|
|
|
200
204
|
**Tip:** Review `.specflow/PROJECT.md` and fill in:
|
|
@@ -210,6 +214,8 @@ Create `.specflow/config.json`:
|
|
|
210
214
|
- [ ] .specflow/specs/ subdirectory created
|
|
211
215
|
- [ ] .specflow/audits/ subdirectory created
|
|
212
216
|
- [ ] .specflow/archive/ subdirectory created
|
|
217
|
+
- [ ] .specflow/research/ subdirectory created
|
|
218
|
+
- [ ] .specflow/discussions/ subdirectory created
|
|
213
219
|
- [ ] PROJECT.md created with detected stack
|
|
214
220
|
- [ ] STATE.md created with initial state
|
|
215
221
|
- [ ] config.json created with defaults
|
package/commands/sf/new.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sf:new
|
|
3
3
|
description: Create a new specification from task description
|
|
4
|
+
argument-hint: "[--research RES-XXX] <task description>"
|
|
4
5
|
allowed-tools:
|
|
5
6
|
- Read
|
|
6
7
|
- Write
|
|
@@ -40,7 +41,16 @@ Exit.
|
|
|
40
41
|
|
|
41
42
|
## Step 2: Parse Arguments
|
|
42
43
|
|
|
43
|
-
Extract
|
|
44
|
+
Extract from command arguments:
|
|
45
|
+
- `--research RES-XXX` — optional research document to include as context
|
|
46
|
+
- Task description — what to build
|
|
47
|
+
|
|
48
|
+
**If --research provided:**
|
|
49
|
+
```bash
|
|
50
|
+
[ -f .specflow/research/RES-XXX.md ] && echo "FOUND" || echo "NOT_FOUND"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
If NOT_FOUND, warn user and continue without research context.
|
|
44
54
|
|
|
45
55
|
**If no description provided:**
|
|
46
56
|
Use AskUserQuestion:
|
|
@@ -66,7 +76,13 @@ Task(prompt="
|
|
|
66
76
|
@.specflow/STATE.md
|
|
67
77
|
</current_state>
|
|
68
78
|
|
|
79
|
+
{If --research provided:}
|
|
80
|
+
<research_context>
|
|
81
|
+
@.specflow/research/RES-XXX.md
|
|
82
|
+
</research_context>
|
|
83
|
+
|
|
69
84
|
Create a specification following the spec-creator agent instructions.
|
|
85
|
+
{If research provided, add: "Use the research findings to inform the specification."}
|
|
70
86
|
", subagent_type="sf-spec-creator", description="Create specification")
|
|
71
87
|
```
|
|
72
88
|
|
|
@@ -106,6 +122,8 @@ The agent will:
|
|
|
106
122
|
|
|
107
123
|
<sub>/clear recommended → auditor needs fresh context</sub>
|
|
108
124
|
|
|
125
|
+
<sub>Optional: `/sf:discuss SPEC-XXX` — clarify assumptions before audit</sub>
|
|
126
|
+
|
|
109
127
|
{If complexity is large:}
|
|
110
128
|
|
|
111
129
|
### Warning
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sf:research
|
|
3
|
+
description: Research a topic and save findings for future specification context
|
|
4
|
+
argument-hint: "[topic]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
Research a topic, technology, or implementation approach. Saves structured findings to `.specflow/research/RES-XXX.md` for use as context when creating specifications.
|
|
9
|
+
</purpose>
|
|
10
|
+
|
|
11
|
+
<context>
|
|
12
|
+
@.specflow/PROJECT.md
|
|
13
|
+
@.specflow/STATE.md
|
|
14
|
+
@~/.claude/specflow-cc/templates/research.md
|
|
15
|
+
@~/.claude/specflow-cc/agents/researcher.md
|
|
16
|
+
</context>
|
|
17
|
+
|
|
18
|
+
<workflow>
|
|
19
|
+
|
|
20
|
+
## 1. Verify Initialization
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
[ -d .specflow ] && echo "OK" || echo "NOT_INITIALIZED"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**If NOT_INITIALIZED:**
|
|
27
|
+
```
|
|
28
|
+
SpecFlow not initialized.
|
|
29
|
+
|
|
30
|
+
Run `/sf:init` first.
|
|
31
|
+
```
|
|
32
|
+
Exit.
|
|
33
|
+
|
|
34
|
+
## 2. Ensure Research Directory
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
mkdir -p .specflow/research
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 3. Parse Arguments
|
|
41
|
+
|
|
42
|
+
Extract research topic from command arguments.
|
|
43
|
+
|
|
44
|
+
**If no topic provided:**
|
|
45
|
+
Use AskUserQuestion:
|
|
46
|
+
- header: "Topic"
|
|
47
|
+
- question: "What do you want to research?"
|
|
48
|
+
- options: (freeform text input)
|
|
49
|
+
|
|
50
|
+
## 4. Spawn Researcher Agent
|
|
51
|
+
|
|
52
|
+
Launch the researcher subagent:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
Task(prompt="
|
|
56
|
+
<research_topic>
|
|
57
|
+
{user's topic}
|
|
58
|
+
</research_topic>
|
|
59
|
+
|
|
60
|
+
<project_context>
|
|
61
|
+
@.specflow/PROJECT.md
|
|
62
|
+
</project_context>
|
|
63
|
+
|
|
64
|
+
Research this topic and create a structured findings document.
|
|
65
|
+
", subagent_type="sf-researcher", description="Research topic")
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## 5. Handle Agent Response
|
|
69
|
+
|
|
70
|
+
The agent will:
|
|
71
|
+
1. Research the topic (codebase exploration, web search if needed)
|
|
72
|
+
2. Create RES-XXX.md with findings
|
|
73
|
+
3. Return structured result with ID and summary
|
|
74
|
+
|
|
75
|
+
## 6. Display Result
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
79
|
+
RESEARCH COMPLETE
|
|
80
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
81
|
+
|
|
82
|
+
**ID:** RES-XXX
|
|
83
|
+
**Topic:** [topic]
|
|
84
|
+
**Created:** [date]
|
|
85
|
+
|
|
86
|
+
### Summary
|
|
87
|
+
|
|
88
|
+
[Brief 2-3 sentence summary of findings]
|
|
89
|
+
|
|
90
|
+
### Key Findings
|
|
91
|
+
|
|
92
|
+
- [Finding 1]
|
|
93
|
+
- [Finding 2]
|
|
94
|
+
- [Finding 3]
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
📄 **File:** `.specflow/research/RES-XXX.md`
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Use in Specification
|
|
103
|
+
|
|
104
|
+
To use this research when creating a specification:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
/sf:new --research RES-XXX "your task description"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Or reference directly:
|
|
111
|
+
```
|
|
112
|
+
/sf:new "implement OAuth (see RES-XXX)"
|
|
113
|
+
```
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
</workflow>
|
|
117
|
+
|
|
118
|
+
<fallback>
|
|
119
|
+
|
|
120
|
+
**If agent spawning fails**, execute inline:
|
|
121
|
+
|
|
122
|
+
## Inline Research
|
|
123
|
+
|
|
124
|
+
### Get Next Research Number
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
LAST=$(ls .specflow/research/RES-*.md 2>/dev/null | sort -V | tail -1 | grep -oP 'RES-\K\d+')
|
|
128
|
+
NEXT=$(printf "%03d" $((${LAST:-0} + 1)))
|
|
129
|
+
echo "RES-$NEXT"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Research Topic
|
|
133
|
+
|
|
134
|
+
1. Search codebase for related code
|
|
135
|
+
2. Check existing patterns
|
|
136
|
+
3. Use WebSearch for external context if needed
|
|
137
|
+
4. Identify options, trade-offs, and recommendations
|
|
138
|
+
|
|
139
|
+
### Write Research Document
|
|
140
|
+
|
|
141
|
+
Create `.specflow/research/RES-XXX.md` with:
|
|
142
|
+
- Frontmatter (id, topic, created)
|
|
143
|
+
- Summary
|
|
144
|
+
- Background (why this matters)
|
|
145
|
+
- Options explored
|
|
146
|
+
- Trade-offs analysis
|
|
147
|
+
- Codebase findings
|
|
148
|
+
- Recommendations
|
|
149
|
+
- References
|
|
150
|
+
|
|
151
|
+
</fallback>
|
|
152
|
+
|
|
153
|
+
<success_criteria>
|
|
154
|
+
- [ ] SpecFlow initialization verified
|
|
155
|
+
- [ ] Research topic obtained
|
|
156
|
+
- [ ] RES-XXX.md created with structured findings
|
|
157
|
+
- [ ] User knows how to use research in /sf:new
|
|
158
|
+
</success_criteria>
|
package/package.json
CHANGED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: RES-XXX
|
|
3
|
+
topic: [short topic name]
|
|
4
|
+
created: YYYY-MM-DD
|
|
5
|
+
status: complete
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Research: [Topic Title]
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
[2-3 sentence summary of findings and the recommended approach]
|
|
13
|
+
|
|
14
|
+
## Background
|
|
15
|
+
|
|
16
|
+
[Why this research was needed. What problem or decision prompted it.]
|
|
17
|
+
|
|
18
|
+
## Options Explored
|
|
19
|
+
|
|
20
|
+
### Option 1: [Name]
|
|
21
|
+
|
|
22
|
+
**Description:** [What this approach involves]
|
|
23
|
+
|
|
24
|
+
**Pros:**
|
|
25
|
+
- [Pro 1]
|
|
26
|
+
- [Pro 2]
|
|
27
|
+
|
|
28
|
+
**Cons:**
|
|
29
|
+
- [Con 1]
|
|
30
|
+
- [Con 2]
|
|
31
|
+
|
|
32
|
+
### Option 2: [Name]
|
|
33
|
+
|
|
34
|
+
**Description:** [What this approach involves]
|
|
35
|
+
|
|
36
|
+
**Pros:**
|
|
37
|
+
- [Pro 1]
|
|
38
|
+
- [Pro 2]
|
|
39
|
+
|
|
40
|
+
**Cons:**
|
|
41
|
+
- [Con 1]
|
|
42
|
+
- [Con 2]
|
|
43
|
+
|
|
44
|
+
## Codebase Findings
|
|
45
|
+
|
|
46
|
+
[What was discovered in the existing codebase]
|
|
47
|
+
|
|
48
|
+
- `path/to/relevant/file.ts` — [description of relevance]
|
|
49
|
+
- `path/to/pattern/example.ts` — [description of relevance]
|
|
50
|
+
|
|
51
|
+
## Trade-offs Analysis
|
|
52
|
+
|
|
53
|
+
| Aspect | Option 1 | Option 2 |
|
|
54
|
+
|--------|----------|----------|
|
|
55
|
+
| Complexity | | |
|
|
56
|
+
| Flexibility | | |
|
|
57
|
+
| Maintenance | | |
|
|
58
|
+
| Performance | | |
|
|
59
|
+
|
|
60
|
+
## Recommendations
|
|
61
|
+
|
|
62
|
+
**Recommended approach:** [Option name]
|
|
63
|
+
|
|
64
|
+
**Reasoning:**
|
|
65
|
+
- [Reason 1 — why this fits the project]
|
|
66
|
+
- [Reason 2 — why this is better than alternatives]
|
|
67
|
+
|
|
68
|
+
**Implementation notes:**
|
|
69
|
+
- [Practical note for spec creation]
|
|
70
|
+
- [Technical consideration]
|
|
71
|
+
|
|
72
|
+
## References
|
|
73
|
+
|
|
74
|
+
- [Documentation link or internal file reference]
|
|
75
|
+
- [Another reference]
|