@simplysm/sd-claude 13.0.72 → 13.0.74
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/README.md +286 -13
- package/claude/refs/sd-code-conventions.md +11 -0
- package/claude/rules/sd-claude-rules.md +13 -2
- package/claude/skills/sd-brainstorm/SKILL.md +1 -1
- package/claude/skills/sd-check/SKILL.md +15 -6
- package/claude/skills/sd-commit/SKILL.md +2 -0
- package/claude/skills/sd-debug/find-polluter.sh +8 -2
- package/claude/skills/sd-debug/root-cause-tracing.md +2 -2
- package/claude/skills/sd-plan/SKILL.md +11 -2
- package/claude/skills/sd-plan-dev/SKILL.md +5 -3
- package/claude/skills/sd-plan-dev/final-review-prompt.md +3 -3
- package/claude/skills/sd-readme/SKILL.md +86 -106
- package/claude/skills/sd-review/SKILL.md +58 -62
- package/claude/skills/sd-review/api-reviewer-prompt.md +90 -0
- package/claude/skills/sd-review/code-reviewer-prompt.md +85 -0
- package/claude/skills/sd-review/code-simplifier-prompt.md +88 -0
- package/dist/commands/auth-list.d.ts +1 -1
- package/dist/commands/auth-list.d.ts.map +1 -1
- package/dist/commands/auth-list.js +79 -21
- package/dist/commands/auth-list.js.map +1 -1
- package/dist/sd-claude.js +2 -2
- package/dist/sd-claude.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/auth-list.ts +110 -24
- package/src/sd-claude.ts +2 -2
- package/tests/auth-list.spec.ts +42 -19
- package/claude/agents/sd-api-reviewer.md +0 -81
- package/claude/agents/sd-code-reviewer.md +0 -48
- package/claude/agents/sd-code-simplifier.md +0 -47
- package/claude/agents/sd-security-reviewer.md +0 -92
|
@@ -7,73 +7,59 @@ model: sonnet
|
|
|
7
7
|
|
|
8
8
|
# sd-readme
|
|
9
9
|
|
|
10
|
-
Sync package README.md source
|
|
10
|
+
Sync package README.md with current source code by comparing exports against documentation.
|
|
11
11
|
|
|
12
12
|
## Purpose
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
README.md is the **sole API documentation source for Claude Code**. When Claude Code works in a consumer app using `@simplysm/*` packages, it reads README.md from `node_modules/` to understand the library API. Claude Code does NOT read JSDoc from source files.
|
|
15
15
|
|
|
16
|
-
**
|
|
16
|
+
**Therefore: every exported symbol must be documented in README.**
|
|
17
17
|
|
|
18
18
|
## Modes
|
|
19
19
|
|
|
20
20
|
- **Single package** (`$ARGUMENTS` = package name or path): Update one package's README
|
|
21
21
|
- **Batch** (`$ARGUMENTS` empty): Discover and update all packages in parallel
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## README Writing Rules
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
| License | Behavioral descriptions |
|
|
25
|
+
- Written in **English**
|
|
26
|
+
- All code examples must include **import paths**: `import { ... } from "@simplysm/..."`
|
|
27
|
+
- **Every export** from `index.ts` must be documented — including those with `@internal` JSDoc
|
|
28
|
+
- No changelog, version history, or "recently updated" sections
|
|
29
|
+
- Section organization follows `index.ts` `#region` structure
|
|
30
|
+
- Heading levels: `##` for major sections, `###` for sub-sections
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
### Standard Structure
|
|
34
33
|
|
|
35
34
|
```markdown
|
|
36
35
|
# @simplysm/{package-name}
|
|
37
36
|
|
|
38
|
-
{One-line description
|
|
37
|
+
{One-line description}
|
|
39
38
|
|
|
40
39
|
## Installation
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
**Peer Dependencies:** (if any)
|
|
41
|
+
## Main Modules
|
|
45
42
|
|
|
46
|
-
|
|
43
|
+
### {Category matching index.ts #region}
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
{Include brief code snippets for wiring, NOT per-component API}
|
|
45
|
+
- Description + code examples per export
|
|
50
46
|
|
|
51
|
-
##
|
|
47
|
+
## Types
|
|
52
48
|
|
|
53
|
-
|
|
49
|
+
## Dependencies (only when peer deps exist)
|
|
50
|
+
```
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|--------|---------|-------------|------|
|
|
57
|
-
| `src/path/to/File.tsx` | `ComponentA`, `ComponentB` | Brief one-line description | `File.test.tsx` |
|
|
58
|
-
| `src/path/to/types.ts` | `TypeA`, `TypeB` | Type definitions for X | - |
|
|
52
|
+
### docs/ Subfolder Rules
|
|
59
53
|
|
|
60
|
-
|
|
61
|
-
```
|
|
54
|
+
When README exceeds ~500 lines, split detailed documentation into `docs/`:
|
|
62
55
|
|
|
63
|
-
**
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
- Description column: brief one-line summary of what the file provides (enough for Claude Code to decide whether to read the source)
|
|
67
|
-
- Test column: test file name if exists, `-` if not
|
|
68
|
-
- Source paths relative to package root
|
|
56
|
+
- README.md becomes an **overview/index** with links: `[functionName](docs/category.md#anchor)`
|
|
57
|
+
- docs/ files contain detailed descriptions, full code examples, parameter tables
|
|
58
|
+
- File organization follows index.ts `#region` (e.g., `docs/types.md`, `docs/utils.md`)
|
|
69
59
|
|
|
70
|
-
|
|
60
|
+
When README is under ~500 lines, keep everything inline.
|
|
71
61
|
|
|
72
|
-
|
|
73
|
-
- Sections follow `index.ts` `#region` structure
|
|
74
|
-
- **Every `export *`** from `index.ts` must appear in source index
|
|
75
|
-
- No changelog, version history, or "recently updated" sections
|
|
76
|
-
- Configuration section: only setup/wiring patterns, NOT per-component API
|
|
62
|
+
**If docs/ already exists, maintain and update it. Do not remove an existing docs/ structure.**
|
|
77
63
|
|
|
78
64
|
## Single Package Mode
|
|
79
65
|
|
|
@@ -84,66 +70,62 @@ If not starting with `packages/`, prepend it.
|
|
|
84
70
|
|
|
85
71
|
### Step 2: Build Export Map (Source of Truth)
|
|
86
72
|
|
|
87
|
-
1. Read `<pkg-path>/src/index.ts` — get all
|
|
88
|
-
2. For each
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
73
|
+
1. Read `<pkg-path>/src/index.ts` — get all exports and their `#region` grouping
|
|
74
|
+
2. For each exported module, read the source file to extract:
|
|
75
|
+
- Function signatures (params, return type, overloads)
|
|
76
|
+
- Class public API (constructor, methods, properties)
|
|
77
|
+
- Type/interface definitions
|
|
78
|
+
- Default values, options objects
|
|
93
79
|
|
|
94
|
-
### Step 3: Build
|
|
80
|
+
### Step 3: Build Documentation Map
|
|
95
81
|
|
|
96
|
-
Read `<pkg-path>/README.md` (if exists).
|
|
97
|
-
|
|
82
|
+
Read `<pkg-path>/README.md` (if exists). If docs/ exists, read those files too.
|
|
83
|
+
Map each documented item to its current documentation content.
|
|
98
84
|
|
|
99
85
|
### Step 4: Diff and Report
|
|
100
86
|
|
|
101
|
-
Compare export map (Step 2) against
|
|
87
|
+
Compare export map (Step 2) against documentation map (Step 3):
|
|
102
88
|
|
|
103
|
-
| Status
|
|
104
|
-
|
|
105
|
-
| **ADDED**
|
|
106
|
-
| **REMOVED** | In README
|
|
107
|
-
| **CHANGED** |
|
|
108
|
-
| **OK**
|
|
89
|
+
| Status | Meaning |
|
|
90
|
+
| ----------- | ------------------------------------ |
|
|
91
|
+
| **ADDED** | Exported in source but not in README |
|
|
92
|
+
| **REMOVED** | In README but no longer exported |
|
|
93
|
+
| **CHANGED** | Both exist but API signature differs |
|
|
94
|
+
| **OK** | Documentation matches source |
|
|
109
95
|
|
|
110
96
|
**Report to user before editing:**
|
|
111
97
|
|
|
112
98
|
```
|
|
113
|
-
ADDED (
|
|
114
|
-
-
|
|
115
|
-
-
|
|
99
|
+
ADDED (3):
|
|
100
|
+
- strToCamelCase (from utils/str.ts)
|
|
101
|
+
- objGetChainValueByDepth (from utils/obj.ts)
|
|
102
|
+
- ZipArchiveProgress type (from zip/sd-zip.ts)
|
|
116
103
|
|
|
117
104
|
REMOVED (1):
|
|
118
|
-
-
|
|
105
|
+
- oldFunction (no longer exported)
|
|
119
106
|
|
|
120
|
-
CHANGED (
|
|
121
|
-
-
|
|
107
|
+
CHANGED (2):
|
|
108
|
+
- objMerge: added `deep` parameter
|
|
109
|
+
- Set.toggle: added `addOrDel` optional parameter
|
|
122
110
|
|
|
123
|
-
OK:
|
|
111
|
+
OK: 45 items unchanged
|
|
124
112
|
```
|
|
125
113
|
|
|
126
114
|
**Wait for user confirmation before proceeding to edit.**
|
|
127
115
|
|
|
128
116
|
### Step 5: Apply Updates
|
|
129
117
|
|
|
130
|
-
- **ADDED**:
|
|
131
|
-
- **REMOVED**: Delete
|
|
132
|
-
- **CHANGED**: Update
|
|
118
|
+
- **ADDED**: Write documentation matching existing style. Place in the section matching the item's `#region` in index.ts. Include description + code example with import path.
|
|
119
|
+
- **REMOVED**: Delete the documentation entry.
|
|
120
|
+
- **CHANGED**: Update existing entry to match current API. Preserve code examples if still valid.
|
|
133
121
|
- **OK**: Do not touch.
|
|
134
122
|
|
|
135
|
-
|
|
123
|
+
**If README uses docs/ links**: update the corresponding docs/ file, not just README.
|
|
136
124
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
NOTE: docs/ subfolder exists with old-style full documentation.
|
|
141
|
-
Source index approach makes docs/ redundant.
|
|
142
|
-
Files: docs/form-controls.md, docs/providers.md, ...
|
|
143
|
-
Remove docs/ folder? (requires user confirmation)
|
|
144
|
-
```
|
|
125
|
+
### Step 6: Size Check
|
|
145
126
|
|
|
146
|
-
|
|
127
|
+
After updates, if README exceeds ~500 lines and no docs/ exists:
|
|
128
|
+
suggest splitting to the user (do not auto-split without confirmation).
|
|
147
129
|
|
|
148
130
|
## Batch Mode
|
|
149
131
|
|
|
@@ -155,33 +137,31 @@ When `$ARGUMENTS` is empty:
|
|
|
155
137
|
**Per-package subagent prompt template:**
|
|
156
138
|
|
|
157
139
|
```
|
|
158
|
-
Update README.md
|
|
140
|
+
Update README.md for package {pkg-name} at {pkg-path}.
|
|
159
141
|
|
|
160
|
-
PURPOSE: README.md is
|
|
161
|
-
|
|
142
|
+
PURPOSE: README.md is the sole API documentation source for Claude Code.
|
|
143
|
+
Every exported symbol must be documented. Claude Code does NOT read JSDoc.
|
|
162
144
|
|
|
163
145
|
STEPS:
|
|
164
|
-
1. Read {pkg-path}/src/index.ts — get all
|
|
165
|
-
2. For each export,
|
|
166
|
-
3. Read
|
|
167
|
-
4.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
- REMOVED: delete
|
|
171
|
-
- CHANGED: update
|
|
146
|
+
1. Read {pkg-path}/src/index.ts — get all exports and #region grouping.
|
|
147
|
+
2. For each export, read the source file for signatures, classes, types.
|
|
148
|
+
3. Read {pkg-path}/README.md (and docs/ if exists).
|
|
149
|
+
4. Compare exports vs documentation:
|
|
150
|
+
- ADDED (in source, not in README): add documentation with description + code example.
|
|
151
|
+
Include import path: import { X } from "@simplysm/{pkg-name}"
|
|
152
|
+
- REMOVED (in README, not in source): delete documentation.
|
|
153
|
+
- CHANGED (both exist, API differs): update to match current API.
|
|
172
154
|
- OK: don't touch.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
155
|
+
5. Section organization follows index.ts #region structure.
|
|
156
|
+
6. Write in English. No changelog sections.
|
|
157
|
+
7. If README doesn't exist, create with standard structure:
|
|
176
158
|
# @simplysm/{pkg-name}
|
|
177
159
|
{description from package.json}
|
|
178
160
|
## Installation
|
|
179
|
-
##
|
|
180
|
-
##
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
Description: brief one-line summary of what the file provides.
|
|
184
|
-
10. Report: list of ADDED/REMOVED/CHANGED items.
|
|
161
|
+
## Main Modules (sections per #region)
|
|
162
|
+
## Types
|
|
163
|
+
8. If docs/ subfolder exists, update those files too.
|
|
164
|
+
9. Report: list of ADDED/REMOVED/CHANGED items.
|
|
185
165
|
```
|
|
186
166
|
|
|
187
167
|
**Project root subagent prompt:**
|
|
@@ -198,14 +178,14 @@ Report what was changed.
|
|
|
198
178
|
|
|
199
179
|
## Common Mistakes
|
|
200
180
|
|
|
201
|
-
| Mistake
|
|
202
|
-
|
|
203
|
-
|
|
|
204
|
-
|
|
|
205
|
-
|
|
|
206
|
-
|
|
|
207
|
-
|
|
|
208
|
-
| Writing in Korean
|
|
209
|
-
| Adding changelog sections
|
|
210
|
-
| Editing before reporting diff
|
|
211
|
-
|
|
|
181
|
+
| Mistake | Fix |
|
|
182
|
+
| ------------------------------------- | ------------------------------------------------------------------- |
|
|
183
|
+
| Skipping exports with @internal JSDoc | Document ALL exports — Claude Code doesn't read JSDoc |
|
|
184
|
+
| Rewriting OK sections | Only touch ADDED/REMOVED/CHANGED items |
|
|
185
|
+
| Ignoring existing docs/ structure | If docs/ exists, update those files too |
|
|
186
|
+
| Arbitrary section reorganization | Follow index.ts `#region` structure |
|
|
187
|
+
| Missing import paths in examples | Always: `import { X } from "@simplysm/..."` |
|
|
188
|
+
| Writing in Korean | README must be in English |
|
|
189
|
+
| Adding changelog sections | Never add version history |
|
|
190
|
+
| Editing before reporting diff | Always report ADDED/REMOVED/CHANGED and wait for confirmation |
|
|
191
|
+
| Destroying docs/ link format | If README uses `[name](docs/file.md#anchor)`, preserve that pattern |
|
|
@@ -9,104 +9,100 @@ description: "Comprehensive multi-perspective code review (explicit invocation o
|
|
|
9
9
|
|
|
10
10
|
Perform a multi-perspective code review of a package or specified path, producing a comprehensive report. **Analysis only — no code modifications.**
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Dispatches up to 3 reviewer agents in parallel using prompt templates. Each agent independently explores the codebase from its own perspective. Collects results, verifies findings against actual code, and compiles the final report.
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
16
|
-
- `/sd-review packages/solid` — review
|
|
16
|
+
- `/sd-review packages/solid` — full review (all 3 perspectives)
|
|
17
|
+
- `/sd-review packages/solid focus on bugs` — selective review based on request
|
|
17
18
|
- `/sd-review` — if no argument, ask the user for the target path
|
|
18
19
|
|
|
19
|
-
## When to Use
|
|
20
|
-
|
|
21
|
-
- Before merging major features or after significant refactoring
|
|
22
|
-
- When assessing overall code quality of a package
|
|
23
|
-
- When onboarding to unfamiliar code and want a quality overview
|
|
24
|
-
|
|
25
|
-
**When NOT to use:**
|
|
26
|
-
|
|
27
|
-
- Single-file or trivial changes (typo, config tweak)
|
|
28
|
-
- When you need code modifications (sd-review is analysis-only)
|
|
29
|
-
|
|
30
20
|
## Target Selection
|
|
31
21
|
|
|
32
|
-
- With argument:
|
|
22
|
+
- With argument: review source code at the given path
|
|
33
23
|
- Without argument: ask the user for the target path
|
|
34
24
|
|
|
35
25
|
**Important:** Review ALL source files under the target path. Do not use git status or git diff to limit scope.
|
|
36
26
|
|
|
37
|
-
## Reviewer
|
|
27
|
+
## Reviewer Perspectives
|
|
38
28
|
|
|
39
|
-
|
|
29
|
+
| Reviewer | Prompt Template | Perspective |
|
|
30
|
+
|----------|----------------|-------------|
|
|
31
|
+
| **Code Reviewer** | `code-reviewer-prompt.md` | Correctness & Safety — bugs, security, logic errors |
|
|
32
|
+
| **API Reviewer** | `api-reviewer-prompt.md` | Usability & DX — naming, types, consistency |
|
|
33
|
+
| **Code Simplifier** | `code-simplifier-prompt.md` | Maintainability — complexity, duplication, structure |
|
|
40
34
|
|
|
41
|
-
|
|
42
|
-
| ---------------------- | --------------------------------------------------- | ---------------------------------------------------------- |
|
|
43
|
-
| `sd-code-reviewer` | Bugs, security, logic errors, convention issues | Always |
|
|
44
|
-
| `sd-code-simplifier` | Complexity, duplication, readability issues | Always |
|
|
45
|
-
| `sd-api-reviewer` | DX/usability, naming, type hints | Always |
|
|
46
|
-
| `sd-security-reviewer` | ORM SQL injection, input validation vulnerabilities | When target path contains ORM queries or service endpoints |
|
|
35
|
+
## Reviewer Selection
|
|
47
36
|
|
|
48
|
-
|
|
37
|
+
By default, run **all 3 reviewers**. If the user specifies a focus in natural language, select only the relevant reviewer(s):
|
|
49
38
|
|
|
50
|
-
|
|
39
|
+
| User says | Run |
|
|
40
|
+
|-----------|-----|
|
|
41
|
+
| "bugs", "security", "safety" | Code Reviewer only |
|
|
42
|
+
| "API", "naming", "types", "DX" | API Reviewer only |
|
|
43
|
+
| "complexity", "duplication", "structure", "maintainability" | Code Simplifier only |
|
|
44
|
+
| "bugs and API" | Code Reviewer + API Reviewer |
|
|
45
|
+
| (no specific focus) | All 3 |
|
|
51
46
|
|
|
52
|
-
|
|
47
|
+
Use judgment for ambiguous requests. When in doubt, run all 3.
|
|
53
48
|
|
|
54
|
-
|
|
55
|
-
Task(subagent_type=Explore)
|
|
56
|
-
Prompt: "very thorough" analysis of <target-path>:
|
|
57
|
-
- Entry points, core files, module boundaries
|
|
58
|
-
- Call chains, data transformations, state changes
|
|
59
|
-
- Abstraction layers, design patterns, dependency graph
|
|
60
|
-
- Error handling, public API surface
|
|
61
|
-
```
|
|
49
|
+
## Workflow
|
|
62
50
|
|
|
63
|
-
|
|
51
|
+
### Step 1: Dispatch Reviewers
|
|
64
52
|
|
|
65
|
-
|
|
53
|
+
Read the prompt template files from this skill's directory. Replace `[TARGET_PATH]` with the actual target path. Then dispatch using `Agent(general-purpose)`:
|
|
66
54
|
|
|
67
|
-
|
|
55
|
+
```
|
|
56
|
+
Agent(subagent_type=general-purpose, prompt=<filled template>)
|
|
57
|
+
```
|
|
68
58
|
|
|
69
|
-
|
|
70
|
-
- **sd-code-simplifier**: Based on the analysis, find unnecessary complexity, code duplication, and readability issues. Each finding must include **file:line** and **evidence**. **No code modifications.**
|
|
71
|
-
- **sd-api-reviewer**: Based on the analysis, review API intuitiveness, naming consistency, type hints, error messages, and configuration complexity. Each finding must include **file:line** and **evidence**.
|
|
72
|
-
- **sd-security-reviewer** _(conditional)_: If the Explore analysis reveals ORM queries (`orm-common`, `orm-node`, query builders, `expr.eq`, `.where()`, `.result()`) or service endpoints (`ServiceServer`, RPC handlers), also dispatch this agent. Based on the analysis, find SQL injection risks, missing input validation, and unvalidated user input reaching ORM queries. Each finding must include **file:line** and **evidence**.
|
|
59
|
+
Run selected reviewers **in parallel** (multiple Agent calls in a single message).
|
|
73
60
|
|
|
74
|
-
### Step
|
|
61
|
+
### Step 2: Verify Findings
|
|
75
62
|
|
|
76
|
-
After collecting results from all
|
|
63
|
+
After collecting results from all reviewers, **Read the actual code** for each finding and verify:
|
|
77
64
|
|
|
78
|
-
- **Valid**: the issue is real → include in the report
|
|
65
|
+
- **Valid**: the issue is real AND within scope → include in the report
|
|
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.
|
|
79
72
|
- **Invalid — already handled**: handled elsewhere in the codebase (provide evidence)
|
|
80
73
|
- **Invalid — intentional pattern**: by-design architectural decision
|
|
81
74
|
- **Invalid — misread**: the reviewer misinterpreted the code
|
|
82
75
|
|
|
83
|
-
### Step
|
|
76
|
+
### Step 3: Final Report
|
|
84
77
|
|
|
85
|
-
Compile only **verified findings**
|
|
78
|
+
Compile only **verified findings** grouped by severity (not by reviewer):
|
|
86
79
|
|
|
87
|
-
|
|
80
|
+
```
|
|
81
|
+
## Review Report: <target-path>
|
|
88
82
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
| **Architecture Summary** | — | Explore analysis |
|
|
92
|
-
| **Critical Issues** | P0 | Bugs, security vulnerabilities |
|
|
93
|
-
| **Security Issues** | P0 | SQL injection, input validation (when sd-security-reviewer ran) |
|
|
94
|
-
| **Quality Issues** | P1 | Logic errors, missing error handling, performance |
|
|
95
|
-
| **DX/Usability Issues** | P2 | API intuitiveness, naming, type hints |
|
|
96
|
-
| **Simplification Opportunities** | P3 | Complexity removal, duplicate code, abstractions |
|
|
97
|
-
| **Convention Issues** | P4 | Project convention mismatches |
|
|
83
|
+
### CRITICAL
|
|
84
|
+
[verified critical findings from all reviewers]
|
|
98
85
|
|
|
99
|
-
|
|
86
|
+
### WARNING
|
|
87
|
+
[verified warning findings from all reviewers]
|
|
88
|
+
|
|
89
|
+
### INFO
|
|
90
|
+
[verified info findings from all reviewers]
|
|
91
|
+
|
|
92
|
+
### Invalid Findings Summary (optional)
|
|
93
|
+
[findings filtered out and why]
|
|
94
|
+
```
|
|
100
95
|
|
|
101
|
-
|
|
96
|
+
Each finding includes: **source reviewer**, **file:line**, **evidence**, **issue**, and **suggestion**.
|
|
102
97
|
|
|
103
98
|
## Common Mistakes
|
|
104
99
|
|
|
105
|
-
| Mistake
|
|
106
|
-
|
|
107
|
-
| Using git diff to limit review scope | Review ALL source files under target path
|
|
108
|
-
| Skipping verification step
|
|
109
|
-
| Reporting unverified issues
|
|
100
|
+
| Mistake | Fix |
|
|
101
|
+
|---------|-----|
|
|
102
|
+
| Using git diff to limit review scope | Review ALL source files under target path |
|
|
103
|
+
| Skipping verification step | Always verify reviewer findings against actual code |
|
|
104
|
+
| Reporting unverified issues | Only include verified findings in final report |
|
|
105
|
+
| Running all reviewers for focused requests | Match reviewer selection to user's request |
|
|
110
106
|
|
|
111
107
|
## Completion Criteria
|
|
112
108
|
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# API Reviewer Prompt
|
|
2
|
+
|
|
3
|
+
Template for `Agent(general-purpose)`. Fill in `[TARGET_PATH]`.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
You are reviewing a library's public API for developer experience (DX).
|
|
7
|
+
Your question: "Would a first-time developer be confused or make mistakes using this API?"
|
|
8
|
+
|
|
9
|
+
## Target
|
|
10
|
+
|
|
11
|
+
Review ALL source files at [TARGET_PATH].
|
|
12
|
+
|
|
13
|
+
## Step 1: List all source files
|
|
14
|
+
|
|
15
|
+
Use Glob to list all .ts files under the target path (exclude node_modules, dist).
|
|
16
|
+
|
|
17
|
+
## Step 2: Map the public API surface
|
|
18
|
+
|
|
19
|
+
- Read index.ts to list all exports (types, functions, constants)
|
|
20
|
+
- Read each exported type/interface/function definition
|
|
21
|
+
- Read test files and consumer code to see actual usage patterns
|
|
22
|
+
|
|
23
|
+
## Step 3: Find issues
|
|
24
|
+
|
|
25
|
+
Look for:
|
|
26
|
+
- Naming consistency: same concept with different names, inconsistent prefix/suffix
|
|
27
|
+
- Intuitiveness: behavior can't be predicted from the name alone
|
|
28
|
+
- Type design: insufficient types for autocompletion, `any` in public interfaces, generic inference failures
|
|
29
|
+
- Defaults: basic use cases requiring excessive configuration
|
|
30
|
+
- Pattern consistency: similar tasks requiring different patterns
|
|
31
|
+
|
|
32
|
+
Important: Internal consistency takes priority over external standards.
|
|
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.
|
|
35
|
+
|
|
36
|
+
Do NOT report:
|
|
37
|
+
- Bugs, security, logic errors, race conditions
|
|
38
|
+
- Code complexity, duplication, readability
|
|
39
|
+
- Do NOT use WebSearch to compare with external libraries
|
|
40
|
+
- TypeScript type system limitations that require workarounds (e.g., discriminated unions not narrowing due to template literals) — these are language constraints, not API design flaws
|
|
41
|
+
- Naming preferences where the current name is used consistently across the codebase — consistency > personal preference
|
|
42
|
+
- Minor field duplication in small interfaces (< 10 fields) where extraction adds indirection without real benefit
|
|
43
|
+
|
|
44
|
+
## Step 4: Self-verify before reporting
|
|
45
|
+
|
|
46
|
+
Before including ANY finding, verify:
|
|
47
|
+
|
|
48
|
+
1. **Severity check**: CRITICAL = developers WILL write wrong code because of this API. Not "could theoretically be confusing."
|
|
49
|
+
2. **Consistency check**: Before suggesting a rename, search ALL usages. If the name is used consistently everywhere, it's NOT a finding.
|
|
50
|
+
3. **Scope check**: Only report on the PUBLIC API of the target package. Do not report on how consumers should use it differently.
|
|
51
|
+
|
|
52
|
+
**Quality over quantity: 3 verified findings > 10 maybe-findings.**
|
|
53
|
+
|
|
54
|
+
## Constraints
|
|
55
|
+
|
|
56
|
+
- Analysis only. Do NOT modify any files.
|
|
57
|
+
- Only report issues with real evidence from the code.
|
|
58
|
+
- CRITICAL severity requires proof that the current API actively misleads — not just "could be better."
|
|
59
|
+
|
|
60
|
+
## Output Format
|
|
61
|
+
|
|
62
|
+
Use this exact format for every finding:
|
|
63
|
+
|
|
64
|
+
### [CRITICAL|WARNING|INFO] title
|
|
65
|
+
|
|
66
|
+
- **File**: path/to/file.ts:42
|
|
67
|
+
- **Evidence**: what you observed (include code snippet)
|
|
68
|
+
- **Issue**: what the problem is
|
|
69
|
+
- **Suggestion**: how to improve it
|
|
70
|
+
|
|
71
|
+
Severity:
|
|
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:
|
|
77
|
+
|
|
78
|
+
## API Review Results
|
|
79
|
+
|
|
80
|
+
### Summary
|
|
81
|
+
- Files reviewed: N
|
|
82
|
+
- Public API surface: brief description
|
|
83
|
+
- Findings: X CRITICAL, Y WARNING, Z INFO
|
|
84
|
+
|
|
85
|
+
### Findings
|
|
86
|
+
[findings here]
|
|
87
|
+
|
|
88
|
+
### Positive Observations
|
|
89
|
+
[what's already well-designed — keep these]
|
|
90
|
+
```
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Code Reviewer Prompt
|
|
2
|
+
|
|
3
|
+
Template for `Agent(general-purpose)`. Fill in `[TARGET_PATH]`.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
You are reviewing code for correctness and safety.
|
|
7
|
+
Your question: "Does this code produce wrong results or pose risks?"
|
|
8
|
+
|
|
9
|
+
## Target
|
|
10
|
+
|
|
11
|
+
Review ALL source files at [TARGET_PATH].
|
|
12
|
+
|
|
13
|
+
## Step 1: List all source files
|
|
14
|
+
|
|
15
|
+
Use Glob to list all .ts files under the target path (exclude node_modules, dist).
|
|
16
|
+
This is your review scope — every file in this list must be examined.
|
|
17
|
+
|
|
18
|
+
## Step 2: Understand the codebase
|
|
19
|
+
|
|
20
|
+
Read the project's CLAUDE.md for conventions. Then:
|
|
21
|
+
- Read index.ts to map the module structure
|
|
22
|
+
- Read each source file to understand logic flows, data transformations, error paths
|
|
23
|
+
|
|
24
|
+
## Step 3: Find issues
|
|
25
|
+
|
|
26
|
+
Look for:
|
|
27
|
+
- Bugs: null/undefined risks, off-by-one, wrong conditions, missing return values
|
|
28
|
+
- Security: injection, XSS, auth/authz gaps, sensitive data exposure, input validation
|
|
29
|
+
- Race conditions: async ordering, shared state without synchronization
|
|
30
|
+
- Resource leaks: uncleared subscriptions/listeners, unclosed handles
|
|
31
|
+
- Error handling: swallowed exceptions, wrong fallbacks, missing propagation
|
|
32
|
+
|
|
33
|
+
Do NOT report:
|
|
34
|
+
- Naming consistency, API design, type quality (including `any` types)
|
|
35
|
+
- Code complexity, duplication, readability improvements
|
|
36
|
+
- Style preferences unless they cause actual bugs
|
|
37
|
+
- Type definitions alone — a type allowing `stack?: string` is NOT a security issue unless the runtime code actually sends it unsanitized
|
|
38
|
+
- Speculative future risks — "if config were changed to X, this would break" is not a finding
|
|
39
|
+
- Issues in code OUTSIDE the target path (e.g., how other packages consume these types)
|
|
40
|
+
|
|
41
|
+
## Step 4: Self-verify before reporting
|
|
42
|
+
|
|
43
|
+
Before including ANY finding, ask yourself:
|
|
44
|
+
|
|
45
|
+
1. **Is there runtime code here that actually triggers this?** (Not just a type definition)
|
|
46
|
+
2. **Does the evidence contradict my conclusion?** (If you find a bound/limit that prevents the issue, drop it)
|
|
47
|
+
3. **Is this within the target scope?** (Not about how other packages use this code)
|
|
48
|
+
|
|
49
|
+
If you write "in practice this is unlikely because..." or "exploitability is limited because..." — that means it's NOT a real finding. Drop it.
|
|
50
|
+
|
|
51
|
+
**Quality over quantity: 3 verified findings > 10 maybe-findings.**
|
|
52
|
+
|
|
53
|
+
## Constraints
|
|
54
|
+
|
|
55
|
+
- Analysis only. Do NOT modify any files.
|
|
56
|
+
- Only report issues where the runtime behavior is demonstrably wrong or risky.
|
|
57
|
+
- If your own analysis shows the issue is mitigated, do NOT report it.
|
|
58
|
+
|
|
59
|
+
## Output Format
|
|
60
|
+
|
|
61
|
+
Use this exact format for every finding:
|
|
62
|
+
|
|
63
|
+
### [CRITICAL|WARNING|INFO] title
|
|
64
|
+
|
|
65
|
+
- **File**: path/to/file.ts:42
|
|
66
|
+
- **Evidence**: what you observed (include code snippet)
|
|
67
|
+
- **Issue**: what the problem is
|
|
68
|
+
- **Suggestion**: how to fix it
|
|
69
|
+
|
|
70
|
+
Severity:
|
|
71
|
+
- CRITICAL: Will cause bugs, outages, or security breaches
|
|
72
|
+
- WARNING: Real problem that can occur in practice
|
|
73
|
+
- INFO: Defensive improvement, low risk
|
|
74
|
+
|
|
75
|
+
Start your report with:
|
|
76
|
+
|
|
77
|
+
## Code Review Results
|
|
78
|
+
|
|
79
|
+
### Summary
|
|
80
|
+
- Files reviewed: N
|
|
81
|
+
- Findings: X CRITICAL, Y WARNING, Z INFO
|
|
82
|
+
|
|
83
|
+
### Findings
|
|
84
|
+
[findings here]
|
|
85
|
+
```
|