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,308 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Include when /review-code is invoked or local uncommitted code analysis is needed"
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Review Code Skill
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Perform a comprehensive **read-only analysis** of locally changed files (uncommitted changes) using established patterns and guidelines, then generate a structured review document.
|
|
11
|
+
|
|
12
|
+
This skill **only produces a markdown file** with findings. It does NOT:
|
|
13
|
+
|
|
14
|
+
- Modify any code
|
|
15
|
+
- Make commits
|
|
16
|
+
- Execute any scripts beyond git commands
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Restrictions - READ ONLY
|
|
21
|
+
|
|
22
|
+
This skill is **strictly read-only analysis**. The review process:
|
|
23
|
+
|
|
24
|
+
1. **Reads** the local diff (staged and unstaged changes)
|
|
25
|
+
2. **Searches** the codebase for similar implementations as reference
|
|
26
|
+
3. **Analyzes** changes against patterns and guidelines
|
|
27
|
+
4. **Generates** a markdown file with findings and recommendations
|
|
28
|
+
|
|
29
|
+
**No code modification, no commits, no builds.**
|
|
30
|
+
|
|
31
|
+
### NEVER Do These Actions
|
|
32
|
+
|
|
33
|
+
| Forbidden Action | Reason |
|
|
34
|
+
| ------------------------------------- | ------------------------------------------ |
|
|
35
|
+
| Edit/modify any source code | No code changes - review produces findings |
|
|
36
|
+
| `git commit` | No commits |
|
|
37
|
+
| `git add` | No staging changes |
|
|
38
|
+
| `git checkout` | No discarding changes |
|
|
39
|
+
| `git reset` | No resetting changes |
|
|
40
|
+
| `npm run build` | No build commands |
|
|
41
|
+
| `npm run test` | No test commands |
|
|
42
|
+
| Create/edit files outside `flow/` | Only write to `flow/reviewed-code/` |
|
|
43
|
+
|
|
44
|
+
### Allowed Actions
|
|
45
|
+
|
|
46
|
+
| Allowed Action | Purpose |
|
|
47
|
+
| -------------------------------------- | ------------------------------- |
|
|
48
|
+
| `git status` | List changed files |
|
|
49
|
+
| `git diff` | View uncommitted changes |
|
|
50
|
+
| `git diff --cached` | View staged changes |
|
|
51
|
+
| `git diff --name-only` | List changed file names |
|
|
52
|
+
| `git log` (read only) | View commit history for context |
|
|
53
|
+
| Read any project file | Find similar implementations |
|
|
54
|
+
| Search codebase (grep, glob, semantic) | Find reference patterns |
|
|
55
|
+
| Write to `flow/reviewed-code/` | Save review notes locally |
|
|
56
|
+
| Read project rule files | Load patterns for analysis |
|
|
57
|
+
|
|
58
|
+
> **Important**: The ONLY writable location is `flow/reviewed-code/`. No source code, configuration files, or any other project files should be modified.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Inputs
|
|
63
|
+
|
|
64
|
+
| Input | Required | Description |
|
|
65
|
+
| ----------- | -------- | ---------------------------------------------------- |
|
|
66
|
+
| `file_path` | Optional | Specific file(s) to review (defaults to all changed) |
|
|
67
|
+
| `language` | Optional | Primary language (auto-detected if not provided) |
|
|
68
|
+
| `scope` | Optional | `all` (default), `staged`, or `unstaged` changes |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Workflow
|
|
73
|
+
|
|
74
|
+
### Step 1: Identify Changed Files
|
|
75
|
+
|
|
76
|
+
1. Run `git status` to identify all changed files
|
|
77
|
+
2. Run `git diff --name-only` to get list of unstaged changes
|
|
78
|
+
3. Run `git diff --cached --name-only` to get list of staged changes
|
|
79
|
+
4. If `file_path` is provided, filter to only those files
|
|
80
|
+
5. If `scope` is provided, filter to staged or unstaged only
|
|
81
|
+
|
|
82
|
+
### Step 2: Load Review Patterns
|
|
83
|
+
|
|
84
|
+
1. Read `.cursor/rules/patterns/review-pr-patterns.mdc` for general review guidelines
|
|
85
|
+
2. Based on the detected language(s), load the appropriate pattern file:
|
|
86
|
+
- **TypeScript/JavaScript**: Load `.cursor/rules/languages/typescript-patterns.mdc`
|
|
87
|
+
- **Python**: Load `.cursor/rules/languages/python-patterns.mdc`
|
|
88
|
+
3. Cross-reference with `.cursor/rules/core/forbidden-patterns.mdc` for anti-patterns to flag
|
|
89
|
+
4. Cross-reference with `.cursor/rules/core/allowed-patterns.mdc` for best practices to encourage
|
|
90
|
+
5. Use the [`complexity-scoring` pattern](../core/complexity-scoring.mdc) for fix complexity scoring
|
|
91
|
+
|
|
92
|
+
### Step 3: Find Similar Implementations in Codebase
|
|
93
|
+
|
|
94
|
+
**This is a critical step that differentiates this from PR review.**
|
|
95
|
+
|
|
96
|
+
For each changed file:
|
|
97
|
+
|
|
98
|
+
1. **Identify the type of code being written**:
|
|
99
|
+
|
|
100
|
+
- Component? Search for similar components
|
|
101
|
+
- Utility function? Search for similar utilities
|
|
102
|
+
- API route? Search for similar routes
|
|
103
|
+
- Hook? Search for similar hooks
|
|
104
|
+
- Type/interface? Search for similar type definitions
|
|
105
|
+
|
|
106
|
+
2. **Search for existing patterns in the codebase**:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Example searches to find similar code
|
|
110
|
+
# For components:
|
|
111
|
+
grep -r "export const" --include="*.tsx" src/components/
|
|
112
|
+
|
|
113
|
+
# For hooks:
|
|
114
|
+
grep -r "export function use" --include="*.ts" src/hooks/
|
|
115
|
+
|
|
116
|
+
# For API routes:
|
|
117
|
+
grep -r "export async function" --include="route.ts" src/app/api/
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
3. **Document the reference implementations found**:
|
|
121
|
+
|
|
122
|
+
- File path of similar code
|
|
123
|
+
- Key patterns used in that code
|
|
124
|
+
- How the new code differs (if at all)
|
|
125
|
+
|
|
126
|
+
4. **Flag pattern inconsistencies**:
|
|
127
|
+
- New code uses a different pattern than existing code
|
|
128
|
+
- New code introduces a pattern not documented in rules
|
|
129
|
+
- New code conflicts with established patterns
|
|
130
|
+
|
|
131
|
+
### Step 4: Analyze Code Changes
|
|
132
|
+
|
|
133
|
+
For each changed file:
|
|
134
|
+
|
|
135
|
+
1. Review the diff/changes using `git diff {file_path}`
|
|
136
|
+
2. Check for violations of forbidden patterns
|
|
137
|
+
3. Verify adherence to allowed patterns
|
|
138
|
+
4. Apply language-specific checks
|
|
139
|
+
5. **Compare against similar implementations found in Step 3**
|
|
140
|
+
6. Identify security, performance, and maintainability concerns
|
|
141
|
+
7. **Flag any pattern conflicts with existing codebase**
|
|
142
|
+
|
|
143
|
+
### Step 5: Identify Pattern Conflicts
|
|
144
|
+
|
|
145
|
+
**This is unique to local code review.**
|
|
146
|
+
|
|
147
|
+
When a pattern conflict is found:
|
|
148
|
+
|
|
149
|
+
1. **Document the conflict**:
|
|
150
|
+
|
|
151
|
+
- What pattern the new code uses
|
|
152
|
+
- What pattern exists in similar code
|
|
153
|
+
- Which file(s) contain the reference pattern
|
|
154
|
+
|
|
155
|
+
2. **Determine the correct resolution**:
|
|
156
|
+
|
|
157
|
+
- If existing pattern is better → recommend changing new code
|
|
158
|
+
- If new pattern is better → recommend updating rules AND existing code
|
|
159
|
+
- If unclear → flag for team discussion
|
|
160
|
+
|
|
161
|
+
3. **Generate rule update recommendations**:
|
|
162
|
+
- Suggest additions to `.cursor/rules/core/allowed-patterns.mdc`
|
|
163
|
+
- Suggest additions to `.cursor/rules/core/forbidden-patterns.mdc`
|
|
164
|
+
|
|
165
|
+
### Step 6: Generate Review Document
|
|
166
|
+
|
|
167
|
+
Create a markdown file in `flow/reviewed-code/` with the naming convention:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
code-review-{date}-{sanitized-description}.md
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Example**: For changes related to user authentication:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
flow/reviewed-code/code-review-2026-01-14-user-authentication.md
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Output Format**: Use the templates from `.cursor/rules/patterns/review-code-templates.mdc`
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Severity Levels
|
|
184
|
+
|
|
185
|
+
| Level | Description |
|
|
186
|
+
| ---------- | -------------------------------------------------------- |
|
|
187
|
+
| Critical | Security vulnerabilities, data loss risks, blocking bugs |
|
|
188
|
+
| Major | Significant issues affecting functionality or quality |
|
|
189
|
+
| Minor | Code style, minor improvements, non-critical concerns |
|
|
190
|
+
| Suggestion | Nice-to-have improvements, optional enhancements |
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Pattern Conflict Resolution
|
|
195
|
+
|
|
196
|
+
When a conflict is found between new code and existing patterns:
|
|
197
|
+
|
|
198
|
+
### Option 1: Update New Code (Recommended for established patterns)
|
|
199
|
+
|
|
200
|
+
If the existing pattern is:
|
|
201
|
+
|
|
202
|
+
- Documented in rules files
|
|
203
|
+
- Used consistently across the codebase
|
|
204
|
+
- Has clear benefits
|
|
205
|
+
|
|
206
|
+
**Action**: Update the new code to match the existing pattern.
|
|
207
|
+
|
|
208
|
+
### Option 2: Update Rules (For better new patterns)
|
|
209
|
+
|
|
210
|
+
If the new pattern is:
|
|
211
|
+
|
|
212
|
+
- Demonstrably better than existing
|
|
213
|
+
- More maintainable or readable
|
|
214
|
+
- Follows best practices that existing code doesn't
|
|
215
|
+
|
|
216
|
+
**Action**:
|
|
217
|
+
|
|
218
|
+
1. Document the new pattern in `allowed-patterns.mdc`
|
|
219
|
+
2. Add the old pattern to `forbidden-patterns.mdc`
|
|
220
|
+
3. Create a task to refactor existing code (optional)
|
|
221
|
+
|
|
222
|
+
### Option 3: Team Discussion (For unclear cases)
|
|
223
|
+
|
|
224
|
+
If:
|
|
225
|
+
|
|
226
|
+
- Both patterns have valid trade-offs
|
|
227
|
+
- Team preference is unclear
|
|
228
|
+
- Architectural decision is required
|
|
229
|
+
|
|
230
|
+
**Action**: Flag for team discussion before committing.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Finding Similar Implementations
|
|
235
|
+
|
|
236
|
+
### Search Strategies by Code Type
|
|
237
|
+
|
|
238
|
+
| Code Type | Search Strategy |
|
|
239
|
+
| --------------- | -------------------------------------------------------- |
|
|
240
|
+
| React Component | Search `src/components/` for similar component structure |
|
|
241
|
+
| Custom Hook | Search `src/hooks/` for similar hook patterns |
|
|
242
|
+
| Utility | Search `src/utils/` for similar utility functions |
|
|
243
|
+
| API Route | Search `src/app/api/` for similar route handlers |
|
|
244
|
+
| Type Definition | Search `src/types/` for similar type structures |
|
|
245
|
+
| Store/State | Search `src/stores/` for similar state management |
|
|
246
|
+
| Test File | Search `__tests__/` for similar test patterns |
|
|
247
|
+
|
|
248
|
+
### Key Aspects to Compare
|
|
249
|
+
|
|
250
|
+
When comparing new code with reference implementations:
|
|
251
|
+
|
|
252
|
+
1. **Naming Conventions**: Do variable/function names follow the same pattern?
|
|
253
|
+
2. **Error Handling**: Is error handling consistent?
|
|
254
|
+
3. **Type Definitions**: Are types structured similarly?
|
|
255
|
+
4. **Code Organization**: Is the file structure consistent?
|
|
256
|
+
5. **Comments/Documentation**: Does documentation follow the same style?
|
|
257
|
+
6. **Import Structure**: Are imports organized the same way?
|
|
258
|
+
7. **Export Patterns**: Default vs named exports consistency?
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Quick Reference Commands
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Review all uncommitted changes
|
|
266
|
+
review-code
|
|
267
|
+
|
|
268
|
+
# Review specific file
|
|
269
|
+
review-code src/services/userService.ts
|
|
270
|
+
|
|
271
|
+
# Review only staged changes
|
|
272
|
+
review-code --scope staged
|
|
273
|
+
|
|
274
|
+
# Review only unstaged changes
|
|
275
|
+
review-code --scope unstaged
|
|
276
|
+
|
|
277
|
+
# Review with explicit language
|
|
278
|
+
review-code --language typescript
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Related Files
|
|
284
|
+
|
|
285
|
+
| File | Purpose |
|
|
286
|
+
| -------------------------------------------------- | ------------------------------------ |
|
|
287
|
+
| `.cursor/rules/patterns/review-pr-patterns.mdc` | Main review checklist and guidelines |
|
|
288
|
+
| `.cursor/rules/patterns/review-code-templates.mdc` | Output templates for review docs |
|
|
289
|
+
| `.cursor/rules/core/forbidden-patterns.mdc` | Anti-patterns to flag |
|
|
290
|
+
| `.cursor/rules/core/allowed-patterns.mdc` | Best practices to encourage |
|
|
291
|
+
| `.cursor/rules/languages/typescript-patterns.mdc` | TypeScript-specific checks |
|
|
292
|
+
| `.cursor/rules/languages/python-patterns.mdc` | Python-specific checks |
|
|
293
|
+
| `.cursor/rules/core/complexity-scoring.mdc` | Fix complexity scoring system |
|
|
294
|
+
| `flow/reviewed-code/` | Output folder for review documents |
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Workflow Integration
|
|
299
|
+
|
|
300
|
+
After running this command:
|
|
301
|
+
|
|
302
|
+
1. **Review the generated document** in `flow/reviewed-code/`
|
|
303
|
+
2. **Address Critical and Major findings** before committing
|
|
304
|
+
3. **Resolve pattern conflicts** by choosing the appropriate resolution
|
|
305
|
+
4. **Update rule files** if recommended (add to allowed/forbidden patterns)
|
|
306
|
+
5. **Commit changes** once review concerns are addressed
|
|
307
|
+
|
|
308
|
+
> The goal is not just to review current changes, but to **improve the codebase patterns over time** by documenting good patterns and preventing anti-patterns from spreading.
|