plan-flow-skill 1.0.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/.claude/commands/create-contract.md +468 -0
- package/.claude/commands/create-plan.md +512 -0
- package/.claude/commands/discovery-plan.md +561 -0
- package/.claude/commands/execute-plan.md +682 -0
- package/.claude/commands/review-code.md +459 -0
- package/.claude/commands/review-pr.md +651 -0
- package/.claude/commands/setup.md +1609 -0
- package/.claude/commands/write-tests.md +543 -0
- package/.claude/rules/core/allowed-patterns.md +175 -0
- package/.claude/rules/core/complexity-scoring.md +225 -0
- package/.claude/rules/core/forbidden-patterns.md +253 -0
- package/.claude/rules/languages/python-patterns.md +6 -0
- package/.claude/rules/languages/typescript-patterns.md +7 -0
- package/.claude/rules/patterns/contract-patterns.md +332 -0
- package/.claude/rules/patterns/discovery-patterns.md +342 -0
- package/.claude/rules/patterns/discovery-templates.md +319 -0
- package/.claude/rules/patterns/jest-patterns.md +482 -0
- package/.claude/rules/patterns/plans-patterns.md +225 -0
- package/.claude/rules/patterns/plans-templates.md +227 -0
- package/.claude/rules/patterns/pytest-patterns.md +457 -0
- package/.claude/rules/patterns/review-code-templates.md +305 -0
- package/.claude/rules/patterns/review-pr-patterns.md +360 -0
- package/.claude/rules/tools/auth-pr-tool.md +30 -0
- package/.claude/rules/tools/interactive-questions-tool.md +235 -0
- package/.claude/rules/tools/jest-testing-tool.md +73 -0
- package/.claude/rules/tools/plan-mode-tool.md +164 -0
- package/.claude/rules/tools/pytest-testing-tool.md +121 -0
- package/.claude/rules/tools/reference-expansion-tool.md +326 -0
- package/LICENSE +21 -0
- package/README.md +167 -0
- package/dist/cli/commands/init.d.ts +6 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +139 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/handlers/claude.d.ts +9 -0
- package/dist/cli/handlers/claude.d.ts.map +1 -0
- package/dist/cli/handlers/claude.js +119 -0
- package/dist/cli/handlers/claude.js.map +1 -0
- package/dist/cli/handlers/codex.d.ts +9 -0
- package/dist/cli/handlers/codex.d.ts.map +1 -0
- package/dist/cli/handlers/codex.js +100 -0
- package/dist/cli/handlers/codex.js.map +1 -0
- package/dist/cli/handlers/cursor.d.ts +8 -0
- package/dist/cli/handlers/cursor.d.ts.map +1 -0
- package/dist/cli/handlers/cursor.js +34 -0
- package/dist/cli/handlers/cursor.js.map +1 -0
- package/dist/cli/handlers/openclaw.d.ts +8 -0
- package/dist/cli/handlers/openclaw.d.ts.map +1 -0
- package/dist/cli/handlers/openclaw.js +34 -0
- package/dist/cli/handlers/openclaw.js.map +1 -0
- package/dist/cli/handlers/shared.d.ts +9 -0
- package/dist/cli/handlers/shared.d.ts.map +1 -0
- package/dist/cli/handlers/shared.js +44 -0
- package/dist/cli/handlers/shared.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +43 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/types.d.ts +26 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +5 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/utils/files.d.ts +37 -0
- package/dist/cli/utils/files.d.ts.map +1 -0
- package/dist/cli/utils/files.js +122 -0
- package/dist/cli/utils/files.js.map +1 -0
- package/dist/cli/utils/logger.d.ts +11 -0
- package/dist/cli/utils/logger.d.ts.map +1 -0
- package/dist/cli/utils/logger.js +34 -0
- package/dist/cli/utils/logger.js.map +1 -0
- package/dist/cli/utils/prompts.d.ts +10 -0
- package/dist/cli/utils/prompts.d.ts.map +1 -0
- package/dist/cli/utils/prompts.js +65 -0
- package/dist/cli/utils/prompts.js.map +1 -0
- package/dist/test/setup.d.ts +5 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/test/setup.js +7 -0
- package/dist/test/setup.js.map +1 -0
- package/package.json +63 -0
- package/rules/core/_index.mdc +89 -0
- package/rules/core/allowed-patterns.mdc +185 -0
- package/rules/core/complexity-scoring.mdc +235 -0
- package/rules/core/forbidden-patterns.mdc +263 -0
- package/rules/languages/_index.mdc +80 -0
- package/rules/languages/python-patterns.mdc +188 -0
- package/rules/languages/typescript-patterns.mdc +128 -0
- package/rules/patterns/_index.mdc +185 -0
- package/rules/patterns/contract-patterns.mdc +344 -0
- package/rules/patterns/discovery-patterns.mdc +354 -0
- package/rules/patterns/discovery-templates.mdc +329 -0
- package/rules/patterns/jest-patterns.mdc +492 -0
- package/rules/patterns/plans-patterns.mdc +237 -0
- package/rules/patterns/plans-templates.mdc +237 -0
- package/rules/patterns/pytest-patterns.mdc +467 -0
- package/rules/patterns/review-code-templates.mdc +315 -0
- package/rules/patterns/review-pr-patterns.mdc +370 -0
- package/rules/skills/_index.mdc +174 -0
- package/rules/skills/create-contract-skill.mdc +239 -0
- package/rules/skills/create-plan-skill.mdc +271 -0
- package/rules/skills/discovery-skill.mdc +295 -0
- package/rules/skills/execute-plan-skill.mdc +388 -0
- package/rules/skills/review-code-skill.mdc +308 -0
- package/rules/skills/review-pr-skill.mdc +496 -0
- package/rules/skills/setup-skill.mdc +923 -0
- package/rules/skills/write-tests-skill.mdc +294 -0
- package/rules/templates/index-template.mdc +126 -0
- package/rules/tools/_index.mdc +114 -0
- package/rules/tools/auth-pr-tool.mdc +362 -0
- package/rules/tools/interactive-questions-tool.mdc +337 -0
- package/rules/tools/jest-testing-tool.mdc +96 -0
- package/rules/tools/plan-mode-tool.mdc +229 -0
- package/rules/tools/pytest-testing-tool.mdc +144 -0
- package/rules/tools/reference-expansion-tool.mdc +338 -0
- package/skills/plan-flow/SKILL.md +109 -0
- package/skills/plan-flow/create-contract/SKILL.md +139 -0
- package/skills/plan-flow/create-plan/SKILL.md +93 -0
- package/skills/plan-flow/discovery/SKILL.md +85 -0
- package/skills/plan-flow/execute-plan/SKILL.md +89 -0
- package/skills/plan-flow/review-code/SKILL.md +100 -0
- package/skills/plan-flow/review-pr/SKILL.md +122 -0
- package/skills/plan-flow/setup/SKILL.md +73 -0
- package/skills/plan-flow/write-tests/SKILL.md +115 -0
- package/templates/shared/AGENTS.md.template +60 -0
- package/templates/shared/CLAUDE.md.template +62 -0
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: This command creates a discovery document for gathering and clarifying requirements before creating
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Create Discovery Document
|
|
6
|
+
|
|
7
|
+
## Command Description
|
|
8
|
+
|
|
9
|
+
This command creates a discovery document for gathering and clarifying requirements before creating an implementation plan. The command validates inputs and orchestrates the discovery process by invoking the `discovery` skill.
|
|
10
|
+
|
|
11
|
+
**Output**: A markdown file at `flow/discovery/discovery_<feature_name>_v<version>.md`
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Help
|
|
17
|
+
|
|
18
|
+
**If the user invokes this command with `-help`, display only this section and stop:**
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
/discovery-plan - Create Discovery Document
|
|
22
|
+
|
|
23
|
+
DESCRIPTION:
|
|
24
|
+
Creates a discovery document for gathering and clarifying requirements
|
|
25
|
+
before creating an implementation plan. This is the recommended first step.
|
|
26
|
+
|
|
27
|
+
USAGE:
|
|
28
|
+
/discovery-plan <reference_document>
|
|
29
|
+
/discovery-plan <feature_description>
|
|
30
|
+
/discovery-plan -help
|
|
31
|
+
|
|
32
|
+
ARGUMENTS:
|
|
33
|
+
reference_document Contract, spec, or any document to analyze
|
|
34
|
+
feature_description Description of what you want to build
|
|
35
|
+
|
|
36
|
+
EXAMPLES:
|
|
37
|
+
/discovery-plan @flow/contracts/api_contract.md
|
|
38
|
+
/discovery-plan "User authentication with OAuth2"
|
|
39
|
+
/discovery-plan @docs/feature-spec.md "Focus on the payment flow"
|
|
40
|
+
|
|
41
|
+
OUTPUT:
|
|
42
|
+
Creates: flow/discovery/discovery_<feature_name>_v<version>.md
|
|
43
|
+
|
|
44
|
+
WORKFLOW:
|
|
45
|
+
1. Reads all referenced documents
|
|
46
|
+
2. Asks clarifying questions (via Plan mode Questions UI)
|
|
47
|
+
3. Documents requirements (FR, NFR, Constraints)
|
|
48
|
+
4. Proposes high-level approach (no code)
|
|
49
|
+
5. Creates discovery document for review
|
|
50
|
+
6. User reviews and refines before /create-plan
|
|
51
|
+
|
|
52
|
+
RECOMMENDED MODEL:
|
|
53
|
+
Claude Opus 4.5 or Sonnet 4.5 for best results
|
|
54
|
+
|
|
55
|
+
RELATED COMMANDS:
|
|
56
|
+
/create-contract Create contract from API docs first
|
|
57
|
+
/create-plan Create plan from discovery document
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Critical Rules
|
|
63
|
+
|
|
64
|
+
These rules are mandatory. For detailed patterns and guidelines, see `.claude/rules/patterns/discovery-patterns.md`.
|
|
65
|
+
|
|
66
|
+
| Rule | Description |
|
|
67
|
+
| ------------------------ | -------------------------------------------------------- |
|
|
68
|
+
| **No Code** | NEVER write, edit, or generate code during discovery |
|
|
69
|
+
| **Only Markdown Output** | The ONLY deliverable is the discovery markdown file |
|
|
70
|
+
| **Ask Questions** | When in doubt, ask - don't assume |
|
|
71
|
+
| **Read First** | Read all referenced documents before asking questions |
|
|
72
|
+
| **High-Level Only** | Technical considerations are conceptual, not code |
|
|
73
|
+
| **Allow Refinement** | User reviews and refines discovery before plan creation |
|
|
74
|
+
| **No Auto-Chaining** | NEVER auto-invoke /create-plan - user must invoke it |
|
|
75
|
+
| **Complete and Stop** | After presenting results, STOP and wait for user |
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Instructions
|
|
80
|
+
|
|
81
|
+
### Step 1: Validate Inputs
|
|
82
|
+
|
|
83
|
+
| Input | Required | Description |
|
|
84
|
+
| -------------------- | -------- | --------------------------------------------------- |
|
|
85
|
+
| `reference_document` | Optional | Contract, spec, or any document to analyze |
|
|
86
|
+
| `feature_description`| Optional | Description of what to build (if no doc provided) |
|
|
87
|
+
|
|
88
|
+
**At least one must be provided.** If neither is clear, ask:
|
|
89
|
+
|
|
90
|
+
```markdown
|
|
91
|
+
To start the discovery process, I need to understand:
|
|
92
|
+
|
|
93
|
+
1. **What feature or topic are we exploring?**
|
|
94
|
+
2. **What triggered this need?** (new requirement, bug, enhancement)
|
|
95
|
+
3. **Are there any documents I should review?** (API contracts, specs, designs)
|
|
96
|
+
4. **What do you already know about the requirements?**
|
|
97
|
+
5. **Are there any constraints I should be aware of?**
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### Step 2: Extract Feature Name
|
|
103
|
+
|
|
104
|
+
From the user input, extract or derive a feature name for the discovery document.
|
|
105
|
+
|
|
106
|
+
**Examples**:
|
|
107
|
+
- `@flow/contracts/api_contract.md` → `api_integration`
|
|
108
|
+
- `"User authentication with OAuth2"` → `user_authentication`
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### Step 3: Check for Existing Discovery
|
|
113
|
+
|
|
114
|
+
Check `flow/discovery/` for existing discovery documents for this feature:
|
|
115
|
+
|
|
116
|
+
1. If found, ask if user wants to create a new version or continue existing
|
|
117
|
+
2. Increment version number if creating new version
|
|
118
|
+
|
|
119
|
+
**Important**: NEVER read or reference files in `flow/archive/` - these are outdated documents.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### Step 4: Invoke Discovery Skill
|
|
124
|
+
|
|
125
|
+
The skill will:
|
|
126
|
+
|
|
127
|
+
1. Read all referenced documents
|
|
128
|
+
2. Ask clarifying questions via Interactive Questions Tool
|
|
129
|
+
3. Track question status
|
|
130
|
+
4. Document requirements (FR, NFR, Constraints)
|
|
131
|
+
5. Identify technical considerations
|
|
132
|
+
6. Propose high-level approach
|
|
133
|
+
7. Document risks and unknowns
|
|
134
|
+
8. Generate discovery document
|
|
135
|
+
|
|
136
|
+
See: `.claude/rules/skills/discovery-skill.md`
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### Step 5: Present Results
|
|
141
|
+
|
|
142
|
+
After the skill completes, present the discovery document to the user:
|
|
143
|
+
|
|
144
|
+
```markdown
|
|
145
|
+
Discovery Complete!
|
|
146
|
+
|
|
147
|
+
**Summary**:
|
|
148
|
+
- X functional requirements gathered
|
|
149
|
+
- X non-functional requirements identified
|
|
150
|
+
- X risks documented
|
|
151
|
+
- X questions resolved
|
|
152
|
+
|
|
153
|
+
**Deliverable Created**: `flow/discovery/discovery_<feature>_v1.md`
|
|
154
|
+
|
|
155
|
+
**Next Steps** (user must invoke manually):
|
|
156
|
+
1. Review the discovery document above
|
|
157
|
+
2. Request any refinements or additions
|
|
158
|
+
3. When ready, invoke `/create-plan @flow/discovery/discovery_<feature>_v1.md`
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**CRITICAL**: This command is now complete. Do NOT auto-invoke `/create-plan`. Wait for the user to explicitly invoke it.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Flow Diagram
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
+------------------------------------------+
|
|
169
|
+
| /discovery-plan COMMAND |
|
|
170
|
+
+------------------------------------------+
|
|
171
|
+
|
|
|
172
|
+
v
|
|
173
|
+
+------------------------------------------+
|
|
174
|
+
| Step 1: Validate Inputs |
|
|
175
|
+
| - Check for reference doc or description |
|
|
176
|
+
| - Ask clarifying questions if needed |
|
|
177
|
+
+------------------------------------------+
|
|
178
|
+
|
|
|
179
|
+
v
|
|
180
|
+
+------------------------------------------+
|
|
181
|
+
| Step 2-3: Extract Feature & Check Exists |
|
|
182
|
+
| - Derive feature name |
|
|
183
|
+
| - Check for existing discovery docs |
|
|
184
|
+
+------------------------------------------+
|
|
185
|
+
|
|
|
186
|
+
v
|
|
187
|
+
+------------------------------------------+
|
|
188
|
+
| Step 4: Invoke Discovery Skill |
|
|
189
|
+
| - Skill handles all gathering logic |
|
|
190
|
+
| - See discovery-skill.md |
|
|
191
|
+
+------------------------------------------+
|
|
192
|
+
|
|
|
193
|
+
v
|
|
194
|
+
+------------------------------------------+
|
|
195
|
+
| Step 5: Present Results |
|
|
196
|
+
| - Show summary to user |
|
|
197
|
+
| - Allow refinement |
|
|
198
|
+
| - Link to /create-plan command |
|
|
199
|
+
+------------------------------------------+
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Example Usage
|
|
205
|
+
|
|
206
|
+
**User**: `/discovery-plan @flow/contracts/api-contract.md`
|
|
207
|
+
|
|
208
|
+
**Execution**:
|
|
209
|
+
|
|
210
|
+
1. Validate input: reference document provided
|
|
211
|
+
2. Extract feature name: `api_integration`
|
|
212
|
+
3. Check `flow/discovery/` for existing versions
|
|
213
|
+
4. Invoke discovery skill
|
|
214
|
+
5. Present discovery document and summary
|
|
215
|
+
6. User reviews and requests refinements (if any)
|
|
216
|
+
7. User invokes `/create-plan` when ready
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Context Optimization
|
|
221
|
+
|
|
222
|
+
This command uses hierarchical context loading to reduce context consumption. Instead of loading full files, load indexes first and expand specific sections on-demand.
|
|
223
|
+
|
|
224
|
+
### Recommended Loading Order
|
|
225
|
+
|
|
226
|
+
1. **Always load first**: This command file (`commands/discovery-plan.md`)
|
|
227
|
+
2. **Load indexes**: Load `_index.md` files for relevant folders
|
|
228
|
+
3. **Expand on-demand**: Use reference codes to load specific sections when needed
|
|
229
|
+
|
|
230
|
+
### Index Files for Discovery
|
|
231
|
+
|
|
232
|
+
| Index | When to Load |
|
|
233
|
+
|-------|--------------|
|
|
234
|
+
| `rules/patterns/_index.md` | To find discovery templates and patterns |
|
|
235
|
+
| `rules/skills/_index.md` | To understand skill workflow |
|
|
236
|
+
| `rules/tools/_index.md` | When using interactive questions |
|
|
237
|
+
|
|
238
|
+
### Reference Codes for Discovery
|
|
239
|
+
|
|
240
|
+
| Code | Description | When to Expand |
|
|
241
|
+
|------|-------------|----------------|
|
|
242
|
+
| PTN-DIS-1 | Discovery document structure | Creating new discovery doc |
|
|
243
|
+
| PTN-DIS-2 | Requirements gathering example | Need example format |
|
|
244
|
+
| PTN-DIST-1 | Discovery template | Creating output file |
|
|
245
|
+
| SKL-DIS-1 | Discovery skill workflow | Understanding full process |
|
|
246
|
+
| TLS-IQ-2 | How to switch to Plan mode | Before asking questions |
|
|
247
|
+
| TLS-IQ-3 | How to ask questions | When gathering requirements |
|
|
248
|
+
|
|
249
|
+
### Expansion Instructions
|
|
250
|
+
|
|
251
|
+
When executing this command:
|
|
252
|
+
|
|
253
|
+
1. **Start with indexes**: Read `rules/patterns/_index.md` and `rules/skills/_index.md`
|
|
254
|
+
2. **Identify needed codes**: Based on current step, identify which codes are relevant
|
|
255
|
+
3. **Expand as needed**: Use the Read tool with specific line ranges from the index
|
|
256
|
+
4. **Don't expand everything**: Only load content required for the current step
|
|
257
|
+
|
|
258
|
+
**Example expansion**:
|
|
259
|
+
```
|
|
260
|
+
# To get the discovery template
|
|
261
|
+
Read: rules/patterns/discovery-templates.md (lines from PTN-DIST-1)
|
|
262
|
+
|
|
263
|
+
# To understand question workflow
|
|
264
|
+
Read: rules/tools/interactive-questions-tool.md (lines from TLS-IQ-3)
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Related Resources
|
|
270
|
+
|
|
271
|
+
| Resource | Purpose |
|
|
272
|
+
| ------------------------------ | -------------------------------------- |
|
|
273
|
+
| `rules/skills/_index.md` | Index of skills with reference codes |
|
|
274
|
+
| `rules/patterns/_index.md` | Index of patterns with reference codes |
|
|
275
|
+
| `rules/tools/_index.md` | Index of tools with reference codes |
|
|
276
|
+
| `discovery-skill.md` | Skill that executes the discovery |
|
|
277
|
+
| `discovery-patterns.md` | Rules and patterns for discovery |
|
|
278
|
+
| `discovery-templates.md` | Document templates |
|
|
279
|
+
| `interactive-questions-tool.md` | Interactive Questions UI workflow |
|
|
280
|
+
| `/create-plan` command | Creates plan from discovery document |
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
# Implementation Details
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
## Restrictions - DISCOVERY ONLY
|
|
288
|
+
|
|
289
|
+
This skill is **strictly for gathering and documenting requirements**. The process:
|
|
290
|
+
|
|
291
|
+
1. **Reads** all referenced documents and contracts
|
|
292
|
+
2. **Asks** clarifying questions via Interactive Questions Tool
|
|
293
|
+
3. **Documents** requirements (FR, NFR, Constraints)
|
|
294
|
+
4. **Identifies** technical considerations (high-level only)
|
|
295
|
+
5. **Proposes** approach (conceptual, no code)
|
|
296
|
+
6. **Generates** a discovery markdown file
|
|
297
|
+
|
|
298
|
+
**No code, no implementation, no source file modifications.**
|
|
299
|
+
|
|
300
|
+
### NEVER Do These Actions
|
|
301
|
+
|
|
302
|
+
| Forbidden Action | Reason |
|
|
303
|
+
| -------------------------------------- | ----------------------------------------- |
|
|
304
|
+
| Create/edit source code files | Discovery is requirements gathering only |
|
|
305
|
+
| Write implementation code in responses | No code during discovery |
|
|
306
|
+
| Create implementation plans | Plans come after discovery |
|
|
307
|
+
| Modify configuration files | No codebase changes |
|
|
308
|
+
| Run build or test commands | No execution commands |
|
|
309
|
+
| Create files outside `flow/discovery/` | Only write discovery documents |
|
|
310
|
+
|
|
311
|
+
### Allowed Actions
|
|
312
|
+
|
|
313
|
+
| Allowed Action | Purpose |
|
|
314
|
+
| -------------------------------------- | ------------------------------------ |
|
|
315
|
+
| Read any project file | Understand existing implementation |
|
|
316
|
+
| Read referenced documents | Extract requirements and constraints |
|
|
317
|
+
| Search codebase (grep, glob, semantic) | Find existing patterns |
|
|
318
|
+
| Use Interactive Questions Tool | Gather requirements from user |
|
|
319
|
+
| Write to `flow/discovery/` | Save discovery document |
|
|
320
|
+
| Read project rule files | Understand patterns to follow |
|
|
321
|
+
|
|
322
|
+
> **Important**: The ONLY writable location is `flow/discovery/`. No source code, configuration files, or any other project files should be modified.
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Inputs
|
|
327
|
+
|
|
328
|
+
| Input | Required | Description |
|
|
329
|
+
| -------------------- | -------- | ----------------------------------------------------- |
|
|
330
|
+
| `feature_name` | Yes | Name of the feature or topic to explore |
|
|
331
|
+
| `context` | Optional | Why this discovery is needed |
|
|
332
|
+
| `referenced_docs` | Optional | List of documents to review (@mentions, file paths) |
|
|
333
|
+
| `known_requirements` | Optional | Any requirements already known |
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## Workflow
|
|
338
|
+
|
|
339
|
+
### Step 1: Read All Referenced Documents
|
|
340
|
+
|
|
341
|
+
**BEFORE asking detailed questions**, read every referenced document.
|
|
342
|
+
|
|
343
|
+
**Actions**:
|
|
344
|
+
|
|
345
|
+
1. Identify references (look for @mentions, file paths, URLs)
|
|
346
|
+
2. Read each file using the Read tool
|
|
347
|
+
3. Extract key information (requirements, constraints, contracts)
|
|
348
|
+
4. Summarize findings for each source
|
|
349
|
+
|
|
350
|
+
**Document Analysis Format**:
|
|
351
|
+
|
|
352
|
+
```markdown
|
|
353
|
+
## Referenced Documents Analysis
|
|
354
|
+
|
|
355
|
+
### `flow/contracts/api-contract.md`
|
|
356
|
+
|
|
357
|
+
**Key Findings**:
|
|
358
|
+
- [Key point 1]
|
|
359
|
+
- [Key point 2]
|
|
360
|
+
|
|
361
|
+
**Questions Raised**:
|
|
362
|
+
- [Gap or unclear aspect]
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
**Important**: NEVER read or reference files in `flow/archive/` - these are outdated documents.
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
### Step 2: Ask Clarifying Questions
|
|
370
|
+
|
|
371
|
+
Ask questions about gaps identified in documents and unclear requirements.
|
|
372
|
+
|
|
373
|
+
**Question Categories**:
|
|
374
|
+
|
|
375
|
+
| Category | Focus |
|
|
376
|
+
| ---------- | ---------------------------------- |
|
|
377
|
+
| Functional | What the feature must do |
|
|
378
|
+
| NFR | Performance, security, scalability |
|
|
379
|
+
| Technical | Architecture, dependencies |
|
|
380
|
+
| UI/UX | User interface and experience |
|
|
381
|
+
|
|
382
|
+
**Use Interactive Questions Tool**:
|
|
383
|
+
|
|
384
|
+
Follow `.claude/rules/tools/interactive-questions-tool.md`:
|
|
385
|
+
|
|
386
|
+
1. Call `SwitchMode` tool to enter Plan mode
|
|
387
|
+
2. Call `Ask the user directly in conversation` tool for each question (2-6 options, A/B/C/D format)
|
|
388
|
+
3. Wait for responses
|
|
389
|
+
4. Call `SwitchMode` tool to return to Agent mode
|
|
390
|
+
|
|
391
|
+
**Skip Interactive Questions If**:
|
|
392
|
+
|
|
393
|
+
- All questions answered in chat already
|
|
394
|
+
- User confirmed all assumptions
|
|
395
|
+
- No blocked or open questions remain
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
### Step 3: Track Question Status
|
|
400
|
+
|
|
401
|
+
Maintain a question tracking table:
|
|
402
|
+
|
|
403
|
+
```markdown
|
|
404
|
+
## Open Questions
|
|
405
|
+
|
|
406
|
+
| # | Category | Question | Status | Answer |
|
|
407
|
+
| --- | ---------- | -------------------------- | -------- | ----------------- |
|
|
408
|
+
| 1 | Functional | Max steps per workflow? | Answered | 20 steps maximum |
|
|
409
|
+
| 2 | Technical | Use existing store or new? | Open | - |
|
|
410
|
+
| 3 | NFR | Required response time? | Assumed | <500ms (validate) |
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
**Status Legend**:
|
|
414
|
+
|
|
415
|
+
- **Open**: Awaiting answer
|
|
416
|
+
- **Answered**: Response received
|
|
417
|
+
- **Assumed**: Made assumption (needs validation)
|
|
418
|
+
- **Blocked**: Cannot proceed without answer
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
### Step 4: Document Requirements
|
|
423
|
+
|
|
424
|
+
Categorize requirements as they are gathered:
|
|
425
|
+
|
|
426
|
+
```markdown
|
|
427
|
+
## Requirements Gathered
|
|
428
|
+
|
|
429
|
+
### Functional Requirements
|
|
430
|
+
- [FR-1]: [Description] (Source: [document or user])
|
|
431
|
+
|
|
432
|
+
### Non-Functional Requirements
|
|
433
|
+
- [NFR-1]: [Description]
|
|
434
|
+
|
|
435
|
+
### Constraints
|
|
436
|
+
- [C-1]: [Description]
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
### Step 5: Identify Technical Considerations
|
|
442
|
+
|
|
443
|
+
Document high-level technical insights (NO implementation code):
|
|
444
|
+
|
|
445
|
+
```markdown
|
|
446
|
+
## Technical Considerations
|
|
447
|
+
|
|
448
|
+
### Architecture Fit
|
|
449
|
+
- [How this fits into existing system]
|
|
450
|
+
|
|
451
|
+
### Dependencies
|
|
452
|
+
- [What this relies on]
|
|
453
|
+
|
|
454
|
+
### Patterns to Apply
|
|
455
|
+
- [Relevant patterns from cursor rules]
|
|
456
|
+
|
|
457
|
+
### Challenges Identified
|
|
458
|
+
- [Potential difficulties]
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
### Step 6: Propose High-Level Approach
|
|
464
|
+
|
|
465
|
+
Suggest an approach based on findings (NO implementation code):
|
|
466
|
+
|
|
467
|
+
```markdown
|
|
468
|
+
## Proposed Approach
|
|
469
|
+
|
|
470
|
+
Based on the requirements gathered, I recommend:
|
|
471
|
+
|
|
472
|
+
1. [High-level approach point 1]
|
|
473
|
+
2. [High-level approach point 2]
|
|
474
|
+
|
|
475
|
+
### Alternative Approaches Considered
|
|
476
|
+
|
|
477
|
+
| Approach | Pros | Cons | Recommendation |
|
|
478
|
+
| -------- | ---- | ---- | -------------- |
|
|
479
|
+
| [A] | ... | ... | Yes/No |
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
### Step 7: Document Risks and Unknowns
|
|
485
|
+
|
|
486
|
+
Capture risks discovered:
|
|
487
|
+
|
|
488
|
+
```markdown
|
|
489
|
+
## Risks and Unknowns
|
|
490
|
+
|
|
491
|
+
### Risks
|
|
492
|
+
|
|
493
|
+
| Risk | Impact | Likelihood | Mitigation |
|
|
494
|
+
| ---- | ------ | ---------- | ---------- |
|
|
495
|
+
| ... | ... | ... | ... |
|
|
496
|
+
|
|
497
|
+
### Unknowns (Require Further Investigation)
|
|
498
|
+
- [ ] [Unknown item]
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
---
|
|
502
|
+
|
|
503
|
+
### Step 8: Generate Discovery Document
|
|
504
|
+
|
|
505
|
+
Create the discovery markdown file:
|
|
506
|
+
|
|
507
|
+
**Location**: `flow/discovery/discovery_<feature_name>_v<version>.md`
|
|
508
|
+
|
|
509
|
+
**Use Template**: See `.claude/rules/patterns/discovery-templates.md`
|
|
510
|
+
|
|
511
|
+
**Required Sections**:
|
|
512
|
+
|
|
513
|
+
1. Context
|
|
514
|
+
2. Referenced Documents
|
|
515
|
+
3. Requirements Gathered (FR, NFR, Constraints)
|
|
516
|
+
4. Open Questions (all answered)
|
|
517
|
+
5. Technical Considerations
|
|
518
|
+
6. Proposed Approach
|
|
519
|
+
7. Risks and Unknowns
|
|
520
|
+
8. Next Steps
|
|
521
|
+
|
|
522
|
+
---
|
|
523
|
+
|
|
524
|
+
## Output Format
|
|
525
|
+
|
|
526
|
+
The discovery document should follow the template in `.claude/rules/patterns/discovery-templates.md`.
|
|
527
|
+
|
|
528
|
+
**Naming Convention**: `discovery_<feature_name>_v<version>.md`
|
|
529
|
+
|
|
530
|
+
**Examples**:
|
|
531
|
+
- `discovery_workflow_editor_v1.md`
|
|
532
|
+
- `discovery_user_authentication_v1.md`
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
## Validation Checklist
|
|
537
|
+
|
|
538
|
+
Before completing discovery, verify:
|
|
539
|
+
|
|
540
|
+
- [ ] All referenced documents have been read
|
|
541
|
+
- [ ] Document is saved in `flow/discovery/` folder
|
|
542
|
+
- [ ] File uses correct naming convention
|
|
543
|
+
- [ ] Open questions table has no "Blocked" status
|
|
544
|
+
- [ ] Requirements are categorized (FR, NFR, Constraints)
|
|
545
|
+
- [ ] Technical considerations are documented
|
|
546
|
+
- [ ] Risks and unknowns are identified
|
|
547
|
+
- [ ] Proposed approach is documented (high-level only)
|
|
548
|
+
- [ ] Next steps are defined (pointing to `/create-plan`)
|
|
549
|
+
- [ ] **NO implementation code is included**
|
|
550
|
+
- [ ] **NO source files were created or modified**
|
|
551
|
+
|
|
552
|
+
---
|
|
553
|
+
|
|
554
|
+
## Related Files
|
|
555
|
+
|
|
556
|
+
| File | Purpose |
|
|
557
|
+
| ------------------------------------------------- | --------------------------------- |
|
|
558
|
+
| `.claude/rules/patterns/discovery-patterns.md` | Rules and patterns for discovery |
|
|
559
|
+
| `.claude/rules/patterns/discovery-templates.md` | Document templates |
|
|
560
|
+
| `.claude/rules/tools/interactive-questions-tool.md` | Interactive Questions UI workflow |
|
|
561
|
+
| `flow/discovery/` | Output folder for discovery docs |
|