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