@simplysm/sd-claude 13.0.0-beta.21 → 13.0.31

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.
Files changed (61) hide show
  1. package/README.md +509 -15
  2. package/claude/agents/sd-api-reviewer.md +1 -1
  3. package/claude/agents/sd-code-reviewer.md +1 -1
  4. package/claude/agents/sd-code-simplifier.md +1 -1
  5. package/claude/agents/sd-security-reviewer.md +82 -0
  6. package/claude/rules/sd-language.md +7 -0
  7. package/claude/rules/sd-naming-conventions.md +13 -0
  8. package/claude/rules/sd-simplysm-docs.md +52 -0
  9. package/claude/rules/sd-workflow-rules.md +3 -0
  10. package/claude/skills/sd-brainstorm/SKILL.md +43 -6
  11. package/claude/skills/sd-check/SKILL.md +165 -48
  12. package/claude/skills/sd-check/baseline-analysis.md +129 -0
  13. package/claude/skills/sd-check/test-scenarios.md +172 -0
  14. package/claude/skills/sd-commit/SKILL.md +38 -17
  15. package/claude/skills/sd-debug/SKILL.md +296 -0
  16. package/claude/skills/sd-debug/condition-based-waiting-example.ts +158 -0
  17. package/claude/skills/sd-debug/condition-based-waiting.md +115 -0
  18. package/claude/skills/sd-debug/defense-in-depth.md +122 -0
  19. package/claude/skills/sd-debug/find-polluter.sh +58 -0
  20. package/claude/skills/sd-debug/root-cause-tracing.md +169 -0
  21. package/claude/skills/sd-debug/test-baseline-pressure.md +59 -0
  22. package/claude/skills/sd-explore/SKILL.md +13 -2
  23. package/claude/skills/sd-plan/SKILL.md +4 -2
  24. package/claude/skills/sd-plan-dev/SKILL.md +145 -202
  25. package/claude/skills/sd-plan-dev/code-quality-reviewer-prompt.md +25 -52
  26. package/claude/skills/sd-plan-dev/final-review-prompt.md +37 -0
  27. package/claude/skills/sd-plan-dev/implementer-prompt.md +22 -27
  28. package/claude/skills/sd-plan-dev/spec-reviewer-prompt.md +19 -23
  29. package/claude/skills/sd-readme/SKILL.md +147 -94
  30. package/claude/skills/sd-review/SKILL.md +34 -14
  31. package/claude/skills/sd-tdd/SKILL.md +1 -1
  32. package/claude/skills/sd-use/SKILL.md +1 -0
  33. package/claude/skills/sd-worktree/sd-worktree.mjs +6 -2
  34. package/dist/commands/install.d.ts +1 -13
  35. package/dist/commands/install.d.ts.map +1 -1
  36. package/dist/commands/install.js +125 -45
  37. package/dist/commands/install.js.map +1 -2
  38. package/dist/commands/npx.d.ts +2 -0
  39. package/dist/commands/npx.d.ts.map +1 -0
  40. package/dist/commands/npx.js +15 -0
  41. package/dist/commands/npx.js.map +6 -0
  42. package/dist/index.d.ts +3 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +3 -0
  45. package/dist/index.js.map +6 -0
  46. package/dist/sd-claude.d.ts +1 -6
  47. package/dist/sd-claude.d.ts.map +1 -1
  48. package/dist/sd-claude.js +11 -33
  49. package/dist/sd-claude.js.map +1 -2
  50. package/package.json +16 -12
  51. package/scripts/postinstall.mjs +15 -0
  52. package/scripts/sync-claude-assets.mjs +46 -0
  53. package/src/commands/install.ts +201 -0
  54. package/src/commands/npx.ts +18 -0
  55. package/src/index.ts +3 -0
  56. package/src/sd-claude.ts +29 -0
  57. package/claude/rules/sd-context7.md +0 -26
  58. package/dist/commands/uninstall.d.ts +0 -10
  59. package/dist/commands/uninstall.d.ts.map +0 -1
  60. package/dist/commands/uninstall.js +0 -40
  61. package/dist/commands/uninstall.js.map +0 -7
package/README.md CHANGED
@@ -1,41 +1,535 @@
1
1
  # @simplysm/sd-claude
2
2
 
3
- CLI tool for installing and uninstalling Simplysm Claude Code skills and agents. Standalone package does not require `@simplysm/sd-cli`.
3
+ Simplysm Claude Code CLI asset installer and cross-platform npx wrapper. Automatically installs Claude Code assets (skills, agents, rules) via `postinstall` when added as a dev dependency. Provides opinionated development workflows including TDD, systematic debugging, code review, planning, brainstorming, and git worktree management.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install --save-dev @simplysm/sd-claude
9
- # or
10
8
  pnpm add -D @simplysm/sd-claude
9
+ # or
10
+ npm install --save-dev @simplysm/sd-claude
11
11
  ```
12
12
 
13
- Or run directly with `npx`:
13
+ Skills, agents, and rules are automatically installed to `.claude/` on `pnpm install` / `npm install`.
14
14
 
15
- ```bash
16
- npx @simplysm/sd-claude install
17
- ```
15
+ ## How It Works
18
16
 
19
- ## Commands
17
+ When installed as a dependency, the `postinstall` script (`scripts/postinstall.mjs`) invokes the `sd-claude install` CLI command, which:
20
18
 
21
- The CLI binary name is `sd-claude`. All commands support the `--debug` option to output detailed logs.
19
+ 1. Copies all `sd-*` assets (skills, agents, rules, statusline) to the project's `.claude/` directory
20
+ 2. Configures `statusLine` in `.claude/settings.json` to use `sd-statusline.js`
21
+ 3. Configures MCP servers in `.mcp.json` (context7 and playwright) using the cross-platform npx wrapper
22
+ 4. Existing `sd-*` entries are replaced with the latest version on each install
23
+
24
+ The `prepack` script (`scripts/sync-claude-assets.mjs`) runs before `npm pack` / `npm publish` to sync assets from the project root `.claude/` directory into the package's `claude/` directory.
25
+
26
+ Updates also trigger reinstallation (`pnpm up @simplysm/sd-claude`).
27
+
28
+ ### Directory Structure (Published Package)
29
+
30
+ ```
31
+ @simplysm/sd-claude/
32
+ dist/
33
+ sd-claude.js # CLI entry point (bin)
34
+ commands/
35
+ install.js # Asset installation logic
36
+ npx.js # Cross-platform npx wrapper
37
+ scripts/
38
+ postinstall.mjs # Thin wrapper — calls `sd-claude install`
39
+ sync-claude-assets.mjs # Syncs assets from .claude/ before publish
40
+ claude/
41
+ sd-statusline.js # Status line script
42
+ rules/
43
+ sd-simplysm-docs.md # Local README documentation rule
44
+ sd-language.md # Language response rule
45
+ sd-naming-conventions.md # Function naming rule
46
+ sd-workflow-rules.md # Workflow behavior rule
47
+ agents/
48
+ sd-code-reviewer.md # Code review agent
49
+ sd-code-simplifier.md # Code simplification agent
50
+ sd-api-reviewer.md # API/DX review agent
51
+ sd-security-reviewer.md # ORM SQL injection and input validation agent
52
+ skills/
53
+ sd-brainstorm/ # Brainstorming skill
54
+ sd-plan/ # Plan writing skill
55
+ sd-plan-dev/ # Plan execution skill
56
+ sd-tdd/ # Test-driven development skill
57
+ sd-debug/ # Systematic debugging skill
58
+ sd-review/ # Comprehensive code review skill
59
+ sd-check/ # Typecheck + lint + test skill
60
+ sd-commit/ # Git commit skill
61
+ sd-readme/ # README update skill
62
+ sd-worktree/ # Git worktree management skill
63
+ sd-explore/ # Codebase analysis skill
64
+ sd-use/ # Auto skill/agent router
65
+ sd-skill/ # Skill authoring skill
66
+ sd-api-name-review/ # API naming review skill
67
+ ```
22
68
 
23
- ### install
69
+ ## CLI Commands
24
70
 
25
- Installs Claude Code skills/agents to the current project. Reads `sd-*` assets from the package's `claude/` directory and copies them to the project's `.claude/`. Existing `sd-*` entries are completely removed before new ones are copied. Also adds `statusLine` configuration to `.claude/settings.json`.
71
+ The package provides an `sd-claude` binary with two subcommands:
26
72
 
27
73
  ```bash
74
+ # Install Claude Code assets to the project's .claude/ directory
28
75
  sd-claude install
76
+
77
+ # Cross-platform npx wrapper (uses npx.cmd on Windows, npx elsewhere)
78
+ sd-claude npx -y @upstash/context7-mcp
29
79
  ```
30
80
 
31
- ### uninstall
81
+ `sd-claude install` is called automatically by the `postinstall` script. `sd-claude npx` is used in `.mcp.json` to launch MCP servers cross-platform.
32
82
 
33
- Removes `sd-*` skills/agents from the current project's `.claude/`. Also removes `statusLine` configuration from `.claude/settings.json`.
83
+ ## Programmatic API
34
84
 
35
- ```bash
36
- sd-claude uninstall
85
+ ```typescript
86
+ import { runInstall, runNpx } from "@simplysm/sd-claude";
87
+ ```
88
+
89
+ ### runInstall
90
+
91
+ ```typescript
92
+ function runInstall(): void
93
+ ```
94
+
95
+ Installs Claude Code assets to the project's `.claude/` directory. Performs:
96
+ - Finds project root via `INIT_CWD` or `node_modules` path traversal
97
+ - Skips if running inside the simplysm monorepo itself
98
+ - Cleans existing `sd-*` entries, then copies fresh versions from the package's `claude/` directory
99
+ - Configures `statusLine` in `.claude/settings.json`
100
+ - Configures MCP servers (context7, playwright) in `.mcp.json`
101
+
102
+ ### runNpx
103
+
104
+ ```typescript
105
+ function runNpx(args: string[]): void
106
+ ```
107
+
108
+ Cross-platform npx wrapper. Spawns `npx.cmd` on Windows, `npx` on other platforms. Passes all arguments through and forwards the exit code.
109
+
110
+ ## Skills
111
+
112
+ Skills are invoked via `/sd-<name>` slash commands in Claude Code.
113
+
114
+ ### sd-brainstorm
115
+
116
+ Collaborative design exploration before implementation. Helps turn ideas into fully formed designs through natural dialogue. Should be used before any creative work — creating features, building components, or modifying behavior.
117
+
118
+ ```
119
+ /sd-brainstorm add a modal component to the UI library
120
+ ```
121
+
122
+ **Process:**
123
+ - Checks project context (files, docs, recent commits)
124
+ - Asks questions one at a time (multiple choice preferred)
125
+ - Proposes 2-3 approaches with trade-offs
126
+ - Presents design in 200-300 word sections with validation
127
+ - Saves validated design to `docs/plans/YYYY-MM-DD-<topic>-design.md`
128
+ - Commits the design document to git
129
+
130
+ **Next Steps Guide:**
131
+
132
+ After design is complete, presents two workflow paths and recommends one based on scope:
133
+
134
+ ```
135
+ --- Path A: With branch isolation (recommended for features/large changes) ---
136
+ 1. /sd-worktree add <name>
137
+ 2. /sd-plan
138
+ 3. /sd-plan-dev
139
+ 4. /sd-check
140
+ 5. /sd-commit
141
+ 6. /sd-worktree merge
142
+ 7. /sd-worktree clean
143
+
144
+ --- Path B: Direct on current branch (quick fixes/small changes) ---
145
+ 1. /sd-plan
146
+ 2. /sd-plan-dev
147
+ 3. /sd-check
148
+ 4. /sd-commit
149
+ ```
150
+
151
+ **Yolo mode**: Respond with "Path A: yolo" or "Path B: yolo" to auto-execute all steps sequentially.
152
+
153
+ ### sd-plan
154
+
155
+ Creates comprehensive implementation plans with TDD, assuming the implementer has zero codebase context.
156
+
157
+ ```
158
+ /sd-plan
159
+ ```
160
+
161
+ **Process:**
162
+ - Reads requirements/spec
163
+ - Creates bite-sized tasks (2-5 minutes each)
164
+ - Each task includes: exact file paths, complete code, test commands with expected output
165
+ - Saves plan to `docs/plans/YYYY-MM-DD-<feature-name>.md`
166
+ - Auto-executes `sd-plan-dev` in yolo mode; otherwise waits for confirmation
167
+
168
+ **Plan document header format:**
169
+ ```markdown
170
+ # [Feature Name] Implementation Plan
171
+
172
+ > **For Claude:** REQUIRED SUB-SKILL: Use sd-plan-dev to implement this plan task-by-task.
173
+
174
+ **Goal:** [One sentence describing what this builds]
175
+ **Architecture:** [2-3 sentences about approach]
176
+ **Tech Stack:** [Key technologies/libraries]
177
+ ```
178
+
179
+ **Task structure:**
180
+ 1. Write the failing test
181
+ 2. Run it to verify it fails
182
+ 3. Implement minimal code
183
+ 4. Run test to verify it passes
184
+ 5. Commit
185
+
186
+ ### sd-plan-dev
187
+
188
+ Executes implementation plans with right-sized process: direct execution for small plans, parallel agents for large plans.
189
+
190
+ ```
191
+ /sd-plan-dev
192
+ ```
193
+
194
+ **Mode selection:**
195
+ - **Direct Mode** — tasks ≤ 3 AND source files ≤ 5: implement directly in main context, no agents
196
+ - **Agent Mode** — otherwise: parallel Task agents with dependency-aware scheduling
197
+
198
+ **Direct Mode process:**
199
+ 1. Read plan, implement tasks in dependency order
200
+ 2. For each task: implement, write tests, self-review
201
+ 3. After all tasks: `pnpm typecheck` + `pnpm lint` + `pnpm vitest` on affected packages
202
+
203
+ **Agent Mode process:**
204
+ - Reads plan, extracts full task text, creates TaskCreate
205
+ - Analyzes file dependencies to build a task graph
206
+ - Groups independent tasks into parallel batches
207
+ - Each task agent: implements, launches parallel spec + quality review sub-Tasks, fixes issues
208
+ - Repeats review cycle until both reviewers approve (max 3 cycles)
209
+ - Final review Task across entire implementation
210
+
211
+ **Agents used per task (Agent Mode):**
212
+ - **Task agent** (implementer) — implements the task, runs sub-Tasks for review
213
+ - **Spec reviewer** sub-Task (`model: opus`) — verifies spec compliance
214
+ - **Quality reviewer** sub-Task (`model: opus`) — reviews code quality
215
+ - **Final reviewer** sub-Task (`model: opus`) — cross-task integration check
216
+
217
+ **If task agent returns questions:** orchestrator answers and re-launches that agent; other parallel agents continue unaffected.
218
+
219
+ **After all batches complete:** if working inside a `.worktrees/` directory, guides user to run `/sd-worktree merge`.
220
+
221
+ ### sd-tdd
222
+
223
+ Test-driven development workflow. Enforces the Red-Green-Refactor cycle. Internally used by other skills; typically not invoked directly by the user.
224
+
225
+ **Iron Law:** No production code without a failing test first.
226
+
227
+ **Cycle:**
228
+ 1. **RED** - Write one minimal failing test
229
+ 2. **Verify RED** - Run test, confirm it fails for the right reason
230
+ 3. **GREEN** - Write simplest code to pass
231
+ 4. **Verify GREEN** - Run test, confirm all pass
232
+ 5. **REFACTOR** - Clean up while keeping tests green
233
+
234
+ ### sd-debug
235
+
236
+ Systematic debugging workflow. Enforces root-cause investigation before any fix attempt.
237
+
238
+ ```
239
+ /sd-debug
240
+ ```
241
+
242
+ **Iron Law:** No fixes without root-cause investigation first.
243
+
244
+ **When to use:** Any technical issue — test failures, bugs, unexpected behavior, performance problems, build failures, integration issues. Use especially under time pressure or after multiple failed fix attempts.
245
+
246
+ **Four Phases:**
247
+
248
+ 1. **Root Cause Investigation** — Read error messages carefully, reproduce consistently, check recent changes, gather evidence by adding diagnostic instrumentation at each component boundary, trace data flow backward through the call stack
249
+ 2. **Pattern Analysis** — Find working examples in the codebase, compare against references, identify differences, understand dependencies
250
+ 3. **Hypothesis and Testing** — Form a single specific hypothesis, make the smallest possible change to test it, verify before continuing
251
+ 4. **Implementation** — Create a failing test case (use `sd-tdd`), implement single fix addressing the root cause, verify fix
252
+
253
+ **3+ fixes failed:** Stop and question the architecture — discuss with the user before attempting more fixes.
254
+
255
+ **Supporting techniques** (in the skill directory):
256
+ - `root-cause-tracing.md` — Trace bugs backward through call stack
257
+ - `defense-in-depth.md` — Add validation at multiple layers
258
+ - `condition-based-waiting.md` — Replace arbitrary timeouts with condition polling
259
+
260
+ ### sd-check
261
+
262
+ Verifies code via typecheck, lint, and tests using 3 parallel haiku agents. Fixes errors automatically and re-runs until all checks pass.
263
+
264
+ ```
265
+ /sd-check
266
+ /sd-check packages/core-common
267
+ ```
268
+
269
+ **Process (4 steps, fix-and-retry):**
270
+ 1. **Environment pre-check** (parallel): verify pnpm workspace, package.json scripts, vitest config, and root package version
271
+ 2. **Launch 3 haiku agents in parallel** (single message): typecheck (`pnpm typecheck [path]`), lint (`pnpm lint --fix [path]`), test (`pnpm vitest [path] --run`)
272
+ 3. **Collect results, fix errors** in priority order: typecheck → lint → test. After 2-3 failed fix attempts on tests → recommend `/sd-debug`
273
+ 4. **Re-verify** — go back to step 2 and run all 3 agents again until all pass
274
+
275
+ **No path argument:** defaults to verifying the entire project.
276
+
277
+ ### sd-review
278
+
279
+ Multi-perspective code review of a package or path. Analysis only, no code modifications.
280
+
281
+ ```
282
+ /sd-review packages/solid
283
+ ```
284
+
285
+ **Process:**
286
+ 1. Runs `sd-explore` skill for deep code analysis (separate context, does not consume main context window)
287
+ 2. Dispatches up to 4 parallel reviewer agents via Task tool (including `sd-explore` analysis in each prompt):
288
+ - `sd-code-reviewer` — bugs, security, logic errors, conventions (always)
289
+ - `sd-code-simplifier` — complexity, duplication, readability (always)
290
+ - `sd-api-reviewer` — DX/usability, naming, type hints (always)
291
+ - `sd-security-reviewer` — ORM SQL injection, input validation (conditional: only when target contains ORM queries or service endpoints)
292
+ 3. Verifies each finding against actual code (filters invalid, handled, or misread findings)
293
+ 4. Produces comprehensive report grouped by severity
294
+
295
+ **Report sections:**
296
+
297
+ | Section | Priority |
298
+ |---------|----------|
299
+ | Architecture Summary | — |
300
+ | Critical Issues | P0 |
301
+ | Security Issues | P0 (when sd-security-reviewer ran) |
302
+ | Quality Issues | P1 |
303
+ | DX/Usability Issues | P2 |
304
+ | Simplification Opportunities | P3 |
305
+ | Convention Issues | P4 |
306
+
307
+ ### sd-commit
308
+
309
+ Creates a git commit following Conventional Commits style.
310
+
311
+ ```
312
+ /sd-commit
313
+ /sd-commit all
314
+ ```
315
+
316
+ - Without `all`: stages only context-relevant files individually (single commit)
317
+ - With `all`: may split into multiple commits grouped by intent/purpose — files across packages with the same intent go in one commit
318
+ - Commit message format: `type(scope): short description`
319
+
320
+ ### sd-readme
321
+
322
+ Syncs package README.md with current source code by comparing exports against documentation.
323
+
324
+ ```
325
+ /sd-readme # Update all package READMEs in parallel
326
+ /sd-readme packages/solid # Update a single package README
327
+ ```
328
+
329
+ **Batch mode** (no argument): discovers all packages via Glob, launches parallel sonnet subagents — one for the project root README and one per package. Reports which READMEs were updated vs. already up to date.
330
+
331
+ **Single package process:**
332
+ 1. Reads `src/index.ts` to build the export map (source of truth)
333
+ 2. Reads existing README.md to build the documentation map
334
+ 3. Diffs: ADDED (exported but not documented), REMOVED (documented but not exported), CHANGED (API signature differs), OK (matches)
335
+ 4. Reports findings and waits for user confirmation
336
+ 5. Applies updates — only touches ADDED/REMOVED/CHANGED items
337
+
338
+ ### sd-worktree
339
+
340
+ Git worktree management for branch isolation during feature work. All operations use `sd-worktree.mjs` script.
341
+
342
+ ```
343
+ /sd-worktree add modal-migration # Create worktree
344
+ /sd-worktree rebase # Rebase onto main
345
+ /sd-worktree merge # Merge into main (--no-ff)
346
+ /sd-worktree clean modal-migration # Remove worktree and branch
347
+ ```
348
+
349
+ **Target resolution:** if no name is provided in args, auto-detects from current directory if inside `.worktrees/<name>/`; otherwise asks the user.
350
+
351
+ **Commands:**
352
+
353
+ | Command | Description |
354
+ |---------|-------------|
355
+ | `add <name>` | Derive kebab-case name from description, create worktree under `.worktrees/<name>`, cd into it |
356
+ | `rebase [name]` | Rebase worktree branch onto main branch; errors if uncommitted changes exist |
357
+ | `merge [name]` | Merge worktree branch into main with `--no-ff`; errors if uncommitted changes exist |
358
+ | `clean <name>` | Remove worktree directory and delete branch; must cd to project root first |
359
+
360
+ **Full workflow:**
361
+ ```
362
+ /sd-worktree add modal-migration
363
+ # ... work in .worktrees/modal-migration ...
364
+ /sd-worktree rebase
365
+ /sd-worktree merge
366
+ cd <project-root>
367
+ /sd-worktree clean modal-migration
368
+ ```
369
+
370
+ ### sd-explore
371
+
372
+ Deep codebase analysis. Traces execution paths, maps architecture layers, and documents dependencies. Analysis only, no code modifications. Not user-invocable — called programmatically by `sd-review` and other agents.
373
+
374
+ **Covers:**
375
+ - Feature discovery (entry points, core files, boundaries)
376
+ - Code flow tracing (call chains, data transformations, side effects)
377
+ - Architecture analysis (abstraction layers, design patterns, interfaces)
378
+ - Implementation details (algorithms, error handling, performance)
379
+
380
+ ### sd-use
381
+
382
+ Auto skill/agent router. Analyzes the user request and selects the best matching `sd-*` skill or agent, explains the selection, then executes immediately.
383
+
384
+ ```
385
+ /sd-use review the solid package for bugs
386
+ # Selects sd-review and executes it
387
+ ```
388
+
389
+ **Catalog includes:** `sd-brainstorm`, `sd-debug`, `sd-tdd`, `sd-plan`, `sd-plan-dev`, `sd-explore`, `sd-review`, `sd-check`, `sd-commit`, `sd-readme`, `sd-api-name-review`, `sd-worktree`, `sd-skill` (skills), and `sd-code-reviewer`, `sd-code-simplifier`, `sd-api-reviewer`, `sd-security-reviewer` (agents).
390
+
391
+ ### sd-skill
392
+
393
+ Skill authoring tool. Creates new skills using TDD methodology applied to documentation.
394
+
395
+ ```
396
+ /sd-skill
397
+ ```
398
+
399
+ **Process (Red-Green-Refactor for documentation):**
400
+ 1. **RED** - Run pressure scenarios without skill, document baseline failures (exact rationalizations)
401
+ 2. **GREEN** - Write minimal skill addressing those specific failures
402
+ 3. **REFACTOR** - Close loopholes, add rationalization table and red flags list, re-test
403
+
404
+ **SKILL.md frontmatter:** only `name` and `description` fields (max 1024 characters). Description starts with "Use when..." and describes triggering conditions only — never summarizes the skill's workflow.
405
+
406
+ ### sd-api-name-review
407
+
408
+ Reviews a library's public API naming for consistency and industry standard alignment. Analysis only, no code modifications.
409
+
410
+ ```
411
+ /sd-api-name-review packages/solid
412
+ ```
413
+
414
+ **Phases:**
415
+ 1. Use an Explore agent to extract the public API surface (exported identifiers, parameter names, naming patterns)
416
+ 2. Research industry standard naming via parallel web-search agents for comparable libraries
417
+ 3. Comparative analysis report
418
+
419
+ | Priority | Criteria |
420
+ |----------|----------|
421
+ | **P0** | Misaligned with majority of surveyed libraries |
422
+ | **P1** | Internal inconsistency (same concept, different names) |
423
+ | **P2** | Better industry term exists (optional) |
424
+ | **Keep** | Already aligned with standards |
425
+
426
+ ## Agents
427
+
428
+ Agents are used by skills as subagents via the Task tool, or can be invoked directly.
429
+
430
+ ### sd-code-reviewer
431
+
432
+ Reviews code for bugs, logic errors, security vulnerabilities, and convention adherence. Uses confidence-based filtering (only reports issues with confidence >= 80).
433
+
434
+ **Severity levels:** Critical, Important
435
+
436
+ **Scope:** By default reviews unstaged changes from `git diff`. Can be directed to specific files.
437
+
438
+ ### sd-code-simplifier
439
+
440
+ Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Focuses on recently modified code.
441
+
442
+ **Focus areas:**
443
+ - Reduce unnecessary complexity and nesting
444
+ - Eliminate redundant code and abstractions
445
+ - Improve readability through clear naming
446
+ - Avoid nested ternaries (prefer switch/if-else)
447
+
448
+ ### sd-api-reviewer
449
+
450
+ Reviews a library's public API for developer experience (DX) quality. Uses confidence-based filtering (only reports issues with confidence >= 70).
451
+
452
+ **Review categories:**
453
+ - Naming consistency and industry standard alignment
454
+ - API intuitiveness and learning curve
455
+ - Type hints and error message quality
456
+ - Configuration complexity and boilerplate
457
+ - Usage pattern coherence
458
+
459
+ **Priority levels:** P0 (API misuse likely), P1 (significant friction), P2 (minor improvement), Keep (already aligned)
460
+
461
+ ### sd-security-reviewer
462
+
463
+ Reviews ORM queries and service endpoints for SQL injection and input validation vulnerabilities specific to simplysm's string-escaping ORM. Dispatched conditionally by `sd-review` when the target contains ORM queries or service endpoints.
464
+
465
+ **Context:** simplysm ORM uses string escaping (not parameter binding), so application-level input validation is the primary defense.
466
+
467
+ **Review checklist:**
468
+ - Input source classification (user input vs. internal data)
469
+ - Validation before ORM query: allowlist/regex for strings, `Number()` + `isNaN()` for numerics, enum allowlisting
470
+ - Service endpoint validation: RPC handler arguments, WebSocket message payloads
471
+
472
+ **Confidence threshold:** Only reports issues with confidence >= 75.
473
+
474
+ **Severity:** CRITICAL (confidence >= 90), WARNING (confidence >= 75)
475
+
476
+ ## Rules
477
+
478
+ ### sd-simplysm-docs
479
+
480
+ Instructs Claude to read `@simplysm/*` package documentation from local `node_modules/` README.md files. Includes an embedded package list so Claude can immediately identify which package to look up.
481
+
482
+ ```
483
+ # Claude automatically reads when needing @simplysm/* docs:
484
+ node_modules/@simplysm/{package-name}/README.md
37
485
  ```
38
486
 
487
+ ### sd-language
488
+
489
+ Instructs Claude to respond in the system's configured language setting, while keeping technical terms, code identifiers, and library names unchanged. English error messages and logs are preserved in their original form.
490
+
491
+ ### sd-naming-conventions
492
+
493
+ Enforces function naming conventions including prohibition of `Async` suffix (async is the default) and use of `Sync` suffix for synchronous versions when both exist.
494
+
495
+ ### sd-workflow-rules
496
+
497
+ Defines workflow behavior including the rule to not auto-proceed after skill completion — report results and stop, waiting for explicit user instructions before the next step.
498
+
499
+ ## Status Line
500
+
501
+ `sd-statusline.js` displays a Claude Code status bar with:
502
+
503
+ - Model name
504
+ - Context window usage (progress bar + percentage)
505
+ - Daily rate limit usage with reset time (via OAuth API)
506
+ - Weekly rate limit usage with reset time (via OAuth API or stdin fallback)
507
+ - Extra usage credits (if enabled)
508
+ - Current folder name
509
+
510
+ The script reads Claude Code's stdin JSON for context window and model info, and optionally fetches usage data from `https://api.anthropic.com/api/oauth/usage` using the OAuth token from `~/.claude/.credentials.json`.
511
+
512
+ ## Scripts
513
+
514
+ ### postinstall.mjs
515
+
516
+ Thin wrapper that runs automatically on `pnpm install` / `npm install`. If `dist/` exists (i.e., the package is built), it invokes `sd-claude install` CLI command. Skips silently in monorepo development environments where `dist/` has not been built yet.
517
+
518
+ ### sync-claude-assets.mjs
519
+
520
+ Runs before `npm pack` / `npm publish` (via `prepack` script). Syncs `sd-*` assets from the project root's `.claude/` directory into the package's `claude/` directory for distribution.
521
+
522
+ ## Caveats
523
+
524
+ - If using `pnpm install --ignore-scripts`, the postinstall won't run
525
+ - If using `onlyBuiltDependencies` in `pnpm-workspace.yaml`, add `@simplysm/sd-claude` to the list
526
+ - Skills and agents use the `sd-` prefix to distinguish them from user-defined assets
527
+ - Existing `sd-*` entries are always replaced with the latest version on install
528
+
529
+ ## Dependencies
530
+
531
+ - `yargs` — CLI argument parsing
532
+
39
533
  ## License
40
534
 
41
535
  Apache-2.0
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: sd-api-reviewer
3
3
  description: Reviews a library's public API for developer experience (DX) quality - naming consistency, industry standard alignment, intuitiveness, error messages, type hints, configuration complexity, and usage pattern coherence
4
- model: inherit
4
+ model: opus
5
5
  ---
6
6
 
7
7
  You are an expert API/DX reviewer who evaluates libraries from the **consumer's perspective**. Your goal is to identify friction points that developers encounter when using a package.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: sd-code-reviewer
3
3
  description: Reviews code for bugs, logic errors, security vulnerabilities, code quality issues, and adherence to project conventions, using confidence-based filtering to report only high-priority issues that truly matter
4
- model: inherit
4
+ model: opus
5
5
  ---
6
6
 
7
7
  You are an expert code reviewer specializing in modern software development across multiple languages and frameworks. Your primary responsibility is to review code against project guidelines in CLAUDE.md with high precision to minimize false positives.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: sd-code-simplifier
3
3
  description: Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Focuses on recently modified code unless instructed otherwise.
4
- model: inherit
4
+ model: opus
5
5
  ---
6
6
 
7
7
  You are an expert code simplification specialist focused on enhancing code clarity, consistency, and maintainability while preserving exact functionality. Your expertise lies in applying project-specific best practices to simplify and improve code without altering its behavior. You prioritize readable, explicit code over overly compact solutions. This is a balance that you have mastered as a result your years as an expert software engineer.
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: sd-security-reviewer
3
+ description: Reviews ORM queries and service endpoints for SQL injection and input validation vulnerabilities in simplysm's string-escaping ORM
4
+ model: opus
5
+ ---
6
+
7
+ You are a security-focused code reviewer for the simplysm framework.
8
+
9
+ ## Critical Context
10
+
11
+ simplysm ORM uses **string escaping** (NOT parameter binding) for SQL generation.
12
+ This means application-level input validation is the PRIMARY defense against SQL injection.
13
+
14
+ ### Escaping mechanisms in place:
15
+ - MySQL: Backslashes, quotes, NULL bytes, control characters escaped
16
+ - Forces utf8mb4 charset (defends against multi-byte attacks)
17
+ - These are necessary but NOT sufficient without input validation
18
+
19
+ ## Review Scope
20
+
21
+ By default, review unstaged changes from `git diff` that touch ORM queries or service endpoints. The user may specify different files or scope.
22
+
23
+ ## Review Checklist
24
+
25
+ For every ORM query in the diff, verify:
26
+
27
+ ### 1. Input Source Classification
28
+ - [ ] Identify where each query parameter originates (user input, internal data, config)
29
+ - [ ] User input = anything from HTTP request, WebSocket message, file upload
30
+
31
+ ### 2. Validation Before Query
32
+ - [ ] User-sourced strings: validated with allowlist or regex before use
33
+ - [ ] Numeric values: `Number()` conversion + `Number.isNaN()` check
34
+ - [ ] Enum values: checked against valid set before use
35
+ - [ ] No raw `req.query`, `req.params`, `req.body` values passed to ORM
36
+
37
+ ### 3. Service Endpoint Review
38
+ - [ ] All ServiceServer RPC handlers validate incoming arguments
39
+ - WebSocket message payloads validated before ORM usage
40
+ - [ ] Type coercion applied at service boundary
41
+
42
+ ### 4. Dangerous Patterns (flag these)
43
+
44
+ ```typescript
45
+ // DANGEROUS: Direct user input in query
46
+ const name = req.query.name;
47
+ db.user().where((u) => [expr.eq(u.name, name)]).result();
48
+
49
+ // SAFE: Validated first
50
+ const name = validateString(req.query.name, { maxLength: 100 });
51
+ db.user().where((u) => [expr.eq(u.name, name)]).result();
52
+
53
+ // SAFE: Type coercion with check
54
+ const id = Number(req.query.id);
55
+ if (Number.isNaN(id)) throw new Error("Invalid ID");
56
+ db.user().where((u) => [expr.eq(u.id, id)]).result();
57
+ ```
58
+
59
+ ## Confidence Scoring
60
+
61
+ Rate each potential issue on a scale from 0-100:
62
+
63
+ - **0**: Not an issue. Value comes from trusted internal source.
64
+ - **25**: Unlikely risk. Input is indirectly user-sourced but passes through type coercion.
65
+ - **50**: Moderate risk. User input reaches query but some validation exists.
66
+ - **75**: High risk. User input reaches query with insufficient validation.
67
+ - **100**: Critical. Raw user input directly in query with no validation.
68
+
69
+ **Only report issues with confidence >= 75.**
70
+
71
+ ## Output Format
72
+
73
+ Start by stating what files/endpoints you reviewed.
74
+
75
+ For each finding, provide:
76
+ - Severity: **CRITICAL** (confidence >= 90) / **WARNING** (confidence >= 75)
77
+ - File path and line number
78
+ - Input source (where the unvalidated data comes from)
79
+ - Attack vector (specific SQL injection scenario)
80
+ - Concrete fix with code example
81
+
82
+ If no issues found, confirm with a brief summary of what was checked.
@@ -0,0 +1,7 @@
1
+ # Language
2
+
3
+ Respond in the **system's configured language** (set via Claude Code's language setting).
4
+
5
+ - Technical terms, code identifiers (variable names, function names, etc.), and library names should remain as-is
6
+ - Show English error messages and logs in their original form, but provide explanations in the system language
7
+ - Files in `.claude/` folder and each package's `README.md` are written in English for consistent documentation
@@ -0,0 +1,13 @@
1
+ # Function Naming Conventions
2
+
3
+ - Do not use `Async` suffix on function names — Async is the default
4
+ - When both sync and async versions exist, use `Sync` suffix on the sync function
5
+
6
+ ```typescript
7
+ // Good
8
+ async function readFile() { ... } // Async (default)
9
+ function readFileSync() { ... } // Sync version
10
+
11
+ // Bad
12
+ async function readFileAsync() { ... } // Async suffix prohibited
13
+ ```