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.
Files changed (124) hide show
  1. package/.claude/commands/create-contract.md +468 -0
  2. package/.claude/commands/create-plan.md +512 -0
  3. package/.claude/commands/discovery-plan.md +561 -0
  4. package/.claude/commands/execute-plan.md +682 -0
  5. package/.claude/commands/review-code.md +459 -0
  6. package/.claude/commands/review-pr.md +651 -0
  7. package/.claude/commands/setup.md +1609 -0
  8. package/.claude/commands/write-tests.md +543 -0
  9. package/.claude/rules/core/allowed-patterns.md +175 -0
  10. package/.claude/rules/core/complexity-scoring.md +225 -0
  11. package/.claude/rules/core/forbidden-patterns.md +253 -0
  12. package/.claude/rules/languages/python-patterns.md +6 -0
  13. package/.claude/rules/languages/typescript-patterns.md +7 -0
  14. package/.claude/rules/patterns/contract-patterns.md +332 -0
  15. package/.claude/rules/patterns/discovery-patterns.md +342 -0
  16. package/.claude/rules/patterns/discovery-templates.md +319 -0
  17. package/.claude/rules/patterns/jest-patterns.md +482 -0
  18. package/.claude/rules/patterns/plans-patterns.md +225 -0
  19. package/.claude/rules/patterns/plans-templates.md +227 -0
  20. package/.claude/rules/patterns/pytest-patterns.md +457 -0
  21. package/.claude/rules/patterns/review-code-templates.md +305 -0
  22. package/.claude/rules/patterns/review-pr-patterns.md +360 -0
  23. package/.claude/rules/tools/auth-pr-tool.md +30 -0
  24. package/.claude/rules/tools/interactive-questions-tool.md +235 -0
  25. package/.claude/rules/tools/jest-testing-tool.md +73 -0
  26. package/.claude/rules/tools/plan-mode-tool.md +164 -0
  27. package/.claude/rules/tools/pytest-testing-tool.md +121 -0
  28. package/.claude/rules/tools/reference-expansion-tool.md +326 -0
  29. package/LICENSE +21 -0
  30. package/README.md +167 -0
  31. package/dist/cli/commands/init.d.ts +6 -0
  32. package/dist/cli/commands/init.d.ts.map +1 -0
  33. package/dist/cli/commands/init.js +139 -0
  34. package/dist/cli/commands/init.js.map +1 -0
  35. package/dist/cli/handlers/claude.d.ts +9 -0
  36. package/dist/cli/handlers/claude.d.ts.map +1 -0
  37. package/dist/cli/handlers/claude.js +119 -0
  38. package/dist/cli/handlers/claude.js.map +1 -0
  39. package/dist/cli/handlers/codex.d.ts +9 -0
  40. package/dist/cli/handlers/codex.d.ts.map +1 -0
  41. package/dist/cli/handlers/codex.js +100 -0
  42. package/dist/cli/handlers/codex.js.map +1 -0
  43. package/dist/cli/handlers/cursor.d.ts +8 -0
  44. package/dist/cli/handlers/cursor.d.ts.map +1 -0
  45. package/dist/cli/handlers/cursor.js +34 -0
  46. package/dist/cli/handlers/cursor.js.map +1 -0
  47. package/dist/cli/handlers/openclaw.d.ts +8 -0
  48. package/dist/cli/handlers/openclaw.d.ts.map +1 -0
  49. package/dist/cli/handlers/openclaw.js +34 -0
  50. package/dist/cli/handlers/openclaw.js.map +1 -0
  51. package/dist/cli/handlers/shared.d.ts +9 -0
  52. package/dist/cli/handlers/shared.d.ts.map +1 -0
  53. package/dist/cli/handlers/shared.js +44 -0
  54. package/dist/cli/handlers/shared.js.map +1 -0
  55. package/dist/cli/index.d.ts +8 -0
  56. package/dist/cli/index.d.ts.map +1 -0
  57. package/dist/cli/index.js +43 -0
  58. package/dist/cli/index.js.map +1 -0
  59. package/dist/cli/types.d.ts +26 -0
  60. package/dist/cli/types.d.ts.map +1 -0
  61. package/dist/cli/types.js +5 -0
  62. package/dist/cli/types.js.map +1 -0
  63. package/dist/cli/utils/files.d.ts +37 -0
  64. package/dist/cli/utils/files.d.ts.map +1 -0
  65. package/dist/cli/utils/files.js +122 -0
  66. package/dist/cli/utils/files.js.map +1 -0
  67. package/dist/cli/utils/logger.d.ts +11 -0
  68. package/dist/cli/utils/logger.d.ts.map +1 -0
  69. package/dist/cli/utils/logger.js +34 -0
  70. package/dist/cli/utils/logger.js.map +1 -0
  71. package/dist/cli/utils/prompts.d.ts +10 -0
  72. package/dist/cli/utils/prompts.d.ts.map +1 -0
  73. package/dist/cli/utils/prompts.js +65 -0
  74. package/dist/cli/utils/prompts.js.map +1 -0
  75. package/dist/test/setup.d.ts +5 -0
  76. package/dist/test/setup.d.ts.map +1 -0
  77. package/dist/test/setup.js +7 -0
  78. package/dist/test/setup.js.map +1 -0
  79. package/package.json +63 -0
  80. package/rules/core/_index.mdc +89 -0
  81. package/rules/core/allowed-patterns.mdc +185 -0
  82. package/rules/core/complexity-scoring.mdc +235 -0
  83. package/rules/core/forbidden-patterns.mdc +263 -0
  84. package/rules/languages/_index.mdc +80 -0
  85. package/rules/languages/python-patterns.mdc +188 -0
  86. package/rules/languages/typescript-patterns.mdc +128 -0
  87. package/rules/patterns/_index.mdc +185 -0
  88. package/rules/patterns/contract-patterns.mdc +344 -0
  89. package/rules/patterns/discovery-patterns.mdc +354 -0
  90. package/rules/patterns/discovery-templates.mdc +329 -0
  91. package/rules/patterns/jest-patterns.mdc +492 -0
  92. package/rules/patterns/plans-patterns.mdc +237 -0
  93. package/rules/patterns/plans-templates.mdc +237 -0
  94. package/rules/patterns/pytest-patterns.mdc +467 -0
  95. package/rules/patterns/review-code-templates.mdc +315 -0
  96. package/rules/patterns/review-pr-patterns.mdc +370 -0
  97. package/rules/skills/_index.mdc +174 -0
  98. package/rules/skills/create-contract-skill.mdc +239 -0
  99. package/rules/skills/create-plan-skill.mdc +271 -0
  100. package/rules/skills/discovery-skill.mdc +295 -0
  101. package/rules/skills/execute-plan-skill.mdc +388 -0
  102. package/rules/skills/review-code-skill.mdc +308 -0
  103. package/rules/skills/review-pr-skill.mdc +496 -0
  104. package/rules/skills/setup-skill.mdc +923 -0
  105. package/rules/skills/write-tests-skill.mdc +294 -0
  106. package/rules/templates/index-template.mdc +126 -0
  107. package/rules/tools/_index.mdc +114 -0
  108. package/rules/tools/auth-pr-tool.mdc +362 -0
  109. package/rules/tools/interactive-questions-tool.mdc +337 -0
  110. package/rules/tools/jest-testing-tool.mdc +96 -0
  111. package/rules/tools/plan-mode-tool.mdc +229 -0
  112. package/rules/tools/pytest-testing-tool.mdc +144 -0
  113. package/rules/tools/reference-expansion-tool.mdc +338 -0
  114. package/skills/plan-flow/SKILL.md +109 -0
  115. package/skills/plan-flow/create-contract/SKILL.md +139 -0
  116. package/skills/plan-flow/create-plan/SKILL.md +93 -0
  117. package/skills/plan-flow/discovery/SKILL.md +85 -0
  118. package/skills/plan-flow/execute-plan/SKILL.md +89 -0
  119. package/skills/plan-flow/review-code/SKILL.md +100 -0
  120. package/skills/plan-flow/review-pr/SKILL.md +122 -0
  121. package/skills/plan-flow/setup/SKILL.md +73 -0
  122. package/skills/plan-flow/write-tests/SKILL.md +115 -0
  123. package/templates/shared/AGENTS.md.template +60 -0
  124. package/templates/shared/CLAUDE.md.template +62 -0
@@ -0,0 +1,332 @@
1
+
2
+ ## Contract Types
3
+
4
+ | Type | Purpose | When to Use |
5
+ |------|---------|-------------|
6
+ | API Contract | REST/GraphQL endpoint documentation | Integrating with external APIs |
7
+ | Integration Contract | Service connection details | Connecting to third-party services |
8
+ | Component Contract | Props, events, data flow | Documenting component interfaces |
9
+
10
+ ---
11
+
12
+ ## Contract Document Structure
13
+
14
+ Every contract should include these sections:
15
+
16
+ ### Required Sections
17
+
18
+ 1. **Overview**: Brief description of the service
19
+ 2. **Source**: URL and type (docs/repo)
20
+ 3. **Authentication**: How to authenticate requests
21
+ 4. **Base Configuration**: URLs, rate limits, timeouts
22
+ 5. **Endpoints**: Available API endpoints with schemas
23
+ 6. **Error Handling**: Error codes and response formats
24
+
25
+ ### Recommended Sections
26
+
27
+ 7. **FE Integration Notes**: Frontend-specific guidance
28
+ 8. **Usage Examples**: Code examples for common use cases
29
+ 9. **Webhooks**: Event subscriptions if applicable
30
+ 10. **Rate Limits**: Throttling information
31
+ 11. **Changelog**: Version history
32
+
33
+ ---
34
+
35
+ ## Allowed Patterns
36
+
37
+ ### 1. Use TypeScript Interfaces for Schemas
38
+
39
+ Define request and response types using TypeScript interfaces:
40
+
41
+ ```typescript
42
+ interface CreateUserRequest {
43
+ email: string;
44
+ name: string;
45
+ role?: 'admin' | 'user';
46
+ }
47
+
48
+ interface CreateUserResponse {
49
+ id: string;
50
+ email: string;
51
+ name: string;
52
+ createdAt: string;
53
+ }
54
+ ```
55
+
56
+ ### 2. Document All Status Codes
57
+
58
+ List all possible HTTP status codes with their meaning:
59
+
60
+ | Code | Meaning | FE Action |
61
+ |------|---------|-----------|
62
+ | 200 | Success | Process response |
63
+ | 201 | Created | Navigate to new resource |
64
+ | 400 | Bad Request | Show validation errors |
65
+ | 401 | Unauthorized | Redirect to login |
66
+ | 403 | Forbidden | Show permission error |
67
+ | 404 | Not Found | Show not found UI |
68
+ | 429 | Rate Limited | Retry with backoff |
69
+ | 500 | Server Error | Show generic error |
70
+
71
+ ### 3. Include Authentication Examples
72
+
73
+ Provide complete authentication setup:
74
+
75
+ ```typescript
76
+ // API Key Authentication
77
+ const headers = {
78
+ 'X-API-Key': process.env.API_KEY,
79
+ 'Content-Type': 'application/json',
80
+ };
81
+
82
+ // Bearer Token Authentication
83
+ const headers = {
84
+ 'Authorization': `Bearer ${accessToken}`,
85
+ 'Content-Type': 'application/json',
86
+ };
87
+
88
+ // OAuth2 Flow
89
+ async function getAccessToken(): Promise<string> {
90
+ const response = await fetch(TOKEN_URL, {
91
+ method: 'POST',
92
+ body: new URLSearchParams({
93
+ grant_type: 'client_credentials',
94
+ client_id: CLIENT_ID,
95
+ client_secret: CLIENT_SECRET,
96
+ }),
97
+ });
98
+ const { access_token } = await response.json();
99
+ return access_token;
100
+ }
101
+ ```
102
+
103
+ ### 4. Define Error Response Types
104
+
105
+ Create typed error handling:
106
+
107
+ ```typescript
108
+ interface ApiError {
109
+ code: string;
110
+ message: string;
111
+ details?: Record<string, string[]>;
112
+ }
113
+
114
+ function handleError(error: ApiError): void {
115
+ switch (error.code) {
116
+ case 'VALIDATION_ERROR':
117
+ // Show field-specific errors
118
+ break;
119
+ case 'UNAUTHORIZED':
120
+ // Clear auth and redirect
121
+ break;
122
+ case 'RATE_LIMITED':
123
+ // Queue for retry
124
+ break;
125
+ default:
126
+ // Show generic error
127
+ }
128
+ }
129
+ ```
130
+
131
+ ### 5. Document Rate Limit Handling
132
+
133
+ Include retry logic patterns:
134
+
135
+ ```typescript
136
+ async function fetchWithRetry<T>(
137
+ url: string,
138
+ options: RequestInit,
139
+ maxRetries = 3
140
+ ): Promise<T> {
141
+ for (let i = 0; i < maxRetries; i++) {
142
+ const response = await fetch(url, options);
143
+
144
+ if (response.status === 429) {
145
+ const retryAfter = response.headers.get('Retry-After') || '1';
146
+ await delay(parseInt(retryAfter) * 1000);
147
+ continue;
148
+ }
149
+
150
+ if (!response.ok) {
151
+ throw new ApiError(await response.json());
152
+ }
153
+
154
+ return response.json();
155
+ }
156
+ throw new Error('Max retries exceeded');
157
+ }
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Forbidden Patterns
163
+
164
+ ### 1. DON'T Hardcode Credentials
165
+
166
+ Never include actual API keys or secrets in contracts:
167
+
168
+ ```typescript
169
+ // BAD
170
+ const API_KEY = 'sk_live_abc123';
171
+
172
+ // GOOD
173
+ const API_KEY = process.env.STRIPE_API_KEY;
174
+ ```
175
+
176
+ ### 2. DON'T Skip Error Documentation
177
+
178
+ Always document error scenarios:
179
+
180
+ ```markdown
181
+ // BAD - No error handling documented
182
+ ## Endpoints
183
+ ### GET /users
184
+ Returns list of users.
185
+
186
+ // GOOD - Error cases documented
187
+ ## Endpoints
188
+ ### GET /users
189
+ Returns list of users.
190
+
191
+ **Error Responses**:
192
+ - 401: Invalid or expired token
193
+ - 403: Insufficient permissions
194
+ - 429: Rate limit exceeded
195
+ ```
196
+
197
+ ### 3. DON'T Use Generic Types
198
+
199
+ Be specific with type definitions:
200
+
201
+ ```typescript
202
+ // BAD
203
+ interface Response {
204
+ data: any;
205
+ meta: object;
206
+ }
207
+
208
+ // GOOD
209
+ interface UserListResponse {
210
+ data: User[];
211
+ meta: {
212
+ total: number;
213
+ page: number;
214
+ perPage: number;
215
+ };
216
+ }
217
+ ```
218
+
219
+ ### 4. DON'T Omit Required Fields
220
+
221
+ Mark required vs optional clearly:
222
+
223
+ ```typescript
224
+ // BAD - Unclear requirements
225
+ interface CreateUserRequest {
226
+ email: string;
227
+ name: string;
228
+ phone: string;
229
+ }
230
+
231
+ // GOOD - Optional fields marked
232
+ interface CreateUserRequest {
233
+ email: string; // Required
234
+ name: string; // Required
235
+ phone?: string; // Optional
236
+ }
237
+ ```
238
+
239
+ ---
240
+
241
+ ## FE Integration Guidelines
242
+
243
+ ### State Management Recommendations
244
+
245
+ | Data Type | Recommendation |
246
+ |-----------|----------------|
247
+ | User session | Global store (Zustand/Redux) |
248
+ | API responses | React Query / SWR |
249
+ | Form state | Local component state |
250
+ | UI state | Local or context |
251
+
252
+ ### Loading State Patterns
253
+
254
+ ```typescript
255
+ type RequestState<T> =
256
+ | { status: 'idle' }
257
+ | { status: 'loading' }
258
+ | { status: 'success'; data: T }
259
+ | { status: 'error'; error: ApiError };
260
+ ```
261
+
262
+ ### Caching Recommendations
263
+
264
+ | Endpoint Type | Cache Strategy |
265
+ |---------------|----------------|
266
+ | List endpoints | Cache with revalidation |
267
+ | Detail endpoints | Cache by ID |
268
+ | Mutations | Invalidate related queries |
269
+ | Real-time data | No cache / short TTL |
270
+
271
+ ---
272
+
273
+ ## Contract Maintenance
274
+
275
+ ### When to Update Contracts
276
+
277
+ - API version changes
278
+ - New endpoints added
279
+ - Breaking changes in schemas
280
+ - Authentication method changes
281
+ - Rate limit adjustments
282
+
283
+ ### Version Tracking
284
+
285
+ Include changelog in contracts:
286
+
287
+ ```markdown
288
+ ## Changelog
289
+
290
+ | Date | Version | Changes |
291
+ |------|---------|---------|
292
+ | 2024-01-15 | 2.0 | Added pagination to list endpoints |
293
+ | 2024-01-10 | 1.1 | Added webhook documentation |
294
+ | 2024-01-01 | 1.0 | Initial contract |
295
+ ```
296
+
297
+ ---
298
+
299
+ ## Contract File Organization
300
+
301
+ ```
302
+ contracts/
303
+ ├── stripe_payments_contract.md
304
+ ├── auth0_authentication_contract.md
305
+ ├── sendgrid_email_contract.md
306
+ ├── openai_chat_contract.md
307
+ └── internal_api_contract.md
308
+ ```
309
+
310
+ ### Naming Convention
311
+
312
+ `<service_name>_<feature>_contract.md`
313
+
314
+ Examples:
315
+ - `stripe_payments_contract.md`
316
+ - `stripe_subscriptions_contract.md`
317
+ - `github_repos_contract.md`
318
+
319
+ ---
320
+
321
+ ## Summary
322
+
323
+ | Pattern | Description |
324
+ |---------|-------------|
325
+ | TypeScript Interfaces | Use typed schemas for requests/responses |
326
+ | Status Code Documentation | Document all HTTP status codes |
327
+ | Authentication Examples | Provide complete auth setup code |
328
+ | Error Type Definitions | Create typed error handling |
329
+ | Rate Limit Handling | Include retry logic patterns |
330
+ | No Hardcoded Secrets | Use environment variables |
331
+ | Specific Types | Avoid `any` and `object` |
332
+ | Required Field Markers | Mark optional fields explicitly |
@@ -0,0 +1,342 @@
1
+
2
+ ## What is Discovery?
3
+
4
+ Discovery is a **pre-planning phase** where we:
5
+
6
+ 1. **Gather Information**: Read referenced files, contracts, and documentation
7
+ 2. **Ask Questions**: Clarify every unclear aspect with the user
8
+ 3. **Explore Unknowns**: Investigate technical feasibility and constraints
9
+ 4. **Document Findings**: Create a comprehensive discovery document
10
+ 5. **Prepare for Planning**: Provide all context needed to create an implementation plan
11
+
12
+ **Workflow**: Discovery Output → Implementation Plan → Execution
13
+
14
+ ---
15
+
16
+ ## Folder Structure
17
+
18
+ ```
19
+ flow/
20
+ ├── archive/ # IGNORE - Completed/abandoned documents
21
+ ├── discovery/ # Active discovery documents
22
+ │ ├── discovery_user_auth_v1.md
23
+ │ ├── discovery_realtime_notifications_v1.md
24
+ │ └── spike_streaming_performance_v1.md
25
+ ├── plans/ # Implementation plans (created after discovery)
26
+ │ └── plan_feature_v1.md
27
+ ├── contracts/ # Integration contracts
28
+ │ └── api_contract.md
29
+ └── references/ # Reference materials (specs, designs)
30
+ ├── api-specs.md
31
+ └── sse-events.md
32
+ ```
33
+
34
+ **Critical**: NEVER read or reference files in `flow/archive/` - these are outdated documents.
35
+
36
+ ---
37
+
38
+ ## Naming Conventions
39
+
40
+ | Prefix | Purpose | When to Use |
41
+ | ------------ | ------------------------- | -------------------------------------- |
42
+ | `discovery_` | General feature discovery | Exploring a new feature or enhancement |
43
+ | `spike_` | Technical investigation | Testing technical feasibility |
44
+ | `research_` | In-depth research | Comparing options or technologies |
45
+
46
+ **Format**: `<prefix>_<topic>_v<version>.md`
47
+
48
+ **Examples**:
49
+
50
+ - `discovery_workflow_editor_v1.md`
51
+ - `spike_sse_performance_v1.md`
52
+ - `research_state_management_v1.md`
53
+
54
+ ---
55
+
56
+ ## Question Status Tracking
57
+
58
+ Track every question with a clear status:
59
+
60
+ | Status | Meaning | Action Required |
61
+ | -------- | --------------------------------------------- | ------------------------ |
62
+ | Open | Waiting for user response | Wait for answer |
63
+ | Answered | User provided answer | Document in requirements |
64
+ | Assumed | Made reasonable assumption (needs validation) | Request validation |
65
+ | Blocked | Cannot proceed without answer | Escalate to user |
66
+
67
+ **Question Table Format**:
68
+
69
+ ```markdown
70
+ | # | Category | Question | Status | Answer |
71
+ | --- | ---------- | -------------------------- | -------- | ----------------- |
72
+ | 1 | Functional | Max steps per workflow? | Answered | 20 steps maximum |
73
+ | 2 | Technical | Use existing store or new? | Open | - |
74
+ | 3 | NFR | Required response time? | Assumed | <500ms (validate) |
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Requirements Categories
80
+
81
+ Categorize all gathered requirements:
82
+
83
+ | Category | Prefix | Description |
84
+ | ----------- | ------ | ----------------------------------------- |
85
+ | Functional | FR- | What the feature must do |
86
+ | Non-Functional | NFR- | Performance, security, scalability |
87
+ | Constraints | C- | Limitations, dependencies, boundaries |
88
+ | Acceptance | AC- | How we know the feature is complete |
89
+
90
+ **Format**:
91
+
92
+ ```markdown
93
+ - [FR-1]: Users can create workflow steps with title and content
94
+ - [NFR-1]: Step creation should complete within 500ms
95
+ - [C-1]: Must use existing authentication flow
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Allowed Patterns
101
+
102
+ ### 1. Read All Referenced Documents First
103
+
104
+ **Always** read every referenced document before asking questions.
105
+
106
+ **Process**:
107
+
108
+ 1. Identify referenced files (look for @mentions, file paths)
109
+ 2. Read all referenced files using the Read tool
110
+ 3. Extract relevant requirements, constraints, contracts
111
+ 4. Document findings with key points
112
+ 5. Then ask questions about gaps or unclear aspects
113
+
114
+ ---
115
+
116
+ ### 2. Ask Questions Using Interactive Questions Tool
117
+
118
+ **Use Plan mode's Questions UI** for a better user experience.
119
+
120
+ **Process**:
121
+
122
+ 1. Call `SwitchMode` tool to enter Plan mode
123
+ 2. Call `AskQuestion` tool for each question
124
+ 3. Wait for responses
125
+ 4. Call `SwitchMode` tool to return to Agent mode
126
+
127
+ See `.claude/rules/tools/interactive-questions-tool.md` for detailed instructions.
128
+
129
+ **Question Format**:
130
+
131
+ - Use 2-6 multiple-choice options per question
132
+ - Label options with A, B, C, D, E, F
133
+ - Provide context in the explanation parameter
134
+ - Ask all questions in one Plan mode session
135
+
136
+ ---
137
+
138
+ ### 3. Structure Discovery Documents Consistently
139
+
140
+ Every discovery document must include these sections:
141
+
142
+ | Section | Purpose |
143
+ | ------------------------ | ------------------------------------------ |
144
+ | Context | Why this discovery is needed |
145
+ | Referenced Documents | Documents reviewed with key findings |
146
+ | Requirements Gathered | FR, NFR, Constraints categorized |
147
+ | Open Questions | Tracked with status |
148
+ | Technical Considerations | Architecture, dependencies, patterns |
149
+ | Proposed Approach | High-level recommendation (NOT code) |
150
+ | Risks and Unknowns | Identified risks with mitigation |
151
+ | Next Steps | Follow-up actions linking to `/create-plan` |
152
+
153
+ See `.claude/rules/patterns/discovery-templates.md` for the full template.
154
+
155
+ ---
156
+
157
+ ### 4. Mark Assumptions Explicitly
158
+
159
+ When making assumptions, always mark them clearly:
160
+
161
+ ```markdown
162
+ | 3 | NFR | Required response time? | Assumed | <500ms (needs validation) |
163
+ ```
164
+
165
+ **Process**:
166
+
167
+ 1. Mark with "Assumed" status
168
+ 2. Note the assumption clearly
169
+ 3. Request validation from user
170
+ 4. Update to "Answered" once confirmed
171
+
172
+ ---
173
+
174
+ ### 5. Keep Discovery High-Level
175
+
176
+ Focus on "what" not "how". Discovery captures:
177
+
178
+ - **What** the feature should do
179
+ - **What** constraints exist
180
+ - **What** risks are present
181
+ - **What** approach is recommended
182
+
183
+ Implementation details belong in the plan, not discovery.
184
+
185
+ ---
186
+
187
+ ### 6. Link Discovery to Plan
188
+
189
+ When discovery is complete:
190
+
191
+ 1. Reference the discovery document in the plan's Overview
192
+ 2. Move discovery to `flow/archive/` after plan execution
193
+
194
+ ```markdown
195
+ ## Overview
196
+
197
+ This plan implements the feature described in the discovery document:
198
+ `flow/discovery/discovery_workflow_editor_v1.md`
199
+ ```
200
+
201
+ ---
202
+
203
+ ## Forbidden Patterns
204
+
205
+ ### 1. DON'T Skip Reading Referenced Documents
206
+
207
+ **Problem**: Making assumptions without reviewing available context leads to incorrect implementations.
208
+
209
+ **Fix**: Always read referenced files before asking questions.
210
+
211
+ ---
212
+
213
+ ### 2. DON'T Make Assumptions Without Marking Them
214
+
215
+ **Problem**: Assumptions presented as facts cause incorrect implementations.
216
+
217
+ **Fix**: Mark assumptions with "Assumed" status and request validation.
218
+
219
+ ---
220
+
221
+ ### 3. DON'T Create Plans Without Discovery for Complex Features
222
+
223
+ **Problem**: Jumping to planning without understanding leads to rework.
224
+
225
+ **Fix**: For features with unknowns, always do discovery first.
226
+
227
+ ---
228
+
229
+ ### 4. DON'T Proceed with Blocked Questions
230
+
231
+ **Problem**: Moving forward with unresolved blockers creates problems later.
232
+
233
+ **Fix**: Resolve blocked questions before proposing approach.
234
+
235
+ ---
236
+
237
+ ### 5. DON'T Mix Discovery Documents with Plans
238
+
239
+ **Problem**: Confusion about document purpose.
240
+
241
+ **Fix**: Keep discovery in `flow/discovery/`, plans in `flow/plans/`.
242
+
243
+ ---
244
+
245
+ ### 6. DON'T Write Implementation Details in Discovery
246
+
247
+ **Problem**: Discovery should focus on "what", not "how".
248
+
249
+ **Fix**: Keep discovery at the conceptual level. Implementation belongs in the plan.
250
+
251
+ ---
252
+
253
+ ### 7. DON'T Write Code During Discovery
254
+
255
+ **Problem**: Discovery is for gathering information, not implementing.
256
+
257
+ **Forbidden Actions**:
258
+
259
+ - Creating or editing source files (`.ts`, `.tsx`, `.js`, etc.)
260
+ - Modifying configuration files
261
+ - Running code generation commands
262
+ - Making any changes to the codebase
263
+ - Writing implementation code in responses
264
+
265
+ **Allowed Actions**:
266
+
267
+ - Reading files to understand current implementation
268
+ - Searching codebase for context
269
+ - Asking questions
270
+ - Creating the discovery markdown document
271
+
272
+ ---
273
+
274
+ ### 8. DON'T Create Discovery for Trivial Features
275
+
276
+ **Problem**: Overhead without value for simple changes.
277
+
278
+ **When to Skip Discovery**:
279
+
280
+ - Single-file changes
281
+ - Clear, well-defined requirements
282
+ - No unknowns or ambiguity
283
+ - Similar to existing implementations
284
+
285
+ **Fix**: Use discovery only when there's genuine uncertainty to resolve.
286
+
287
+ ---
288
+
289
+ ## When to Ask vs. When to Document
290
+
291
+ ### ASK When:
292
+
293
+ - Requirements are vague or ambiguous
294
+ - Technical approach is unclear
295
+ - Multiple valid interpretations exist
296
+ - Dependencies or constraints are unknown
297
+ - Acceptance criteria are not defined
298
+ - Edge cases are not specified
299
+
300
+ ### DOCUMENT When:
301
+
302
+ - Information is clear in referenced documents
303
+ - User has provided explicit answer
304
+ - Standard pattern applies (per cursor rules)
305
+ - Similar feature exists in codebase
306
+ - Assumption has been validated
307
+
308
+ ---
309
+
310
+ ## Discovery Document Output
311
+
312
+ The discovery document is the **ONLY** deliverable. It must be:
313
+
314
+ 1. **Saved** in `flow/discovery/` folder
315
+ 2. **Named** using convention: `discovery_<feature>_v<version>.md`
316
+ 3. **Complete** with all required sections
317
+ 4. **Reviewed** by user before plan creation
318
+ 5. **Linked** to the implementation plan
319
+
320
+ ---
321
+
322
+ ## Related Resources
323
+
324
+ - **Command**: `/discovery-plan` - Orchestrates the discovery workflow
325
+ - **Templates**: `.claude/rules/patterns/discovery-templates.md`
326
+ - **Interactive Questions**: `.claude/rules/tools/interactive-questions-tool.md`
327
+ - **Plan Command**: `/create-plan` - Creates plan from discovery
328
+
329
+ ---
330
+
331
+ ## Summary
332
+
333
+ | Pattern | Description |
334
+ | ------------------------------ | ---------------------------------------------- |
335
+ | Read documents first | Always review referenced files before asking |
336
+ | Use interactive questions | Plan mode Questions UI for better UX |
337
+ | Structure consistently | Follow the standard discovery template |
338
+ | Mark assumptions | Always label and validate assumptions |
339
+ | Stay high-level | Focus on "what" not "how" |
340
+ | Link to plan | Reference discovery in plan overview |
341
+ | No code | Only create the discovery markdown file |
342
+ | Skip for trivial features | Don't over-engineer simple changes |