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,235 @@
|
|
|
1
|
+
# Interactive Questions Tool for Claude Code
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Provides a standardized way to ask interactive questions using Claude Code's native `AskUserQuestion` tool. This tool presents structured questions with multiple-choice options to gather requirements and confirm decisions.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
This tool is used by:
|
|
10
|
+
- Discovery commands that need to gather requirements from users
|
|
11
|
+
- Skills that require user input before proceeding
|
|
12
|
+
- Any process that needs interactive question-answer sessions
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## How to Use Interactive Questions in Claude Code
|
|
17
|
+
|
|
18
|
+
Claude Code has a native `AskUserQuestion` tool that presents structured questions to users. Use this for gathering requirements and confirming patterns.
|
|
19
|
+
|
|
20
|
+
### Using the AskUserQuestion Tool
|
|
21
|
+
|
|
22
|
+
When you need to ask the user questions, use the `AskUserQuestion` tool with structured options:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// Example: Ask about feature requirements
|
|
26
|
+
AskUserQuestion({
|
|
27
|
+
questions: [{
|
|
28
|
+
question: "What is the primary user action for this feature?",
|
|
29
|
+
header: "Action",
|
|
30
|
+
options: [
|
|
31
|
+
{ label: "Create new items", description: "Users will create new data entries" },
|
|
32
|
+
{ label: "View existing items", description: "Users will browse and view data" },
|
|
33
|
+
{ label: "Edit existing items", description: "Users will modify existing data" },
|
|
34
|
+
{ label: "Delete items", description: "Users will remove data entries" }
|
|
35
|
+
],
|
|
36
|
+
multiSelect: false
|
|
37
|
+
}]
|
|
38
|
+
})
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Question Format
|
|
42
|
+
|
|
43
|
+
Each question object has these properties:
|
|
44
|
+
|
|
45
|
+
| Property | Required | Description |
|
|
46
|
+
|----------|----------|-------------|
|
|
47
|
+
| `question` | Yes | The complete question text |
|
|
48
|
+
| `header` | Yes | Short label (max 12 chars) for the question |
|
|
49
|
+
| `options` | Yes | Array of 2-4 choices |
|
|
50
|
+
| `multiSelect` | No | Set to `true` to allow multiple selections |
|
|
51
|
+
|
|
52
|
+
### Option Format
|
|
53
|
+
|
|
54
|
+
Each option in the options array has:
|
|
55
|
+
|
|
56
|
+
| Property | Required | Description |
|
|
57
|
+
|----------|----------|-------------|
|
|
58
|
+
| `label` | Yes | Short display text (1-5 words) |
|
|
59
|
+
| `description` | Yes | Explanation of what this option means |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Workflow for Gathering Requirements
|
|
64
|
+
|
|
65
|
+
### Step 1: Present Context First
|
|
66
|
+
|
|
67
|
+
Before asking questions, summarize what you've learned:
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
## Analysis Summary
|
|
71
|
+
|
|
72
|
+
I've analyzed the codebase and found:
|
|
73
|
+
|
|
74
|
+
**Stack**: TypeScript + Next.js
|
|
75
|
+
**Key Libraries**: Zod, Prisma, Zustand
|
|
76
|
+
**Architecture**: Feature-based organization
|
|
77
|
+
|
|
78
|
+
Now I'll ask a few questions to confirm these patterns.
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Step 2: Ask Questions
|
|
82
|
+
|
|
83
|
+
Use the `AskUserQuestion` tool to present questions. You can ask up to 4 questions at once.
|
|
84
|
+
|
|
85
|
+
**Example for Stack Confirmation**:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
AskUserQuestion({
|
|
89
|
+
questions: [{
|
|
90
|
+
question: "I detected the following stack. Is this accurate?",
|
|
91
|
+
header: "Stack",
|
|
92
|
+
options: [
|
|
93
|
+
{ label: "Yes, correct", description: "The detected stack matches our project" },
|
|
94
|
+
{ label: "Partially correct", description: "Some details need adjustment" },
|
|
95
|
+
{ label: "No, different", description: "Let me describe our actual stack" }
|
|
96
|
+
],
|
|
97
|
+
multiSelect: false
|
|
98
|
+
}]
|
|
99
|
+
})
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Example for Pattern Enforcement**:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
AskUserQuestion({
|
|
106
|
+
questions: [{
|
|
107
|
+
question: "Which coding patterns should I enforce when generating code?",
|
|
108
|
+
header: "Patterns",
|
|
109
|
+
options: [
|
|
110
|
+
{ label: "All detected (Recommended)", description: "Enforce all patterns I found in the codebase" },
|
|
111
|
+
{ label: "Let me review", description: "Show me the patterns first and I'll select which to keep" },
|
|
112
|
+
{ label: "Describe preferred", description: "These are legacy patterns, I'll describe new ones" }
|
|
113
|
+
],
|
|
114
|
+
multiSelect: false
|
|
115
|
+
}]
|
|
116
|
+
})
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Example for Strictness Level**:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
AskUserQuestion({
|
|
123
|
+
questions: [{
|
|
124
|
+
question: "How strictly should patterns be enforced?",
|
|
125
|
+
header: "Strictness",
|
|
126
|
+
options: [
|
|
127
|
+
{ label: "Strict", description: "Always follow patterns exactly, no exceptions" },
|
|
128
|
+
{ label: "Moderate (Recommended)", description: "Follow patterns but allow justified exceptions" },
|
|
129
|
+
{ label: "Loose", description: "Use as guidelines, not strict requirements" }
|
|
130
|
+
],
|
|
131
|
+
multiSelect: false
|
|
132
|
+
}]
|
|
133
|
+
})
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Step 3: Wait for Responses
|
|
137
|
+
|
|
138
|
+
After calling `AskUserQuestion`, wait for the user to respond before proceeding. The tool will return the selected option(s).
|
|
139
|
+
|
|
140
|
+
### Step 4: Process Responses
|
|
141
|
+
|
|
142
|
+
Use the selected answers to inform your next actions:
|
|
143
|
+
|
|
144
|
+
1. Extract the selected options from the response
|
|
145
|
+
2. Map them to corresponding actions
|
|
146
|
+
3. Document the confirmed decisions
|
|
147
|
+
4. Proceed with the workflow based on user choices
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## When to Use Interactive Questions
|
|
152
|
+
|
|
153
|
+
### Use For:
|
|
154
|
+
|
|
155
|
+
1. **Discovery Phase**: Gathering requirements and clarifying unknowns
|
|
156
|
+
2. **Planning Phase**: Understanding scope, priorities, and constraints
|
|
157
|
+
3. **Critical Decisions**: When user input is required before proceeding
|
|
158
|
+
4. **Pattern Confirmation**: Confirming detected patterns during setup
|
|
159
|
+
5. **Complex Choices**: When options need to be clearly presented
|
|
160
|
+
|
|
161
|
+
### Don't Use For:
|
|
162
|
+
|
|
163
|
+
1. **Simple Yes/No Questions**: Just ask in regular conversation
|
|
164
|
+
2. **Single Simple Questions**: Regular conversation is faster
|
|
165
|
+
3. **Information Already Available**: Don't ask if you can find the answer
|
|
166
|
+
4. **Read-Only Operations**: No questions needed for reading/searching
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Question Guidelines
|
|
171
|
+
|
|
172
|
+
### Good Questions
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
// Clear, specific, with context
|
|
176
|
+
AskUserQuestion({
|
|
177
|
+
questions: [{
|
|
178
|
+
question: "Where should the new button be placed in the navigation?",
|
|
179
|
+
header: "Placement",
|
|
180
|
+
options: [
|
|
181
|
+
{ label: "Before Library", description: "Insert before the Library menu item" },
|
|
182
|
+
{ label: "After Library", description: "Insert after the Library menu item" },
|
|
183
|
+
{ label: "Separate toolbar", description: "Create a new toolbar for this action" },
|
|
184
|
+
{ label: "Dropdown menu", description: "Add as an option in an existing dropdown" }
|
|
185
|
+
],
|
|
186
|
+
multiSelect: false
|
|
187
|
+
}]
|
|
188
|
+
})
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Avoid
|
|
192
|
+
|
|
193
|
+
- Questions that are too vague ("What do you want?")
|
|
194
|
+
- Too many options (stick to 2-4)
|
|
195
|
+
- Options without clear descriptions
|
|
196
|
+
- Asking about things you can determine from code
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Multiple Questions at Once
|
|
201
|
+
|
|
202
|
+
You can ask up to 4 related questions in a single call:
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
AskUserQuestion({
|
|
206
|
+
questions: [
|
|
207
|
+
{
|
|
208
|
+
question: "Is the detected tech stack correct?",
|
|
209
|
+
header: "Stack",
|
|
210
|
+
options: [
|
|
211
|
+
{ label: "Yes, correct", description: "All detected technologies are accurate" },
|
|
212
|
+
{ label: "Needs adjustment", description: "Some corrections needed" }
|
|
213
|
+
],
|
|
214
|
+
multiSelect: false
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
question: "Which patterns should be enforced?",
|
|
218
|
+
header: "Patterns",
|
|
219
|
+
options: [
|
|
220
|
+
{ label: "All detected", description: "Enforce all patterns found" },
|
|
221
|
+
{ label: "Review first", description: "Let me review before deciding" }
|
|
222
|
+
],
|
|
223
|
+
multiSelect: false
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
})
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Related Rules
|
|
232
|
+
|
|
233
|
+
- Discovery patterns: `.claude/rules/patterns/discovery-patterns.md`
|
|
234
|
+
- Plan patterns: `.claude/rules/patterns/plans-patterns.md`
|
|
235
|
+
- Setup skill: `.claude/skills/setup/SKILL.md`
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
|
|
2
|
+
## Running Tests
|
|
3
|
+
|
|
4
|
+
```bash
|
|
5
|
+
# Run all tests
|
|
6
|
+
npm run test
|
|
7
|
+
|
|
8
|
+
# Run tests in watch mode
|
|
9
|
+
npm run test -- --watch
|
|
10
|
+
|
|
11
|
+
# Run specific test file
|
|
12
|
+
npm run test -- src/commands/streamChatCommand.server.test.ts
|
|
13
|
+
|
|
14
|
+
# Run tests matching pattern
|
|
15
|
+
npm run test -- --testNamePattern="chat validation"
|
|
16
|
+
|
|
17
|
+
# Run with coverage
|
|
18
|
+
npm run test -- --coverage
|
|
19
|
+
|
|
20
|
+
# Run only changed files
|
|
21
|
+
npm run test -- --onlyChanged
|
|
22
|
+
|
|
23
|
+
# Run with verbose output
|
|
24
|
+
npm run test -- --verbose
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Coverage Commands
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Generate coverage report
|
|
33
|
+
npm run test -- --coverage
|
|
34
|
+
|
|
35
|
+
# Generate HTML coverage report
|
|
36
|
+
npm run test -- --coverage --coverageReporters="html"
|
|
37
|
+
|
|
38
|
+
# Check coverage thresholds
|
|
39
|
+
npm run test -- --coverage --coverageThreshold='{"global":{"branches":80,"functions":80,"lines":80}}'
|
|
40
|
+
|
|
41
|
+
# Coverage for specific files
|
|
42
|
+
npm run test -- --coverage --collectCoverageFrom="src/commands/**/*.ts"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Debugging Tests
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Run with Node debugger
|
|
51
|
+
node --inspect-brk node_modules/.bin/jest --runInBand
|
|
52
|
+
|
|
53
|
+
# Run single test for debugging
|
|
54
|
+
npm run test -- --runInBand --testNamePattern="specific test name"
|
|
55
|
+
|
|
56
|
+
# Show why tests are slow
|
|
57
|
+
npm run test -- --detectOpenHandles
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## CI/CD Commands
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Run in CI mode (no watch, fail on console errors)
|
|
66
|
+
npm run test -- --ci
|
|
67
|
+
|
|
68
|
+
# Run with JUnit reporter for CI
|
|
69
|
+
npm run test -- --ci --reporters=default --reporters=jest-junit
|
|
70
|
+
|
|
71
|
+
# Run with max workers for parallel execution
|
|
72
|
+
npm run test -- --maxWorkers=4
|
|
73
|
+
```
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Plan Mode for Claude Code
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Claude Code has a native plan mode that enables collaborative planning before implementation. This tool provides guidance on using plan mode effectively for structured development workflows.
|
|
6
|
+
|
|
7
|
+
## When to Use Plan Mode
|
|
8
|
+
|
|
9
|
+
### Use the `EnterPlanMode` Tool For:
|
|
10
|
+
|
|
11
|
+
1. **Implementation Tasks**: Before implementing features that require architectural decisions
|
|
12
|
+
2. **High Complexity Tasks**: Before tasks with complexity score >= 7
|
|
13
|
+
3. **Multi-File Changes**: When changes will affect multiple files
|
|
14
|
+
4. **New Features**: When adding new functionality that requires planning
|
|
15
|
+
5. **Critical Decisions**: Before making architectural or design decisions
|
|
16
|
+
|
|
17
|
+
### Don't Use Plan Mode For:
|
|
18
|
+
|
|
19
|
+
1. **Simple Fixes**: Single-line changes, typos, obvious bugs
|
|
20
|
+
2. **Read-Only Operations**: Reading files, searching codebase
|
|
21
|
+
3. **Information Gathering**: Discovery, analysis, documentation
|
|
22
|
+
4. **Trivial Tasks**: Tasks with complexity <= 2
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## How to Use Plan Mode in Claude Code
|
|
27
|
+
|
|
28
|
+
### Entering Plan Mode
|
|
29
|
+
|
|
30
|
+
Use the `EnterPlanMode` tool when you need to plan before implementing:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
// When starting a non-trivial implementation task
|
|
34
|
+
EnterPlanMode()
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Claude Code will then allow you to:
|
|
38
|
+
1. Explore the codebase using Glob, Grep, and Read tools
|
|
39
|
+
2. Design an implementation approach
|
|
40
|
+
3. Present your plan to the user for approval
|
|
41
|
+
4. Exit plan mode with `ExitPlanMode` when ready to implement
|
|
42
|
+
|
|
43
|
+
### Plan Mode Workflow
|
|
44
|
+
|
|
45
|
+
1. **Enter Plan Mode**: Call `EnterPlanMode` for implementation tasks
|
|
46
|
+
2. **Explore**: Use read-only tools to understand the codebase
|
|
47
|
+
3. **Design**: Create a structured implementation plan
|
|
48
|
+
4. **Present**: Show the plan to the user
|
|
49
|
+
5. **Clarify**: Use `AskUserQuestion` if you need decisions
|
|
50
|
+
6. **Exit**: Call `ExitPlanMode` when the plan is ready for implementation
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Phase Execution Pattern
|
|
55
|
+
|
|
56
|
+
When executing implementation plan phases, follow this pattern:
|
|
57
|
+
|
|
58
|
+
### Step 1: Present Phase Details
|
|
59
|
+
|
|
60
|
+
Before implementing each phase, present the details:
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
## Implementing Phase X: [Phase Name]
|
|
64
|
+
|
|
65
|
+
**Complexity**: X/10
|
|
66
|
+
**Scope**: [Phase scope description]
|
|
67
|
+
|
|
68
|
+
### Tasks to Complete:
|
|
69
|
+
- [ ] Task 1
|
|
70
|
+
- [ ] Task 2
|
|
71
|
+
- [ ] Task 3
|
|
72
|
+
|
|
73
|
+
### Implementation Approach:
|
|
74
|
+
[Describe the approach, patterns to follow, and any decisions needed]
|
|
75
|
+
|
|
76
|
+
### Patterns to Follow:
|
|
77
|
+
- [Pattern 1 from project rules]
|
|
78
|
+
- [Pattern 2 from project rules]
|
|
79
|
+
|
|
80
|
+
**Proceeding with implementation...**
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Step 2: Implement
|
|
84
|
+
|
|
85
|
+
Proceed with implementation following the discussed approach.
|
|
86
|
+
|
|
87
|
+
### Step 3: Update Progress
|
|
88
|
+
|
|
89
|
+
Mark completed tasks in the plan file after completing the phase.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Integration with Execute Plan Command
|
|
94
|
+
|
|
95
|
+
When executing a plan created by `/create-plan`:
|
|
96
|
+
|
|
97
|
+
1. **Read the plan file** to understand phases and complexity scores
|
|
98
|
+
2. **For each phase**:
|
|
99
|
+
- Present phase details and approach
|
|
100
|
+
- Implement the phase following project patterns
|
|
101
|
+
- Update the plan file to mark tasks complete
|
|
102
|
+
3. **Run verification** only at the very end (not between phases)
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Complexity-Based Execution Strategy
|
|
107
|
+
|
|
108
|
+
Based on complexity scores from the plan:
|
|
109
|
+
|
|
110
|
+
| Combined Score | Strategy |
|
|
111
|
+
|---------------|----------|
|
|
112
|
+
| <= 6 | **Aggregate**: Execute multiple phases together |
|
|
113
|
+
| 7-10 | **Cautious**: Execute 1-2 phases, then verify |
|
|
114
|
+
| > 10 | **Sequential**: Execute one phase at a time |
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Presenting Plans for Approval
|
|
119
|
+
|
|
120
|
+
When presenting a plan for user approval:
|
|
121
|
+
|
|
122
|
+
```markdown
|
|
123
|
+
## Implementation Plan: [Feature Name]
|
|
124
|
+
|
|
125
|
+
### Phase Overview
|
|
126
|
+
|
|
127
|
+
| Phase | Name | Complexity | Description |
|
|
128
|
+
|-------|------|------------|-------------|
|
|
129
|
+
| 1 | Types and Schemas | 3/10 | Define TypeScript types and Zod schemas |
|
|
130
|
+
| 2 | API Implementation | 6/10 | Create API routes with validation |
|
|
131
|
+
| 3 | UI Components | 5/10 | Build React components |
|
|
132
|
+
| 4 | Tests | 4/10 | Write comprehensive tests |
|
|
133
|
+
|
|
134
|
+
### Execution Strategy
|
|
135
|
+
|
|
136
|
+
Phases 1-2 will be executed together (combined complexity: 9)
|
|
137
|
+
Phase 3 will be executed separately
|
|
138
|
+
Phase 4 (Tests) always executed separately
|
|
139
|
+
|
|
140
|
+
### Key Decisions
|
|
141
|
+
|
|
142
|
+
1. [Decision 1 and reasoning]
|
|
143
|
+
2. [Decision 2 and reasoning]
|
|
144
|
+
|
|
145
|
+
**Ready to proceed?**
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Benefits of Plan Mode
|
|
151
|
+
|
|
152
|
+
1. **Collaborative Design**: Discuss approach before implementation
|
|
153
|
+
2. **Risk Mitigation**: Catch issues early in planning
|
|
154
|
+
3. **User Control**: Approve approach before changes are made
|
|
155
|
+
4. **Better Decisions**: Time to consider alternatives and trade-offs
|
|
156
|
+
5. **Documentation**: Planning discussions serve as decision records
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Related Rules
|
|
161
|
+
|
|
162
|
+
- Plan patterns: `.claude/rules/patterns/plans-patterns.md`
|
|
163
|
+
- Complexity scoring: `.claude/rules/core/complexity-scoring.md`
|
|
164
|
+
- Execute plan skill: `.claude/skills/execute-plan/SKILL.md`
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
|
|
2
|
+
## Running Tests
|
|
3
|
+
|
|
4
|
+
```bash
|
|
5
|
+
# Run all tests
|
|
6
|
+
pytest
|
|
7
|
+
|
|
8
|
+
# Run with verbose output
|
|
9
|
+
pytest -v
|
|
10
|
+
|
|
11
|
+
# Run specific test file
|
|
12
|
+
pytest tests/test_service.py
|
|
13
|
+
|
|
14
|
+
# Run specific test class
|
|
15
|
+
pytest tests/test_service.py::TestUserService
|
|
16
|
+
|
|
17
|
+
# Run specific test
|
|
18
|
+
pytest tests/test_service.py::TestUserService::test_get_user_returns_user
|
|
19
|
+
|
|
20
|
+
# Run with coverage
|
|
21
|
+
pytest --cov=src --cov-report=html
|
|
22
|
+
|
|
23
|
+
# Run only marked tests
|
|
24
|
+
pytest -m "integration"
|
|
25
|
+
|
|
26
|
+
# Run with parallel execution
|
|
27
|
+
pytest -n auto
|
|
28
|
+
|
|
29
|
+
# Stop on first failure
|
|
30
|
+
pytest -x
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Coverage Commands
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Generate coverage report
|
|
39
|
+
pytest --cov=src
|
|
40
|
+
|
|
41
|
+
# Generate HTML coverage report
|
|
42
|
+
pytest --cov=src --cov-report=html
|
|
43
|
+
|
|
44
|
+
# Generate XML coverage report (for CI)
|
|
45
|
+
pytest --cov=src --cov-report=xml
|
|
46
|
+
|
|
47
|
+
# Check coverage thresholds
|
|
48
|
+
pytest --cov=src --cov-fail-under=80
|
|
49
|
+
|
|
50
|
+
# Coverage for specific modules
|
|
51
|
+
pytest --cov=src/mymodule --cov-report=term-missing
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Debugging Tests
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Drop into debugger on failure
|
|
60
|
+
pytest --pdb
|
|
61
|
+
|
|
62
|
+
# Drop into debugger at start of each test
|
|
63
|
+
pytest --pdb-first
|
|
64
|
+
|
|
65
|
+
# Show local variables in tracebacks
|
|
66
|
+
pytest -l
|
|
67
|
+
|
|
68
|
+
# Verbose output with full diff
|
|
69
|
+
pytest -vv
|
|
70
|
+
|
|
71
|
+
# Show print statements
|
|
72
|
+
pytest -s
|
|
73
|
+
|
|
74
|
+
# Capture no output (show all print statements)
|
|
75
|
+
pytest --capture=no
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## CI/CD Commands
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Run with JUnit XML output for CI
|
|
84
|
+
pytest --junitxml=results.xml
|
|
85
|
+
|
|
86
|
+
# Run with coverage and XML output
|
|
87
|
+
pytest --cov=src --cov-report=xml --junitxml=results.xml
|
|
88
|
+
|
|
89
|
+
# Fail if coverage drops below threshold
|
|
90
|
+
pytest --cov=src --cov-fail-under=80
|
|
91
|
+
|
|
92
|
+
# Run in parallel (requires pytest-xdist)
|
|
93
|
+
pytest -n auto
|
|
94
|
+
|
|
95
|
+
# Rerun only failed tests
|
|
96
|
+
pytest --lf
|
|
97
|
+
|
|
98
|
+
# Rerun failed tests first, then rest
|
|
99
|
+
pytest --ff
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Test Selection
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Run tests matching a keyword expression
|
|
108
|
+
pytest -k "user and not integration"
|
|
109
|
+
|
|
110
|
+
# Run tests matching a marker
|
|
111
|
+
pytest -m "slow"
|
|
112
|
+
|
|
113
|
+
# Run tests in a specific directory
|
|
114
|
+
pytest tests/unit/
|
|
115
|
+
|
|
116
|
+
# Run tests that failed in the last run
|
|
117
|
+
pytest --lf
|
|
118
|
+
|
|
119
|
+
# Run tests in random order (requires pytest-random-order)
|
|
120
|
+
pytest --random-order
|
|
121
|
+
```
|