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,295 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Include when /discovery-plan is invoked or requirements gathering before implementation is needed"
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Discovery Skill
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Perform a comprehensive **requirements gathering and documentation** process that reads referenced documents, asks clarifying questions, and produces a structured discovery document.
|
|
11
|
+
|
|
12
|
+
This skill **only produces a markdown file** in `flow/discovery/`. It does NOT:
|
|
13
|
+
|
|
14
|
+
- Write any code
|
|
15
|
+
- Modify any source files
|
|
16
|
+
- Create implementation plans
|
|
17
|
+
- Execute any implementation
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Restrictions - DISCOVERY ONLY
|
|
22
|
+
|
|
23
|
+
This skill is **strictly for gathering and documenting requirements**. The process:
|
|
24
|
+
|
|
25
|
+
1. **Reads** all referenced documents and contracts
|
|
26
|
+
2. **Asks** clarifying questions via Interactive Questions Tool
|
|
27
|
+
3. **Documents** requirements (FR, NFR, Constraints)
|
|
28
|
+
4. **Identifies** technical considerations (high-level only)
|
|
29
|
+
5. **Proposes** approach (conceptual, no code)
|
|
30
|
+
6. **Generates** a discovery markdown file
|
|
31
|
+
|
|
32
|
+
**No code, no implementation, no source file modifications.**
|
|
33
|
+
|
|
34
|
+
### NEVER Do These Actions
|
|
35
|
+
|
|
36
|
+
| Forbidden Action | Reason |
|
|
37
|
+
| -------------------------------------- | ----------------------------------------- |
|
|
38
|
+
| Create/edit source code files | Discovery is requirements gathering only |
|
|
39
|
+
| Write implementation code in responses | No code during discovery |
|
|
40
|
+
| Create implementation plans | Plans come after discovery |
|
|
41
|
+
| Modify configuration files | No codebase changes |
|
|
42
|
+
| Run build or test commands | No execution commands |
|
|
43
|
+
| Create files outside `flow/discovery/` | Only write discovery documents |
|
|
44
|
+
|
|
45
|
+
### Allowed Actions
|
|
46
|
+
|
|
47
|
+
| Allowed Action | Purpose |
|
|
48
|
+
| -------------------------------------- | ------------------------------------ |
|
|
49
|
+
| Read any project file | Understand existing implementation |
|
|
50
|
+
| Read referenced documents | Extract requirements and constraints |
|
|
51
|
+
| Search codebase (grep, glob, semantic) | Find existing patterns |
|
|
52
|
+
| Use Interactive Questions Tool | Gather requirements from user |
|
|
53
|
+
| Write to `flow/discovery/` | Save discovery document |
|
|
54
|
+
| Read project rule files | Understand patterns to follow |
|
|
55
|
+
|
|
56
|
+
> **Important**: The ONLY writable location is `flow/discovery/`. No source code, configuration files, or any other project files should be modified.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Inputs
|
|
61
|
+
|
|
62
|
+
| Input | Required | Description |
|
|
63
|
+
| -------------------- | -------- | ----------------------------------------------------- |
|
|
64
|
+
| `feature_name` | Yes | Name of the feature or topic to explore |
|
|
65
|
+
| `context` | Optional | Why this discovery is needed |
|
|
66
|
+
| `referenced_docs` | Optional | List of documents to review (@mentions, file paths) |
|
|
67
|
+
| `known_requirements` | Optional | Any requirements already known |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Workflow
|
|
72
|
+
|
|
73
|
+
### Step 1: Read All Referenced Documents
|
|
74
|
+
|
|
75
|
+
**BEFORE asking detailed questions**, read every referenced document.
|
|
76
|
+
|
|
77
|
+
**Actions**:
|
|
78
|
+
|
|
79
|
+
1. Identify references (look for @mentions, file paths, URLs)
|
|
80
|
+
2. Read each file using the Read tool
|
|
81
|
+
3. Extract key information (requirements, constraints, contracts)
|
|
82
|
+
4. Summarize findings for each source
|
|
83
|
+
|
|
84
|
+
**Document Analysis Format**:
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
## Referenced Documents Analysis
|
|
88
|
+
|
|
89
|
+
### `flow/contracts/api-contract.md`
|
|
90
|
+
|
|
91
|
+
**Key Findings**:
|
|
92
|
+
- [Key point 1]
|
|
93
|
+
- [Key point 2]
|
|
94
|
+
|
|
95
|
+
**Questions Raised**:
|
|
96
|
+
- [Gap or unclear aspect]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Important**: NEVER read or reference files in `flow/archive/` - these are outdated documents.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### Step 2: Ask Clarifying Questions
|
|
104
|
+
|
|
105
|
+
Ask questions about gaps identified in documents and unclear requirements.
|
|
106
|
+
|
|
107
|
+
**Question Categories**:
|
|
108
|
+
|
|
109
|
+
| Category | Focus |
|
|
110
|
+
| ---------- | ---------------------------------- |
|
|
111
|
+
| Functional | What the feature must do |
|
|
112
|
+
| NFR | Performance, security, scalability |
|
|
113
|
+
| Technical | Architecture, dependencies |
|
|
114
|
+
| UI/UX | User interface and experience |
|
|
115
|
+
|
|
116
|
+
**Use Interactive Questions Tool**:
|
|
117
|
+
|
|
118
|
+
Follow `.cursor/rules/tools/interactive-questions-tool.mdc`:
|
|
119
|
+
|
|
120
|
+
1. Call `SwitchMode` tool to enter Plan mode
|
|
121
|
+
2. Call `AskQuestion` tool for each question (2-6 options, A/B/C/D format)
|
|
122
|
+
3. Wait for responses
|
|
123
|
+
4. Call `SwitchMode` tool to return to Agent mode
|
|
124
|
+
|
|
125
|
+
**Skip Interactive Questions If**:
|
|
126
|
+
|
|
127
|
+
- All questions answered in chat already
|
|
128
|
+
- User confirmed all assumptions
|
|
129
|
+
- No blocked or open questions remain
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### Step 3: Track Question Status
|
|
134
|
+
|
|
135
|
+
Maintain a question tracking table:
|
|
136
|
+
|
|
137
|
+
```markdown
|
|
138
|
+
## Open Questions
|
|
139
|
+
|
|
140
|
+
| # | Category | Question | Status | Answer |
|
|
141
|
+
| --- | ---------- | -------------------------- | -------- | ----------------- |
|
|
142
|
+
| 1 | Functional | Max steps per workflow? | Answered | 20 steps maximum |
|
|
143
|
+
| 2 | Technical | Use existing store or new? | Open | - |
|
|
144
|
+
| 3 | NFR | Required response time? | Assumed | <500ms (validate) |
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Status Legend**:
|
|
148
|
+
|
|
149
|
+
- **Open**: Awaiting answer
|
|
150
|
+
- **Answered**: Response received
|
|
151
|
+
- **Assumed**: Made assumption (needs validation)
|
|
152
|
+
- **Blocked**: Cannot proceed without answer
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### Step 4: Document Requirements
|
|
157
|
+
|
|
158
|
+
Categorize requirements as they are gathered:
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
## Requirements Gathered
|
|
162
|
+
|
|
163
|
+
### Functional Requirements
|
|
164
|
+
- [FR-1]: [Description] (Source: [document or user])
|
|
165
|
+
|
|
166
|
+
### Non-Functional Requirements
|
|
167
|
+
- [NFR-1]: [Description]
|
|
168
|
+
|
|
169
|
+
### Constraints
|
|
170
|
+
- [C-1]: [Description]
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### Step 5: Identify Technical Considerations
|
|
176
|
+
|
|
177
|
+
Document high-level technical insights (NO implementation code):
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
## Technical Considerations
|
|
181
|
+
|
|
182
|
+
### Architecture Fit
|
|
183
|
+
- [How this fits into existing system]
|
|
184
|
+
|
|
185
|
+
### Dependencies
|
|
186
|
+
- [What this relies on]
|
|
187
|
+
|
|
188
|
+
### Patterns to Apply
|
|
189
|
+
- [Relevant patterns from cursor rules]
|
|
190
|
+
|
|
191
|
+
### Challenges Identified
|
|
192
|
+
- [Potential difficulties]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### Step 6: Propose High-Level Approach
|
|
198
|
+
|
|
199
|
+
Suggest an approach based on findings (NO implementation code):
|
|
200
|
+
|
|
201
|
+
```markdown
|
|
202
|
+
## Proposed Approach
|
|
203
|
+
|
|
204
|
+
Based on the requirements gathered, I recommend:
|
|
205
|
+
|
|
206
|
+
1. [High-level approach point 1]
|
|
207
|
+
2. [High-level approach point 2]
|
|
208
|
+
|
|
209
|
+
### Alternative Approaches Considered
|
|
210
|
+
|
|
211
|
+
| Approach | Pros | Cons | Recommendation |
|
|
212
|
+
| -------- | ---- | ---- | -------------- |
|
|
213
|
+
| [A] | ... | ... | Yes/No |
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
### Step 7: Document Risks and Unknowns
|
|
219
|
+
|
|
220
|
+
Capture risks discovered:
|
|
221
|
+
|
|
222
|
+
```markdown
|
|
223
|
+
## Risks and Unknowns
|
|
224
|
+
|
|
225
|
+
### Risks
|
|
226
|
+
|
|
227
|
+
| Risk | Impact | Likelihood | Mitigation |
|
|
228
|
+
| ---- | ------ | ---------- | ---------- |
|
|
229
|
+
| ... | ... | ... | ... |
|
|
230
|
+
|
|
231
|
+
### Unknowns (Require Further Investigation)
|
|
232
|
+
- [ ] [Unknown item]
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
### Step 8: Generate Discovery Document
|
|
238
|
+
|
|
239
|
+
Create the discovery markdown file:
|
|
240
|
+
|
|
241
|
+
**Location**: `flow/discovery/discovery_<feature_name>_v<version>.md`
|
|
242
|
+
|
|
243
|
+
**Use Template**: See `.cursor/rules/patterns/discovery-templates.mdc`
|
|
244
|
+
|
|
245
|
+
**Required Sections**:
|
|
246
|
+
|
|
247
|
+
1. Context
|
|
248
|
+
2. Referenced Documents
|
|
249
|
+
3. Requirements Gathered (FR, NFR, Constraints)
|
|
250
|
+
4. Open Questions (all answered)
|
|
251
|
+
5. Technical Considerations
|
|
252
|
+
6. Proposed Approach
|
|
253
|
+
7. Risks and Unknowns
|
|
254
|
+
8. Next Steps
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Output Format
|
|
259
|
+
|
|
260
|
+
The discovery document should follow the template in `.cursor/rules/patterns/discovery-templates.mdc`.
|
|
261
|
+
|
|
262
|
+
**Naming Convention**: `discovery_<feature_name>_v<version>.md`
|
|
263
|
+
|
|
264
|
+
**Examples**:
|
|
265
|
+
- `discovery_workflow_editor_v1.md`
|
|
266
|
+
- `discovery_user_authentication_v1.md`
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Validation Checklist
|
|
271
|
+
|
|
272
|
+
Before completing discovery, verify:
|
|
273
|
+
|
|
274
|
+
- [ ] All referenced documents have been read
|
|
275
|
+
- [ ] Document is saved in `flow/discovery/` folder
|
|
276
|
+
- [ ] File uses correct naming convention
|
|
277
|
+
- [ ] Open questions table has no "Blocked" status
|
|
278
|
+
- [ ] Requirements are categorized (FR, NFR, Constraints)
|
|
279
|
+
- [ ] Technical considerations are documented
|
|
280
|
+
- [ ] Risks and unknowns are identified
|
|
281
|
+
- [ ] Proposed approach is documented (high-level only)
|
|
282
|
+
- [ ] Next steps are defined (pointing to `/create-plan`)
|
|
283
|
+
- [ ] **NO implementation code is included**
|
|
284
|
+
- [ ] **NO source files were created or modified**
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Related Files
|
|
289
|
+
|
|
290
|
+
| File | Purpose |
|
|
291
|
+
| ------------------------------------------------- | --------------------------------- |
|
|
292
|
+
| `.cursor/rules/patterns/discovery-patterns.mdc` | Rules and patterns for discovery |
|
|
293
|
+
| `.cursor/rules/patterns/discovery-templates.mdc` | Document templates |
|
|
294
|
+
| `.cursor/rules/tools/interactive-questions-tool.mdc` | Interactive Questions UI workflow |
|
|
295
|
+
| `flow/discovery/` | Output folder for discovery docs |
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Include when /execute-plan is invoked or phase-by-phase plan execution is needed"
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Execute Plan Skill
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Execute an implementation plan **phase by phase**, using complexity scores to determine execution strategy. Each phase triggers **Plan mode** for collaborative design before implementation.
|
|
11
|
+
|
|
12
|
+
This skill **implements the plan** by:
|
|
13
|
+
|
|
14
|
+
- Reading and parsing the plan file
|
|
15
|
+
- Grouping phases by complexity
|
|
16
|
+
- Switching to Plan mode for each phase
|
|
17
|
+
- Implementing after user approval
|
|
18
|
+
- Updating progress in the plan file
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## CRITICAL RULE: Build Verification ONLY at the End
|
|
23
|
+
|
|
24
|
+
**DO NOT run `npm run build` after each phase or group.**
|
|
25
|
+
|
|
26
|
+
**`npm run build` and `npm run test` MUST ONLY be executed at the very end, after ALL phases (including Tests) are complete.**
|
|
27
|
+
|
|
28
|
+
**Why**:
|
|
29
|
+
|
|
30
|
+
- Running build after each phase wastes time and breaks flow
|
|
31
|
+
- Intermediate phases may have temporary type errors that get resolved in later phases
|
|
32
|
+
- The final build verification ensures everything works together
|
|
33
|
+
|
|
34
|
+
**The ONLY time to run build/test**:
|
|
35
|
+
|
|
36
|
+
- After ALL phases are complete → `npm run build && npm run test`
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## CRITICAL RULE: No Direct Database or ORM Commands
|
|
41
|
+
|
|
42
|
+
**NEVER execute any ORM or database commands directly. ALWAYS ask the user to run them manually.**
|
|
43
|
+
|
|
44
|
+
### Forbidden Commands (NEVER execute directly)
|
|
45
|
+
|
|
46
|
+
| Category | Commands |
|
|
47
|
+
| --------------- | ----------------------------------------------------- |
|
|
48
|
+
| **Prisma** | `prisma migrate`, `prisma db push`, `prisma db seed` |
|
|
49
|
+
| **Django** | `python manage.py migrate`, `python manage.py dbshell`|
|
|
50
|
+
| **Alembic** | `alembic upgrade`, `alembic downgrade` |
|
|
51
|
+
| **Sequelize** | `sequelize db:migrate`, `sequelize db:seed` |
|
|
52
|
+
| **TypeORM** | `typeorm migration:run`, `typeorm migration:revert` |
|
|
53
|
+
| **Drizzle** | `drizzle-kit push`, `drizzle-kit drop` |
|
|
54
|
+
| **Raw SQL** | Any direct SQL execution, psql, mysql, sqlite3 |
|
|
55
|
+
| **Connections** | Any database connection or query commands |
|
|
56
|
+
|
|
57
|
+
### When Database Commands Are Needed
|
|
58
|
+
|
|
59
|
+
**ALWAYS present the command to the user and wait for confirmation:**
|
|
60
|
+
|
|
61
|
+
```markdown
|
|
62
|
+
## Action Required: Database Migration
|
|
63
|
+
|
|
64
|
+
The following command needs to be executed manually:
|
|
65
|
+
|
|
66
|
+
\`\`\`bash
|
|
67
|
+
[command here]
|
|
68
|
+
\`\`\`
|
|
69
|
+
|
|
70
|
+
**Why manual execution is required:**
|
|
71
|
+
- Database operations can be destructive and irreversible
|
|
72
|
+
- User should review the migration before applying
|
|
73
|
+
- Prevents accidental data loss in development/production
|
|
74
|
+
|
|
75
|
+
Please run this command and let me know when it's complete, or if you encounter any issues.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Safe Commands (CAN be executed directly)
|
|
79
|
+
|
|
80
|
+
| Command | Why It's Safe |
|
|
81
|
+
| --------------------- | ------------------------------------------ |
|
|
82
|
+
| `prisma generate` | Only generates client code, no DB changes |
|
|
83
|
+
| `prisma format` | Only formats schema file |
|
|
84
|
+
| `prisma validate` | Only validates schema |
|
|
85
|
+
| Reading schema files | Read-only operation |
|
|
86
|
+
|
|
87
|
+
### Why This Rule Exists
|
|
88
|
+
|
|
89
|
+
1. **Data Safety**: Database migrations can delete or modify data
|
|
90
|
+
2. **Reversibility**: Some operations cannot be undone
|
|
91
|
+
3. **Environment Awareness**: User knows if this is dev/staging/prod
|
|
92
|
+
4. **Verification**: User can review the migration before applying
|
|
93
|
+
5. **Error Handling**: User can handle errors appropriately
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Inputs
|
|
98
|
+
|
|
99
|
+
| Input | Required | Description |
|
|
100
|
+
| ----------- | -------- | ------------------------------------ |
|
|
101
|
+
| `plan_file` | Yes | Path to plan file in `flow/plans/` |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Workflow
|
|
106
|
+
|
|
107
|
+
### Step 1: Parse the Plan
|
|
108
|
+
|
|
109
|
+
1. Read the specified plan file
|
|
110
|
+
2. Parse all phases with their complexity scores and tasks
|
|
111
|
+
3. Validate that all phases have complexity scores
|
|
112
|
+
|
|
113
|
+
**Important**: NEVER read or reference files in `flow/archive/` - these are outdated plans.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### Step 2: Analyze Complexity and Determine Execution Strategy
|
|
118
|
+
|
|
119
|
+
Parse each phase and calculate execution groups based on complexity scores:
|
|
120
|
+
|
|
121
|
+
**Execution Strategy Rules**:
|
|
122
|
+
|
|
123
|
+
| Total Adjacent Score | Execution Strategy |
|
|
124
|
+
| -------------------- | ----------------------------------------------------------- |
|
|
125
|
+
| ≤ 6 | **Aggregate**: Execute multiple phases together in one pass |
|
|
126
|
+
| 7-10 | **Cautious**: Execute 1-2 phases, then continue |
|
|
127
|
+
| > 10 | **Sequential**: Execute one phase at a time |
|
|
128
|
+
|
|
129
|
+
**Aggregation Rules**:
|
|
130
|
+
|
|
131
|
+
1. **Can aggregate** phases when their combined complexity ≤ 6
|
|
132
|
+
2. **Never aggregate** across a phase with complexity ≥ 8
|
|
133
|
+
3. **Always execute separately**: Tests phase (regardless of score)
|
|
134
|
+
4. **Prefer aggregation** for trivial consecutive phases (0-2 each)
|
|
135
|
+
|
|
136
|
+
**Example Analysis**:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
Phase 1: Types and Schemas - Complexity: 3/10
|
|
140
|
+
Phase 2: Utility Functions - Complexity: 2/10
|
|
141
|
+
Phase 3: API Route - Complexity: 7/10
|
|
142
|
+
Phase 4: UI Components - Complexity: 6/10
|
|
143
|
+
Phase 5: Integration - Complexity: 4/10
|
|
144
|
+
Phase 6: Tests - Complexity: 5/10
|
|
145
|
+
|
|
146
|
+
Execution Groups:
|
|
147
|
+
|
|
148
|
+
- Group 1: Phase 1 + Phase 2 (combined: 5) → Aggregate
|
|
149
|
+
- Group 2: Phase 3 (7) → Execute alone
|
|
150
|
+
- Group 3: Phase 4 + Phase 5 (combined: 10) → Execute together
|
|
151
|
+
- Group 4: Phase 6 (Tests) → Always separate
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### Step 3: Present Execution Plan Summary
|
|
157
|
+
|
|
158
|
+
Before starting, present the execution plan to the user:
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
## Execution Plan Summary
|
|
162
|
+
|
|
163
|
+
**Plan**: [Plan Name]
|
|
164
|
+
**Total Phases**: X
|
|
165
|
+
**Total Complexity**: XX/XX
|
|
166
|
+
|
|
167
|
+
### Execution Groups:
|
|
168
|
+
|
|
169
|
+
| Group | Phases | Combined Complexity | Strategy |
|
|
170
|
+
| ----- | ---------------- | ------------------- | ---------- |
|
|
171
|
+
| 1 | Phase 1, Phase 2 | 5/10 | Aggregate |
|
|
172
|
+
| 2 | Phase 3 | 7/10 | Sequential |
|
|
173
|
+
| 3 | Phase 4, Phase 5 | 10/10 | Cautious |
|
|
174
|
+
| 4 | Phase 6 (Tests) | 5/10 | Sequential |
|
|
175
|
+
|
|
176
|
+
**Build Verification**: Only at the end, after ALL phases complete
|
|
177
|
+
|
|
178
|
+
Ready to begin execution?
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Wait for user confirmation before proceeding.
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
### Step 4: Execute Each Phase with Plan Mode
|
|
186
|
+
|
|
187
|
+
**CRITICAL RULE**: Use the [Plan Mode Tool](../tools/plan-mode-tool.mdc) to switch to Plan mode for **EACH individual phase**.
|
|
188
|
+
|
|
189
|
+
**REMINDER**: Do NOT run `npm run build` between phases.
|
|
190
|
+
|
|
191
|
+
**For Each Phase**:
|
|
192
|
+
|
|
193
|
+
1. **Auto-switch to Plan mode** - Call `SwitchMode` tool
|
|
194
|
+
2. **Present phase details** - Show scope, tasks, and approach
|
|
195
|
+
3. **Wait for approval** - Get user confirmation
|
|
196
|
+
4. **Implement** - Execute the phase following approved approach
|
|
197
|
+
5. **Update progress** - Mark tasks complete in plan file
|
|
198
|
+
6. **Continue to next phase** - NO BUILD between phases
|
|
199
|
+
|
|
200
|
+
**Phase Presentation Template**:
|
|
201
|
+
|
|
202
|
+
```markdown
|
|
203
|
+
## Phase Execution: Phase X - [Phase Name]
|
|
204
|
+
|
|
205
|
+
**Complexity**: X/10
|
|
206
|
+
**Scope**: [Phase scope description]
|
|
207
|
+
|
|
208
|
+
### Tasks to Complete:
|
|
209
|
+
- [ ] Task 1
|
|
210
|
+
- [ ] Task 2
|
|
211
|
+
- [ ] Task 3
|
|
212
|
+
|
|
213
|
+
### Implementation Approach:
|
|
214
|
+
[Discuss the approach, patterns to follow, and any decisions needed]
|
|
215
|
+
|
|
216
|
+
### Cursor Rules Checklist:
|
|
217
|
+
- [ ] Following allowed patterns
|
|
218
|
+
- [ ] Avoiding forbidden patterns
|
|
219
|
+
- [ ] Using appropriate language patterns
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
**Ready to implement this phase?**
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
### Step 5: Update Progress After Each Phase
|
|
229
|
+
|
|
230
|
+
Mark completed tasks in the plan file:
|
|
231
|
+
|
|
232
|
+
```markdown
|
|
233
|
+
- [x] Task 1
|
|
234
|
+
- [x] Task 2
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Then continue to the next phase (NO BUILD HERE).
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
### Step 6: Handle Tests Phase
|
|
242
|
+
|
|
243
|
+
The Tests phase is **always executed separately**, regardless of complexity score:
|
|
244
|
+
|
|
245
|
+
1. Switch to Plan mode
|
|
246
|
+
2. Present the testing strategy
|
|
247
|
+
3. Discuss test coverage and edge cases
|
|
248
|
+
4. Get user approval
|
|
249
|
+
5. Implement tests
|
|
250
|
+
6. **DO NOT run tests yet** - Continue to Step 7
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
### Step 7: Completion - Build and Test Verification
|
|
255
|
+
|
|
256
|
+
**This is the ONLY place where build and tests are run.**
|
|
257
|
+
|
|
258
|
+
After ALL phases are complete (including Tests phase):
|
|
259
|
+
|
|
260
|
+
1. **Run final verification**:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
npm run build && npm run test
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
2. **Handle failures**:
|
|
267
|
+
- If build fails: Fix the issue, re-run verification
|
|
268
|
+
- If tests fail: Fix the issue, re-run verification
|
|
269
|
+
- Only proceed after everything passes
|
|
270
|
+
|
|
271
|
+
3. **Present summary** of completed work
|
|
272
|
+
|
|
273
|
+
4. **List all key changes** made
|
|
274
|
+
|
|
275
|
+
5. **Ask if the plan should be archived**:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
mv flow/plans/plan_feature_name_v1.md flow/archive/
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Execution Flow Within a Group
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
Group 1: Phase 1 + Phase 2 (combined complexity: 5)
|
|
287
|
+
│
|
|
288
|
+
├── AUTO-SWITCH to Plan Mode for Phase 1
|
|
289
|
+
├── Present Phase 1 details
|
|
290
|
+
├── Get user approval
|
|
291
|
+
├── Implement Phase 1
|
|
292
|
+
├── Update Phase 1 progress in plan file
|
|
293
|
+
│
|
|
294
|
+
├── AUTO-SWITCH to Plan Mode for Phase 2
|
|
295
|
+
├── Present Phase 2 details
|
|
296
|
+
├── Get user approval
|
|
297
|
+
├── Implement Phase 2
|
|
298
|
+
├── Update Phase 2 progress in plan file
|
|
299
|
+
│
|
|
300
|
+
└── Continue to next group (NO BUILD HERE)
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## Complexity-Based Behavior
|
|
306
|
+
|
|
307
|
+
### Low Complexity Phases (0-4)
|
|
308
|
+
|
|
309
|
+
- Can be grouped with adjacent low-complexity phases
|
|
310
|
+
- Still requires Plan mode for each individual phase
|
|
311
|
+
- Quick planning discussion
|
|
312
|
+
- Focus on consistency with existing patterns
|
|
313
|
+
|
|
314
|
+
### Medium Complexity Phases (5-6)
|
|
315
|
+
|
|
316
|
+
- May be grouped if combined score ≤ 6
|
|
317
|
+
- Moderate planning discussion
|
|
318
|
+
- Review key decisions and patterns
|
|
319
|
+
|
|
320
|
+
### High Complexity Phases (7-8)
|
|
321
|
+
|
|
322
|
+
- Execute alone or with one adjacent phase if combined ≤ 10
|
|
323
|
+
- Detailed planning discussion
|
|
324
|
+
- Consider multiple approaches
|
|
325
|
+
|
|
326
|
+
### Very High Complexity Phases (9-10)
|
|
327
|
+
|
|
328
|
+
- **Always execute alone**
|
|
329
|
+
- Extensive planning discussion
|
|
330
|
+
- Break down into sub-tasks if needed
|
|
331
|
+
- Consider spikes or prototypes first
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Error Handling
|
|
336
|
+
|
|
337
|
+
### Build Failures (at Completion)
|
|
338
|
+
|
|
339
|
+
If `npm run build` fails at Step 7:
|
|
340
|
+
|
|
341
|
+
1. Analyze the error
|
|
342
|
+
2. Determine which phase introduced the issue
|
|
343
|
+
3. Fix the issue
|
|
344
|
+
4. Re-run build verification
|
|
345
|
+
5. Only complete after successful build
|
|
346
|
+
|
|
347
|
+
### Test Failures (at Completion)
|
|
348
|
+
|
|
349
|
+
If `npm run test` fails at Step 7:
|
|
350
|
+
|
|
351
|
+
1. Analyze failing tests
|
|
352
|
+
2. Determine if it's a test issue or implementation bug
|
|
353
|
+
3. Fix the issue
|
|
354
|
+
4. Re-run tests
|
|
355
|
+
5. Only complete after all tests pass
|
|
356
|
+
|
|
357
|
+
### User Cancellation
|
|
358
|
+
|
|
359
|
+
If the user wants to stop execution:
|
|
360
|
+
|
|
361
|
+
1. Save current progress in the plan file
|
|
362
|
+
2. Note which phases are complete
|
|
363
|
+
3. The plan can be resumed later from the last completed phase
|
|
364
|
+
4. When resuming, run build verification first
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Summary of Key Rules
|
|
369
|
+
|
|
370
|
+
| Rule | Description |
|
|
371
|
+
| ---------------------------- | ----------------------------------------------------------- |
|
|
372
|
+
| **Auto-switch to Plan mode** | Switch immediately for each phase, no asking |
|
|
373
|
+
| **Build ONLY at end** | `npm run build && npm run test` runs once, after ALL phases |
|
|
374
|
+
| **No intermediate builds** | Never run build between phases or groups |
|
|
375
|
+
| **Tests phase separate** | Always execute Tests phase individually |
|
|
376
|
+
| **Update progress** | Mark tasks complete in plan file after each phase |
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## Related Files
|
|
381
|
+
|
|
382
|
+
| File | Purpose |
|
|
383
|
+
| ------------------------------------------- | -------------------------------- |
|
|
384
|
+
| `.cursor/rules/patterns/plans-patterns.mdc` | Plan patterns and rules |
|
|
385
|
+
| `.cursor/rules/core/complexity-scoring.mdc` | Complexity scoring system |
|
|
386
|
+
| `.cursor/rules/tools/plan-mode-tool.mdc` | Plan mode switching instructions |
|
|
387
|
+
| `flow/plans/` | Input plan documents |
|
|
388
|
+
| `flow/archive/` | Completed plans destination |
|