@simplysm/sd-claude 13.0.75 → 13.0.77
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/refs/sd-code-conventions.md +102 -4
- package/claude/refs/sd-solid.md +13 -2
- package/claude/refs/sd-workflow.md +2 -1
- package/claude/rules/sd-claude-rules.md +18 -1
- package/claude/rules/sd-refs-linker.md +1 -1
- package/claude/sd-statusline.js +51 -9
- package/claude/skills/sd-api-name-review/SKILL.md +118 -13
- package/claude/skills/sd-brainstorm/SKILL.md +82 -8
- package/claude/skills/sd-check/SKILL.md +28 -14
- package/claude/skills/sd-commit/SKILL.md +1 -4
- package/claude/skills/sd-debug/SKILL.md +8 -13
- package/claude/skills/sd-debug/condition-based-waiting.md +5 -11
- package/claude/skills/sd-debug/root-cause-tracing.md +18 -33
- package/claude/skills/sd-explore/SKILL.md +118 -0
- package/claude/skills/sd-plan/SKILL.md +31 -0
- package/claude/skills/sd-plan-dev/SKILL.md +92 -75
- package/claude/skills/sd-plan-dev/code-quality-reviewer-prompt.md +1 -3
- package/claude/skills/sd-plan-dev/implementer-prompt.md +10 -1
- package/claude/skills/sd-readme/SKILL.md +1 -1
- package/claude/skills/sd-review/SKILL.md +128 -55
- package/claude/skills/sd-review/api-reviewer-prompt.md +23 -38
- package/claude/skills/sd-review/code-reviewer-prompt.md +26 -29
- package/claude/skills/sd-review/convention-checker-prompt.md +61 -0
- package/claude/skills/sd-review/refactoring-analyzer-prompt.md +92 -0
- package/claude/skills/sd-skill/SKILL.md +20 -3
- package/claude/skills/sd-skill/anthropic-best-practices.md +71 -1091
- package/claude/skills/sd-skill/testing-skills-with-subagents.md +9 -5
- package/claude/skills/sd-skill/writing-guide.md +7 -11
- package/claude/skills/sd-tdd/SKILL.md +15 -20
- package/claude/skills/sd-use/SKILL.md +18 -27
- package/claude/skills/sd-worktree/SKILL.md +58 -113
- package/package.json +1 -1
- package/claude/skills/sd-check/baseline-analysis.md +0 -150
- package/claude/skills/sd-check/test-scenarios.md +0 -205
- package/claude/skills/sd-debug/test-baseline-pressure.md +0 -61
- package/claude/skills/sd-review/code-simplifier-prompt.md +0 -88
- package/claude/skills/sd-worktree/sd-worktree.mjs +0 -152
|
@@ -185,7 +185,7 @@ Report what was changed.
|
|
|
185
185
|
| Ignoring existing docs/ structure | If docs/ exists, update those files too |
|
|
186
186
|
| Arbitrary section reorganization | Follow index.ts `#region` structure |
|
|
187
187
|
| Missing import paths in examples | Always: `import { X } from "@simplysm/..."` |
|
|
188
|
-
| Writing in
|
|
188
|
+
| Writing in non-English languages | README must be in English |
|
|
189
189
|
| Adding changelog sections | Never add version history |
|
|
190
190
|
| Editing before reporting diff | Always report ADDED/REMOVED/CHANGED and wait for confirmation |
|
|
191
191
|
| Destroying docs/ link format | If README uses `[name](docs/file.md#anchor)`, preserve that pattern |
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sd-review
|
|
3
|
-
description: "
|
|
3
|
+
description: "Use when the user explicitly requests code review, refactoring analysis, or structural improvement. Covers correctness, safety, API design, conventions, complexity, duplication, and code structure. Explicit invocation only."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# sd-review
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Comprehensive code analysis combining **defect review** (correctness, safety, API, conventions) and **refactoring analysis** (structure, simplification). Uses **sd-explore** to minimize redundant file reads, then dispatches reviewers with pre-filtered context.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
**Analysis only — no code modifications.**
|
|
13
|
+
|
|
14
|
+
## Principles
|
|
15
|
+
|
|
16
|
+
- **Breaking changes are irrelevant**: Reviewers must NOT dismiss findings because the fix would cause a breaking change.
|
|
13
17
|
|
|
14
18
|
## Usage
|
|
15
19
|
|
|
16
|
-
- `/sd-review packages/solid` — full review (all
|
|
17
|
-
- `/sd-review packages/solid focus on bugs` — selective review
|
|
20
|
+
- `/sd-review packages/solid` — full review (all perspectives)
|
|
21
|
+
- `/sd-review packages/solid focus on bugs` — selective review
|
|
22
|
+
- `/sd-review packages/solid focus on refactoring` — structural analysis only
|
|
18
23
|
- `/sd-review` — if no argument, ask the user for the target path
|
|
19
24
|
|
|
20
25
|
## Target Selection
|
|
@@ -26,84 +31,152 @@ Dispatches up to 3 reviewer agents in parallel using prompt templates. Each agen
|
|
|
26
31
|
|
|
27
32
|
## Reviewer Perspectives
|
|
28
33
|
|
|
29
|
-
| Reviewer | Prompt Template | Perspective |
|
|
30
|
-
|
|
31
|
-
| **Code Reviewer** | `code-reviewer-prompt.md` | Correctness & Safety
|
|
32
|
-
| **API Reviewer** | `api-reviewer-prompt.md` | Usability & DX
|
|
33
|
-
| **
|
|
34
|
+
| Reviewer | Prompt Template | Tag | Perspective |
|
|
35
|
+
|----------|----------------|-----|-------------|
|
|
36
|
+
| **Code Reviewer** | `code-reviewer-prompt.md` | `[CORRECTNESS]` | Correctness & Safety |
|
|
37
|
+
| **API Reviewer** | `api-reviewer-prompt.md` | `[API]` | Usability & DX |
|
|
38
|
+
| **Convention Checker** | `convention-checker-prompt.md` | *(all files)* | Project rules — Grep-based |
|
|
39
|
+
| **Refactoring Analyzer** | `refactoring-analyzer-prompt.md` | `[REFACTOR]` | Structure & Simplification |
|
|
34
40
|
|
|
35
41
|
## Reviewer Selection
|
|
36
42
|
|
|
37
|
-
By default, run **all
|
|
43
|
+
By default, run **all 4 reviewers**. If the user specifies a focus, select relevant reviewer(s):
|
|
38
44
|
|
|
39
45
|
| User says | Run |
|
|
40
46
|
|-----------|-----|
|
|
41
|
-
| "bugs", "security", "safety" | Code Reviewer
|
|
42
|
-
| "API", "naming", "types", "DX" | API Reviewer
|
|
43
|
-
| "
|
|
44
|
-
| "
|
|
45
|
-
|
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
| "bugs", "security", "safety", "architecture", "dependencies" | Code Reviewer |
|
|
48
|
+
| "API", "naming", "types", "DX" | API Reviewer |
|
|
49
|
+
| "conventions", "rules", "patterns" | Convention Checker |
|
|
50
|
+
| "simplify", "complexity", "duplication", "structure", "module" | Refactoring Analyzer |
|
|
51
|
+
| "defects", "correctness" | Code + API + Convention |
|
|
52
|
+
| "refactoring", "refactor", "maintainability" | Refactoring Analyzer |
|
|
53
|
+
| (no specific focus) | All 4 |
|
|
48
54
|
|
|
49
55
|
## Workflow
|
|
50
56
|
|
|
51
|
-
### Step 1:
|
|
57
|
+
### Step 1: Prepare Context
|
|
58
|
+
|
|
59
|
+
Read these files:
|
|
60
|
+
- `CLAUDE.md` — project overview
|
|
61
|
+
- `.claude/rules/sd-refs-linker.md` — reference guide
|
|
62
|
+
- Target's `package.json` — version (v12/v13)
|
|
63
|
+
|
|
64
|
+
Based on version and target, read all applicable reference files (e.g., `sd-code-conventions.md`, `sd-solid.md`).
|
|
65
|
+
|
|
66
|
+
Keep the collected conventions in memory — they will be inlined into each reviewer's prompt in Step 3.
|
|
67
|
+
|
|
68
|
+
### Step 2: Explore (via sd-explore)
|
|
69
|
+
|
|
70
|
+
Follow the **sd-explore** workflow to read all source files under the target.
|
|
52
71
|
|
|
53
|
-
|
|
72
|
+
**sd-explore input:**
|
|
54
73
|
|
|
74
|
+
- **Target path**: the review target directory
|
|
75
|
+
- **Name**: `review`
|
|
76
|
+
- **File patterns**: `**/*.ts`, `**/*.tsx` (exclude `node_modules`, `dist`)
|
|
77
|
+
- **Analysis instructions**:
|
|
78
|
+
|
|
79
|
+
"For each file:
|
|
80
|
+
1. Write a 1-2 line summary of what it does
|
|
81
|
+
2. Tag files that need deep review (~30-50% of files; a file can have multiple tags)
|
|
82
|
+
|
|
83
|
+
Tag criteria:
|
|
84
|
+
- [CORRECTNESS] — Unguarded null/! assertions, async races, DOM manipulation (SSR risks), resource lifecycle gaps, swallowed exceptions, mutable state for sync
|
|
85
|
+
- [API] — Public exports, complex type signatures/generics/overloads, props/options interfaces, naming inconsistency
|
|
86
|
+
- [REFACTOR] — File > 300 lines or function > 50 lines, deep nesting (> 3 levels), similar patterns across files, mixed abstraction levels, mixed responsibilities
|
|
87
|
+
|
|
88
|
+
Output format:
|
|
55
89
|
```
|
|
56
|
-
|
|
90
|
+
# Explore: [directory names]
|
|
91
|
+
|
|
92
|
+
## File Summaries
|
|
93
|
+
- `path/to/file.ts` — Brief description
|
|
94
|
+
|
|
95
|
+
## Tagged Files
|
|
96
|
+
### CORRECTNESS
|
|
97
|
+
- `path/to/file.ts:42` — Suspected issue description
|
|
98
|
+
### API
|
|
99
|
+
- `path/to/file.ts` — Why this needs API review
|
|
100
|
+
### REFACTOR
|
|
101
|
+
- `path/to/file.ts` — Structural concern
|
|
57
102
|
```
|
|
58
103
|
|
|
59
|
-
|
|
104
|
+
Files not listed under Tagged Files are considered clean. Do NOT add tags in File Summaries — Tagged Files is the single source of truth."
|
|
60
105
|
|
|
61
|
-
### Step
|
|
106
|
+
### Step 3: Dispatch Reviewers (Parallel)
|
|
62
107
|
|
|
63
|
-
|
|
108
|
+
Read each reviewer's prompt template. Replace:
|
|
109
|
+
- `[CONVENTIONS]` → the conventions text collected in Step 1 (inline, not a file path)
|
|
110
|
+
- `[EXPLORE_FILES]` → comma-separated list of explore output file paths
|
|
64
111
|
|
|
65
|
-
|
|
66
|
-
- **Invalid — self-contradicted**: the reviewer's own analysis shows the issue is mitigated (e.g., "exploitability is limited because..."). Drop it.
|
|
67
|
-
- **Invalid — type-only**: reports a type definition as a runtime issue without showing actual runtime code that triggers it. Drop it.
|
|
68
|
-
- **Invalid — out of scope**: the issue is about code outside the target path (e.g., how other packages use this code). Drop it.
|
|
69
|
-
- **Invalid — duplicate**: another reviewer already reported the same issue. Keep only the one from the correct domain (bugs→Code, API→API, structure→Simplifier).
|
|
70
|
-
- **Invalid — bikeshedding**: minor style preference on stable, well-commented code (magic numbers with clear comments, small interface field duplication, naming when used consistently). Drop it.
|
|
71
|
-
- **Invalid — severity inflated**: downgrade or drop findings where the stated severity doesn't match the actual impact.
|
|
72
|
-
- **Invalid — already handled**: handled elsewhere in the codebase (provide evidence)
|
|
73
|
-
- **Invalid — intentional pattern**: by-design architectural decision
|
|
74
|
-
- **Invalid — misread**: the reviewer misinterpreted the code
|
|
112
|
+
Dispatch selected reviewers in parallel.
|
|
75
113
|
|
|
76
|
-
### Step
|
|
114
|
+
### Step 4: Verify & Deduplicate
|
|
77
115
|
|
|
78
|
-
|
|
116
|
+
This is the **orchestrator-level** verification. Reviewers already self-verify, but findings can still be invalid or overlap.
|
|
79
117
|
|
|
80
|
-
|
|
81
|
-
|
|
118
|
+
**MANDATORY: Read actual code for EVERY finding.** For each finding, you MUST `Read` the file at the referenced location before deciding keep/drop. Do NOT rely on reviewer descriptions alone — verify against the actual code. A finding that was not verified by reading the source code CANNOT pass this step.
|
|
119
|
+
|
|
120
|
+
**Deduplication**: If multiple reviewers flag the same code location, keep the finding under the most specific reviewer:
|
|
121
|
+
- Convention violation + correctness concern → Convention Checker owns it
|
|
122
|
+
- API issue + structural concern → API Reviewer owns it
|
|
123
|
+
- When unclear, keep the one with stronger evidence
|
|
124
|
+
|
|
125
|
+
**For defect findings (Code, API, Convention):**
|
|
126
|
+
|
|
127
|
+
Read the code, then drop if: self-contradicted, type-only (no runtime trigger), out of scope, duplicate, bikeshedding, severity inflated, already handled, intentional pattern, misread, tradeoff-negative.
|
|
82
128
|
|
|
83
|
-
|
|
84
|
-
[verified critical findings from all reviewers]
|
|
129
|
+
**For refactoring findings:**
|
|
85
130
|
|
|
86
|
-
|
|
87
|
-
[verified warning findings from all reviewers]
|
|
131
|
+
Read the code at both/all referenced locations, then check:
|
|
88
132
|
|
|
89
|
-
|
|
90
|
-
|
|
133
|
+
- **Scope**: structural issue? within target? not a duplicate?
|
|
134
|
+
- **Duplication reality**: count the actual shared lines (not the reviewer's estimate). < 30 lines → drop. Behavioral differences between the "duplicated" code → drop. Intentional Input/Normalized pattern → drop.
|
|
135
|
+
- **Separation benefit**: < ~150 lines AND tightly coupled → drop. Single cohesive domain → drop. Not independently reusable → drop.
|
|
136
|
+
- **By design**: established pattern used consistently → drop.
|
|
137
|
+
- **Tradeoff-negative**: introduces more complexity than it removes → drop.
|
|
138
|
+
|
|
139
|
+
### Step 5: Report
|
|
140
|
+
|
|
141
|
+
Present **both** invalid and valid findings:
|
|
91
142
|
|
|
92
|
-
### Invalid Findings Summary (optional)
|
|
93
|
-
[findings filtered out and why]
|
|
94
143
|
```
|
|
144
|
+
## Review: <target-path>
|
|
145
|
+
|
|
146
|
+
### Invalid Findings
|
|
147
|
+
[grouped by rejection reason — brief, one line each]
|
|
148
|
+
|
|
149
|
+
### Valid Findings
|
|
150
|
+
[full details for each verified finding]
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
If no valid findings, report that and end here.
|
|
154
|
+
|
|
155
|
+
**If valid findings exist, you MUST proceed to Step 6. Do NOT ask the user whether to apply findings directly.**
|
|
95
156
|
|
|
96
|
-
|
|
157
|
+
### Step 6: Brainstorm Handoff
|
|
158
|
+
|
|
159
|
+
Invoke **sd-brainstorm** with all valid findings as context:
|
|
160
|
+
_
|
|
161
|
+
"Design fixes for the following review findings.
|
|
162
|
+
|
|
163
|
+
**For each finding, you MUST:**
|
|
164
|
+
1. Review it thoroughly — examine the code, understand the context, assess the real impact
|
|
165
|
+
2. If any aspect is unclear or ambiguous, ask the user (one question at a time, per brainstorm rules)
|
|
166
|
+
3. If a finding has low cost-benefit (adds complexity for marginal gain, pure style preference, scope too small), drop it. After triage, briefly list all dropped findings with one-line reasons (no user confirmation needed).
|
|
167
|
+
4. For findings worth fixing, explore approaches and design solutions
|
|
168
|
+
|
|
169
|
+
Findings that survive your triage become the design scope. Apply your normal brainstorm process (gap review → approaches → design presentation) to the surviving findings as a group.
|
|
170
|
+
|
|
171
|
+
<include all valid findings with their reviewer tag, file:line, problem description, and current code snippet>"
|
|
172
|
+
|
|
173
|
+
sd-brainstorm then owns the full cycle: triage (with user input as needed) → design.
|
|
97
174
|
|
|
98
175
|
## Common Mistakes
|
|
99
176
|
|
|
100
177
|
| Mistake | Fix |
|
|
101
178
|
|---------|-----|
|
|
102
|
-
| Using git diff to limit
|
|
103
|
-
| Skipping verification
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
107
|
-
## Completion Criteria
|
|
108
|
-
|
|
109
|
-
Present the comprehensive report to the user. No code modifications.
|
|
179
|
+
| Using git diff to limit scope | Review ALL source files under target |
|
|
180
|
+
| Skipping verification | Always verify against actual code |
|
|
181
|
+
| Running all reviewers for focused requests | Match selection to user's request |
|
|
182
|
+
| Building per-reviewer files from explore results | Reviewers read explore files directly — no intermediate step |
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
# API Reviewer Prompt
|
|
2
2
|
|
|
3
|
-
Template for `Agent(general-purpose)`. Fill in `[
|
|
3
|
+
Template for `Agent(general-purpose)`. Fill in `[CONVENTIONS]` and `[EXPLORE_FILES]`.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
You are reviewing a library's public API for developer experience (DX).
|
|
7
7
|
Your question: "Would a first-time developer be confused or make mistakes using this API?"
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Context
|
|
10
10
|
|
|
11
|
-
Review
|
|
11
|
+
1. Review the following project conventions relevant to API design and naming:
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
[CONVENTIONS]
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
2. Read these explore result files: [EXPLORE_FILES]
|
|
16
|
+
3. From the explore results' **Tagged Files → API** sections, collect all entries — these are your deep-read targets
|
|
16
17
|
|
|
17
|
-
## Step
|
|
18
|
+
## Step 1: Deep Review
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## Step 3: Find issues
|
|
20
|
+
Read each file from the API tagged list. For each:
|
|
21
|
+
1. Map the public API surface (exports, types, interfaces, function signatures)
|
|
22
|
+
2. Verify suspected API issues from screening
|
|
23
|
+
3. Look for additional issues
|
|
24
24
|
|
|
25
25
|
Look for:
|
|
26
26
|
- Naming consistency: same concept with different names, inconsistent prefix/suffix
|
|
@@ -29,38 +29,31 @@ Look for:
|
|
|
29
29
|
- Defaults: basic use cases requiring excessive configuration
|
|
30
30
|
- Pattern consistency: similar tasks requiring different patterns
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
Before suggesting a naming change, verify the existing pattern across ALL similar
|
|
34
|
-
components in the library. Do NOT suggest external conventions that break internal consistency.
|
|
32
|
+
Internal consistency takes priority over external standards.
|
|
35
33
|
|
|
36
34
|
Do NOT report:
|
|
37
35
|
- Bugs, security, logic errors, race conditions
|
|
38
36
|
- Code complexity, duplication, readability
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
- Minor field duplication in small interfaces (< 10 fields) where extraction adds indirection without real benefit
|
|
43
|
-
|
|
44
|
-
## Step 4: Self-verify before reporting
|
|
37
|
+
- TypeScript type system limitations (language constraints, not API flaws)
|
|
38
|
+
- Naming preferences where current name is used consistently
|
|
39
|
+
- Minor field duplication in small interfaces (< 10 fields)
|
|
45
40
|
|
|
46
|
-
|
|
41
|
+
## Step 2: Self-verify
|
|
47
42
|
|
|
48
|
-
1.
|
|
49
|
-
2.
|
|
50
|
-
3.
|
|
43
|
+
1. CRITICAL = developers WILL write wrong code because of this API
|
|
44
|
+
2. Before suggesting a rename, search ALL usages — consistent usage is NOT a finding
|
|
45
|
+
3. Only report on PUBLIC API of the target
|
|
51
46
|
|
|
52
47
|
**Quality over quantity: 3 verified findings > 10 maybe-findings.**
|
|
53
48
|
|
|
54
49
|
## Constraints
|
|
55
50
|
|
|
56
51
|
- Analysis only. Do NOT modify any files.
|
|
57
|
-
- Only report issues with real evidence
|
|
58
|
-
- CRITICAL
|
|
52
|
+
- Only report issues with real evidence.
|
|
53
|
+
- CRITICAL requires proof the API actively misleads.
|
|
59
54
|
|
|
60
55
|
## Output Format
|
|
61
56
|
|
|
62
|
-
Use this exact format for every finding:
|
|
63
|
-
|
|
64
57
|
### [CRITICAL|WARNING|INFO] title
|
|
65
58
|
|
|
66
59
|
- **File**: path/to/file.ts:42
|
|
@@ -68,23 +61,15 @@ Use this exact format for every finding:
|
|
|
68
61
|
- **Issue**: what the problem is
|
|
69
62
|
- **Suggestion**: how to improve it
|
|
70
63
|
|
|
71
|
-
|
|
72
|
-
- CRITICAL: API misleads developers or types are insufficient for correct usage
|
|
73
|
-
- WARNING: Significant DX friction — unnecessary complexity or inconsistency
|
|
74
|
-
- INFO: Minor improvement — better naming or defaults exist
|
|
75
|
-
|
|
76
|
-
Start your report with:
|
|
64
|
+
Start with:
|
|
77
65
|
|
|
78
66
|
## API Review Results
|
|
79
67
|
|
|
80
68
|
### Summary
|
|
81
|
-
- Files reviewed: N
|
|
69
|
+
- Files deep-reviewed: N (list them)
|
|
82
70
|
- Public API surface: brief description
|
|
83
71
|
- Findings: X CRITICAL, Y WARNING, Z INFO
|
|
84
72
|
|
|
85
73
|
### Findings
|
|
86
74
|
[findings here]
|
|
87
|
-
|
|
88
|
-
### Positive Observations
|
|
89
|
-
[what's already well-designed — keep these]
|
|
90
75
|
```
|
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
# Code Reviewer Prompt
|
|
2
2
|
|
|
3
|
-
Template for `Agent(general-purpose)`. Fill in `[
|
|
3
|
+
Template for `Agent(general-purpose)`. Fill in `[CONVENTIONS]` and `[EXPLORE_FILES]`.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
You are reviewing code for correctness and safety.
|
|
7
7
|
Your question: "Does this code produce wrong results or pose risks?"
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Context
|
|
10
10
|
|
|
11
|
-
Review
|
|
11
|
+
1. Review the following project conventions relevant to correctness/safety:
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
[CONVENTIONS]
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
2. Read these explore result files: [EXPLORE_FILES]
|
|
16
|
+
3. From the explore results' **Tagged Files → CORRECTNESS** sections, collect all entries — these are your deep-read targets
|
|
17
17
|
|
|
18
|
-
## Step
|
|
18
|
+
## Step 1: Deep Review
|
|
19
19
|
|
|
20
|
-
Read the
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## Step 3: Find issues
|
|
20
|
+
Read each file from the CORRECTNESS tagged list. For each:
|
|
21
|
+
1. Verify the suspected issue from screening — is it real?
|
|
22
|
+
2. Look for additional issues the screening might have missed
|
|
25
23
|
|
|
26
24
|
Look for:
|
|
27
25
|
- Bugs: null/undefined risks, off-by-one, wrong conditions, missing return values
|
|
@@ -29,37 +27,36 @@ Look for:
|
|
|
29
27
|
- Race conditions: async ordering, shared state without synchronization
|
|
30
28
|
- Resource leaks: uncleared subscriptions/listeners, unclosed handles
|
|
31
29
|
- Error handling: swallowed exceptions, wrong fallbacks, missing propagation
|
|
30
|
+
- Architectural defects: circular dependencies, boundary violations
|
|
32
31
|
|
|
33
32
|
Do NOT report:
|
|
34
|
-
- Naming
|
|
35
|
-
- Code complexity, duplication, readability
|
|
33
|
+
- Naming, API design, pure type quality
|
|
34
|
+
- Code complexity, duplication, readability
|
|
36
35
|
- Style preferences unless they cause actual bugs
|
|
37
|
-
- Type definitions alone
|
|
38
|
-
- Speculative future risks
|
|
39
|
-
- Issues
|
|
36
|
+
- Type definitions alone without runtime trigger
|
|
37
|
+
- Speculative future risks
|
|
38
|
+
- Issues outside the reviewed files
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
**`any` type boundary**: Do NOT report `any` as a type quality issue. But DO report `any` if it enables a runtime crash (e.g., `(obj as any).method()` where `method` may not exist).
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
## Step 2: Self-verify
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
Before including ANY finding:
|
|
45
|
+
1. Is there runtime code that actually triggers this?
|
|
46
|
+
2. Does the evidence contradict my conclusion?
|
|
47
|
+
3. Is this within scope?
|
|
48
48
|
|
|
49
|
-
If you write "in practice this is unlikely because..."
|
|
49
|
+
If you write "in practice this is unlikely because..." — drop it.
|
|
50
50
|
|
|
51
51
|
**Quality over quantity: 3 verified findings > 10 maybe-findings.**
|
|
52
52
|
|
|
53
53
|
## Constraints
|
|
54
54
|
|
|
55
55
|
- Analysis only. Do NOT modify any files.
|
|
56
|
-
- Only report issues where
|
|
57
|
-
- If your own analysis shows the issue is mitigated, do NOT report it.
|
|
56
|
+
- Only report issues where runtime behavior is demonstrably wrong or risky.
|
|
58
57
|
|
|
59
58
|
## Output Format
|
|
60
59
|
|
|
61
|
-
Use this exact format for every finding:
|
|
62
|
-
|
|
63
60
|
### [CRITICAL|WARNING|INFO] title
|
|
64
61
|
|
|
65
62
|
- **File**: path/to/file.ts:42
|
|
@@ -72,12 +69,12 @@ Severity:
|
|
|
72
69
|
- WARNING: Real problem that can occur in practice
|
|
73
70
|
- INFO: Defensive improvement, low risk
|
|
74
71
|
|
|
75
|
-
Start
|
|
72
|
+
Start with:
|
|
76
73
|
|
|
77
74
|
## Code Review Results
|
|
78
75
|
|
|
79
76
|
### Summary
|
|
80
|
-
- Files reviewed: N
|
|
77
|
+
- Files deep-reviewed: N (list them)
|
|
81
78
|
- Findings: X CRITICAL, Y WARNING, Z INFO
|
|
82
79
|
|
|
83
80
|
### Findings
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Convention Checker Prompt
|
|
2
|
+
|
|
3
|
+
Template for `Agent(general-purpose)`. Fill in `[CONVENTIONS]` and `[EXPLORE_FILES]`.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
You are checking code against project conventions.
|
|
7
|
+
Your question: "Does this code violate any project-defined rules?"
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
1. Review the following project conventions (these are your Grep criteria):
|
|
12
|
+
|
|
13
|
+
[CONVENTIONS]
|
|
14
|
+
|
|
15
|
+
2. Read these explore result files: [EXPLORE_FILES]
|
|
16
|
+
3. Collect ALL file paths from the **File Summaries** sections — these are your Grep scope
|
|
17
|
+
|
|
18
|
+
## Step 1: Extract Grep-searchable patterns
|
|
19
|
+
|
|
20
|
+
From the conventions, extract rules that can be checked via text pattern matching.
|
|
21
|
+
|
|
22
|
+
Examples of Grep-searchable rules:
|
|
23
|
+
- `as unknown as` — prohibited
|
|
24
|
+
- `as any` — prohibited in public-facing types
|
|
25
|
+
- `export * from` or `export { } from` outside `src/index.ts` — prohibited
|
|
26
|
+
|
|
27
|
+
**Skip rules that require semantic understanding** (e.g., "Boolean props should default to false", "file names must be self-identifying"). Only check patterns that can be matched syntactically.
|
|
28
|
+
|
|
29
|
+
## Step 2: Grep for each pattern
|
|
30
|
+
|
|
31
|
+
For each prohibited pattern, run Grep across all files in scope.
|
|
32
|
+
|
|
33
|
+
For patterns with justified exceptions (e.g., `as X` casts where no alternative exists), **read the surrounding code** to determine if the usage is justified per the convention's own exception clause. Report only unjustified matches.
|
|
34
|
+
|
|
35
|
+
Do NOT skip or dismiss matches for these reasons:
|
|
36
|
+
- "Widespread usage" is NOT an exception — it means widespread violation
|
|
37
|
+
- "Codebase pattern" is NOT an exception — conventions define what's correct
|
|
38
|
+
|
|
39
|
+
## Step 3: Report
|
|
40
|
+
|
|
41
|
+
### [WARNING] title
|
|
42
|
+
|
|
43
|
+
- **File**: path/to/file.ts:42
|
|
44
|
+
- **Convention**: which rule from which convention
|
|
45
|
+
- **Evidence**: the matching code (include snippet)
|
|
46
|
+
- **Suggestion**: the fix recommended by the convention
|
|
47
|
+
|
|
48
|
+
All violations are WARNING. Use CRITICAL only if the violation causes an immediate runtime bug.
|
|
49
|
+
|
|
50
|
+
Start with:
|
|
51
|
+
|
|
52
|
+
## Convention Check Results
|
|
53
|
+
|
|
54
|
+
### Summary
|
|
55
|
+
- Files checked: N
|
|
56
|
+
- Conventions referenced: [list]
|
|
57
|
+
- Violations found: N
|
|
58
|
+
|
|
59
|
+
### Violations
|
|
60
|
+
[findings here]
|
|
61
|
+
```
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Refactoring Analyzer Prompt
|
|
2
|
+
|
|
3
|
+
Template for `Agent(general-purpose)`. Fill in `[CONVENTIONS]` and `[EXPLORE_FILES]`.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
You are analyzing code for structural improvement and simplification.
|
|
7
|
+
Your question: "Can this code be simpler or better organized without changing its behavior?"
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
1. Review the following project conventions relevant to code structure:
|
|
12
|
+
|
|
13
|
+
[CONVENTIONS]
|
|
14
|
+
|
|
15
|
+
2. Read these explore result files: [EXPLORE_FILES]
|
|
16
|
+
3. From the explore results' **Tagged Files → REFACTOR** sections, collect all entries — these are your deep-read targets
|
|
17
|
+
|
|
18
|
+
## Step 1: Deep Review
|
|
19
|
+
|
|
20
|
+
Read each file from the REFACTOR tagged list. For each:
|
|
21
|
+
1. Verify suspected structural issues from screening
|
|
22
|
+
2. Look for additional opportunities
|
|
23
|
+
|
|
24
|
+
Look for:
|
|
25
|
+
|
|
26
|
+
**Simplification:**
|
|
27
|
+
- Unnecessary complexity: over-abstraction, needless indirection, complex generics
|
|
28
|
+
- Duplication: same logic repeated across files, similar functions that could be unified
|
|
29
|
+
- Readability: hard-to-follow control flow, unclear variable names, implicit behavior
|
|
30
|
+
|
|
31
|
+
**Structure:**
|
|
32
|
+
- Responsibility mixing: single module handling concerns that should be separate
|
|
33
|
+
- Abstraction level mismatch: high-level orchestration mixed with low-level details
|
|
34
|
+
- Module organization: related functionality scattered, or unrelated functionality grouped
|
|
35
|
+
- Leaking abstractions: internal details exposed through public API
|
|
36
|
+
- Coupling hotspots: changes that would cascade widely
|
|
37
|
+
|
|
38
|
+
## CRITICAL — Scope boundaries
|
|
39
|
+
|
|
40
|
+
Do NOT report:
|
|
41
|
+
- Bugs, security, logic errors, race conditions → code review
|
|
42
|
+
- Naming consistency, API design, type quality → API review
|
|
43
|
+
- Convention violations → convention checker
|
|
44
|
+
- Documentation gaps, style preferences, import ordering
|
|
45
|
+
- Performance optimization (unless also a structural improvement)
|
|
46
|
+
- Magic numbers with clear adjacent comments
|
|
47
|
+
- Small interface duplication (< 10 fields) where extraction adds indirection
|
|
48
|
+
- Issues outside the reviewed files
|
|
49
|
+
|
|
50
|
+
**Test each finding:** "Is this about CODE STRUCTURE, or about something else?"
|
|
51
|
+
|
|
52
|
+
## Step 2: Self-verify
|
|
53
|
+
|
|
54
|
+
1. **Structure test**: genuinely structural? not a bug, convention, or doc issue?
|
|
55
|
+
2. **Impact test**: would a developer actually struggle with this?
|
|
56
|
+
3. **Intentional pattern**: used consistently across the codebase? → by-design, drop.
|
|
57
|
+
4. **Separation benefit**: < ~150 lines AND tightly coupled? → splitting adds overhead, drop.
|
|
58
|
+
5. **Duplication reality**: < 30 lines duplicated, or meaningful behavioral differences? → drop.
|
|
59
|
+
|
|
60
|
+
**Quality over quantity: 3 verified structural findings > 10 mixed findings.**
|
|
61
|
+
|
|
62
|
+
## Constraints
|
|
63
|
+
|
|
64
|
+
- Analysis only. Do NOT modify any files.
|
|
65
|
+
- Do NOT provide corrected code blocks. Describe issues in words only.
|
|
66
|
+
- Only report structural issues with real evidence.
|
|
67
|
+
|
|
68
|
+
## Output Format
|
|
69
|
+
|
|
70
|
+
### [HIGH|MEDIUM|LOW] title
|
|
71
|
+
|
|
72
|
+
- **File**: path/to/file.ts:42
|
|
73
|
+
- **Evidence**: what you observed (include code snippet)
|
|
74
|
+
- **Issue**: what the structural problem is
|
|
75
|
+
- **Suggestion**: how to improve it (in words, not code)
|
|
76
|
+
|
|
77
|
+
Impact levels:
|
|
78
|
+
- HIGH: Major structural problem. Significantly harder to understand or modify safely.
|
|
79
|
+
- MEDIUM: Notable concern. Unnecessary complexity or meaningful duplication.
|
|
80
|
+
- LOW: Improvement opportunity. Cleaner structure exists but current is workable.
|
|
81
|
+
|
|
82
|
+
Start with:
|
|
83
|
+
|
|
84
|
+
## Refactoring Analysis Results
|
|
85
|
+
|
|
86
|
+
### Summary
|
|
87
|
+
- Files deep-reviewed: N (list them)
|
|
88
|
+
- Findings: X HIGH, Y MEDIUM, Z LOW
|
|
89
|
+
|
|
90
|
+
### Findings
|
|
91
|
+
[findings here]
|
|
92
|
+
```
|