@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.
Files changed (37) hide show
  1. package/claude/refs/sd-code-conventions.md +102 -4
  2. package/claude/refs/sd-solid.md +13 -2
  3. package/claude/refs/sd-workflow.md +2 -1
  4. package/claude/rules/sd-claude-rules.md +18 -1
  5. package/claude/rules/sd-refs-linker.md +1 -1
  6. package/claude/sd-statusline.js +51 -9
  7. package/claude/skills/sd-api-name-review/SKILL.md +118 -13
  8. package/claude/skills/sd-brainstorm/SKILL.md +82 -8
  9. package/claude/skills/sd-check/SKILL.md +28 -14
  10. package/claude/skills/sd-commit/SKILL.md +1 -4
  11. package/claude/skills/sd-debug/SKILL.md +8 -13
  12. package/claude/skills/sd-debug/condition-based-waiting.md +5 -11
  13. package/claude/skills/sd-debug/root-cause-tracing.md +18 -33
  14. package/claude/skills/sd-explore/SKILL.md +118 -0
  15. package/claude/skills/sd-plan/SKILL.md +31 -0
  16. package/claude/skills/sd-plan-dev/SKILL.md +92 -75
  17. package/claude/skills/sd-plan-dev/code-quality-reviewer-prompt.md +1 -3
  18. package/claude/skills/sd-plan-dev/implementer-prompt.md +10 -1
  19. package/claude/skills/sd-readme/SKILL.md +1 -1
  20. package/claude/skills/sd-review/SKILL.md +128 -55
  21. package/claude/skills/sd-review/api-reviewer-prompt.md +23 -38
  22. package/claude/skills/sd-review/code-reviewer-prompt.md +26 -29
  23. package/claude/skills/sd-review/convention-checker-prompt.md +61 -0
  24. package/claude/skills/sd-review/refactoring-analyzer-prompt.md +92 -0
  25. package/claude/skills/sd-skill/SKILL.md +20 -3
  26. package/claude/skills/sd-skill/anthropic-best-practices.md +71 -1091
  27. package/claude/skills/sd-skill/testing-skills-with-subagents.md +9 -5
  28. package/claude/skills/sd-skill/writing-guide.md +7 -11
  29. package/claude/skills/sd-tdd/SKILL.md +15 -20
  30. package/claude/skills/sd-use/SKILL.md +18 -27
  31. package/claude/skills/sd-worktree/SKILL.md +58 -113
  32. package/package.json +1 -1
  33. package/claude/skills/sd-check/baseline-analysis.md +0 -150
  34. package/claude/skills/sd-check/test-scenarios.md +0 -205
  35. package/claude/skills/sd-debug/test-baseline-pressure.md +0 -61
  36. package/claude/skills/sd-review/code-simplifier-prompt.md +0 -88
  37. package/claude/skills/sd-worktree/sd-worktree.mjs +0 -152
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: sd-check
3
3
  description: "Typecheck, lint, test verification (explicit invocation only)"
4
- allowed-tools: Bash(npm run check:*), Bash(pnpm run check:*), Bash(yarn run check:*), Bash(npm run typecheck:*), Bash(pnpm run typecheck:*), Bash(yarn run typecheck:*), Bash(npm run lint:*), Bash(pnpm run lint:*), Bash(yarn run lint:*), Bash(npm run vitest:*), Bash(pnpm run vitest:*), Bash(yarn run vitest:*)
5
4
  ---
6
5
 
7
6
  # sd-check
@@ -34,19 +33,34 @@ Multiple types: `--type typecheck,lint`. No path = full project. No type = all c
34
33
 
35
34
  ## Workflow
36
35
 
37
- 1. **Run** `$PM run check [path] [--type type]` (timeout: 600000)
38
- 2. **All passed?** Report with actual output numbers → done
39
- 3. **Errors?** Fix in priority order: typecheck → lint → test (fixes cascade)
40
- - Test failures: **MUST** run `git log` to decide — update test or fix source
41
- - **E2E test failures**: use Playwright MCP to investigate before fixing
42
- 1. `browser_navigate` to the target URL
43
- 2. `browser_snapshot` / `browser_take_screenshot` (save to `.tmp/playwright/`) to see page state
44
- 3. `browser_console_messages` for JS errors
45
- 4. `browser_network_requests` for failed API calls
46
- 5. Interact with the page following the test steps to reproduce the failure
47
- 6. Fix based on observed evidence, not guesswork
48
- - Stuck after 2-3 attempts → recommend `/sd-debug`
49
- 4. **Go to 1** always re-run ALL checks after any fix
36
+ ```mermaid
37
+ flowchart TD
38
+ A[Run check] --> B{All passed?}
39
+ B -->|yes| C[Report results done]
40
+ B -->|no| D["Fix errors (typecheck lint test)"]
41
+ D --> E{Stuck after 2-3 tries?}
42
+ E -->|no| A
43
+ E -->|yes| F[Recommend /sd-debug]
44
+ ```
45
+
46
+ **Run command:** `$PM run check [path] [--type type]` (timeout: 600000)
47
+
48
+ - **Output capture:** Bash truncates long output. Always redirect to a file and read it:
49
+ ```bash
50
+ mkdir -p .tmp && $PM run check [path] [--type type] > .tmp/check-output.txt 2>&1; echo "EXIT:$?"
51
+ ```
52
+ Then use the **Read** tool on `.tmp/check-output.txt` to see the full result. Check `EXIT:0` for success or non-zero for failure.
53
+
54
+ **Fixing errors:**
55
+ - **Before fixing any code**: Read `.claude/refs/sd-code-conventions.md` and check `.claude/rules/sd-refs-linker.md` for additional refs relevant to the affected code area (e.g., `sd-solid.md` for SolidJS, `sd-orm.md` for ORM). Fixing errors does NOT exempt you from following project conventions.
56
+ - Test failures: **MUST** run `git log` to decide — update test or fix source
57
+ - **E2E test failures**: use Playwright MCP to investigate before fixing
58
+ 1. `browser_navigate` to the target URL
59
+ 2. `browser_snapshot` / `browser_take_screenshot` (save to `.tmp/playwright/`) to see page state
60
+ 3. `browser_console_messages` for JS errors
61
+ 4. `browser_network_requests` for failed API calls
62
+ 5. Interact with the page following the test steps to reproduce the failure
63
+ 6. Fix based on observed evidence, not guesswork
50
64
 
51
65
  ## Rules
52
66
 
@@ -2,7 +2,6 @@
2
2
  name: sd-commit
3
3
  description: "Git commit with conventional messages (explicit invocation only)"
4
4
  argument-hint: "[all]"
5
- allowed-tools: Bash(git status:*), Bash(git add:*), Bash(git commit:*)
6
5
  model: haiku
7
6
  ---
8
7
 
@@ -50,7 +49,7 @@ type(scope): short description
50
49
  | ------------- | ---------------------------------------------------------------------------- |
51
50
  | `type` | `feat`, `fix`, `refactor`, `docs`, `test`, `chore`, `build`, `style`, `perf` |
52
51
  | `scope` | package name or area (e.g., `solid`, `core-common`, `orm-node`) |
53
- | `description` | written in the system's configured language, imperative, lowercase, no period at end |
52
+ | `description` | English, imperative, lowercase, no period at end |
54
53
 
55
54
  Examples:
56
55
 
@@ -58,8 +57,6 @@ Examples:
58
57
  - `fix(orm-node): handle null values in bulk insert`
59
58
  - `docs: update README with new API examples`
60
59
 
61
- > **Note:** The examples above are in English for reference only. The actual description MUST be written in the system's configured language.
62
-
63
60
  Use a HEREDOC for multi-line messages when needed.
64
61
 
65
62
  ## Execution
@@ -196,25 +196,20 @@ You MUST complete each phase before proceeding to the next.
196
196
  - Issue actually resolved?
197
197
 
198
198
  4. **If Fix Doesn't Work**
199
- - STOP
200
- - Count: How many fixes have you tried?
201
- - If < 3: Return to Phase 1, re-analyze with new information
202
- - **If ≥ 3: STOP and question the architecture (step 5 below)**
203
- - DON'T attempt Fix #4 without architectural discussion
204
199
 
205
- 5. **If 3+ Fixes Failed: Question Architecture**
200
+ ```mermaid
201
+ flowchart TD
202
+ A{"Fix failed?"} --> B{"Attempts < 3?"}
203
+ B -->|yes| C["Phase 1: Re-analyze<br>with new information"]
204
+ B -->|"no (≥3)"| D["STOP: Question Architecture<br>→ Discuss with user first"]
205
+ ```
206
206
 
207
- **Pattern indicating architectural problem:**
207
+ **Signs of architectural problem (≥3 failures):**
208
208
  - Each fix reveals new shared state/coupling/problem in different place
209
209
  - Fixes require "massive refactoring" to implement
210
210
  - Each fix creates new symptoms elsewhere
211
211
 
212
- **STOP and question fundamentals:**
213
- - Is this pattern fundamentally sound?
214
- - Are we "sticking with it through sheer inertia"?
215
- - Should we refactor architecture vs. continue fixing symptoms?
216
-
217
- **Discuss with the user before attempting more fixes**
212
+ **Question fundamentals:** Is this pattern sound? Are we sticking with it through inertia? Should we refactor architecture vs. continue fixing symptoms?
218
213
 
219
214
  This is NOT a failed hypothesis - this is a wrong architecture.
220
215
 
@@ -8,17 +8,11 @@ Flaky tests often guess at timing with arbitrary delays. This creates race condi
8
8
 
9
9
  ## When to Use
10
10
 
11
- ```dot
12
- digraph when_to_use {
13
- "Test uses setTimeout/sleep?" [shape=diamond];
14
- "Testing timing behavior?" [shape=diamond];
15
- "Document WHY timeout needed" [shape=box];
16
- "Use condition-based waiting" [shape=box];
17
-
18
- "Test uses setTimeout/sleep?" -> "Testing timing behavior?" [label="yes"];
19
- "Testing timing behavior?" -> "Document WHY timeout needed" [label="yes"];
20
- "Testing timing behavior?" -> "Use condition-based waiting" [label="no"];
21
- }
11
+ ```mermaid
12
+ flowchart TD
13
+ A{"Test uses setTimeout/sleep?"} -->|yes| B{"Testing timing behavior?"}
14
+ B -->|yes| C[Document WHY timeout needed]
15
+ B -->|no| D[Use condition-based waiting]
22
16
  ```
23
17
 
24
18
  **Use when:**
@@ -8,19 +8,12 @@ Bugs often manifest deep in the call stack (git init in wrong directory, file cr
8
8
 
9
9
  ## When to Use
10
10
 
11
- ```dot
12
- digraph when_to_use {
13
- "Bug appears deep in stack?" [shape=diamond];
14
- "Can trace backwards?" [shape=diamond];
15
- "Fix at symptom point" [shape=box];
16
- "Trace to original trigger" [shape=box];
17
- "BETTER: Also add defense-in-depth" [shape=box];
18
-
19
- "Bug appears deep in stack?" -> "Can trace backwards?" [label="yes"];
20
- "Can trace backwards?" -> "Trace to original trigger" [label="yes"];
21
- "Can trace backwards?" -> "Fix at symptom point" [label="no - dead end"];
22
- "Trace to original trigger" -> "BETTER: Also add defense-in-depth";
23
- }
11
+ ```mermaid
12
+ flowchart TD
13
+ A{"Bug appears deep in stack?"} -->|yes| B{"Can trace backwards?"}
14
+ B -->|yes| C[Trace to original trigger]
15
+ B -->|"no - dead end"| D[Fix at symptom point]
16
+ C --> E["BETTER: Also add defense-in-depth"]
24
17
  ```
25
18
 
26
19
  **Use when:**
@@ -142,26 +135,18 @@ Runs tests one-by-one, stops at first polluter. See script for usage.
142
135
 
143
136
  ## Key Principle
144
137
 
145
- ```dot
146
- digraph principle {
147
- "Found immediate cause" [shape=ellipse];
148
- "Can trace one level up?" [shape=diamond];
149
- "Trace backwards" [shape=box];
150
- "Is this the source?" [shape=diamond];
151
- "Fix at source" [shape=box];
152
- "Add validation at each layer" [shape=box];
153
- "Bug impossible" [shape=doublecircle];
154
- "NEVER fix just the symptom" [shape=octagon, style=filled, fillcolor=red, fontcolor=white];
155
-
156
- "Found immediate cause" -> "Can trace one level up?";
157
- "Can trace one level up?" -> "Trace backwards" [label="yes"];
158
- "Can trace one level up?" -> "NEVER fix just the symptom" [label="no"];
159
- "Trace backwards" -> "Is this the source?";
160
- "Is this the source?" -> "Trace backwards" [label="no - keeps going"];
161
- "Is this the source?" -> "Fix at source" [label="yes"];
162
- "Fix at source" -> "Add validation at each layer";
163
- "Add validation at each layer" -> "Bug impossible";
164
- }
138
+ ```mermaid
139
+ flowchart TD
140
+ A(["Found immediate cause"]) --> B{"Can trace one level up?"}
141
+ B -->|yes| C["Trace backwards"]
142
+ B -->|no| D["NEVER fix just the symptom"]:::danger
143
+ C --> E{"Is this the source?"}
144
+ E -->|"no - keeps going"| C
145
+ E -->|yes| F["Fix at source"]
146
+ F --> G["Add validation at each layer"]
147
+ G --> H(("Bug impossible"))
148
+
149
+ classDef danger fill:#f00,color:#fff
165
150
  ```
166
151
 
167
152
  **NEVER fix just where the error appears.** Trace back to find the original trigger.
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: sd-explore
3
+ description: "Use when analyzing a large codebase (30+ files) that must be read comprehensively. Splits files into groups and dispatches parallel sub-agents to avoid context compaction and information loss."
4
+ ---
5
+
6
+ # sd-explore
7
+
8
+ ## Overview
9
+
10
+ Split a large codebase into manageable groups and dispatch parallel sub-agents, each reading its assigned files and writing results to disk. The calling skill then reads result files instead of raw source — no context compaction, no information loss.
11
+
12
+ **Core principle:** Never read 30+ files in a single agent context. Split, parallelize, write to files.
13
+
14
+ **Important:** This is a workflow the **orchestrator (main agent)** follows directly. Do NOT delegate the entire sd-explore workflow to a sub-agent — only the orchestrator has `Agent` tool access to dispatch parallel sub-agents. The orchestrator globs files, splits groups, and dispatches `Agent(Explore)` calls itself.
15
+
16
+ ## When to Use
17
+
18
+ - Codebase analysis covering 30+ source files
19
+ - Called by other skills (sd-review, sd-brainstorm, sd-debug, sd-plan) that need comprehensive file reading
20
+ - Any task where reading all files sequentially would risk context compaction
21
+
22
+ **When NOT to use:**
23
+ - < 30 files — a single agent can handle it directly
24
+ - Targeted search for a specific function/class — use Grep/Glob instead
25
+
26
+ ## Input
27
+
28
+ The calling skill provides:
29
+
30
+ 1. **Target path** — directory to explore (e.g., `packages/solid/src`)
31
+ 2. **Name** — caller identifier for output filenames (e.g., `review`, `debug`, `brainstorm`)
32
+ 3. **File patterns** — glob patterns to match (default: `**/*.ts`, `**/*.tsx`; exclude `node_modules`, `dist`)
33
+ 4. **Analysis instructions** — free-form text describing what each sub-agent should do
34
+
35
+ The analysis instructions are passed verbatim to each sub-agent. They can request anything: tags, summaries, pattern searches, specific questions, etc.
36
+
37
+ ## Workflow
38
+
39
+ ### Step 1: Discover Files
40
+
41
+ Glob all matching files under the target path.
42
+
43
+ - **< 30 files**: Run a single `Agent(subagent_type=Explore)` with the analysis instructions. No splitting needed. Write result to `.tmp/explore/{dt}_{name}.md` (where `{dt}` is current datetime as `yyyyMMddHHmmss`).
44
+ - **>= 30 files**: Proceed to Step 2.
45
+
46
+ ### Step 2: Split Into Groups
47
+
48
+ Split files into groups of **~30 files each**.
49
+
50
+ **Splitting strategy:**
51
+
52
+ 1. List all subdirectories under target
53
+ 2. Group files by subdirectory, keeping each group around 30 files
54
+ 3. If the target is mostly flat (few subdirectories), group by file proximity (alphabetical chunks)
55
+ 4. Adjacent small directories can be merged into one group
56
+ 5. A single large directory (40+ files) should be split into multiple groups
57
+
58
+ **Goal:** Balanced groups where related files stay together.
59
+
60
+ ### Step 3: Dispatch Parallel Agents
61
+
62
+ Launch one `Agent(subagent_type=Explore)` per group, **all in a single message** for true parallelism.
63
+
64
+ Each agent receives:
65
+
66
+ ```
67
+ You are exploring a section of a codebase. Read ALL assigned files and write your analysis to the output file.
68
+
69
+ **Assigned files:**
70
+ [list of file paths for this group]
71
+
72
+ **Analysis instructions:**
73
+ [caller's free-form instructions, passed verbatim]
74
+
75
+ **Output file:** .tmp/explore/{dt}_{name}-{group_index}.md
76
+
77
+ Read every assigned file. Write your complete analysis to the output file. Do NOT skip files.
78
+ ```
79
+
80
+ ### Step 4: Return Result Paths
81
+
82
+ After all agents complete, return the list of output file paths to the calling skill.
83
+
84
+ The calling skill reads these files to get the analysis results — the main context stays clean.
85
+
86
+ ## Output Format
87
+
88
+ Each sub-agent writes to its assigned output file. The format is determined by the caller's analysis instructions. If no specific format is requested, use:
89
+
90
+ ```markdown
91
+ # Explore: [directory names]
92
+
93
+ ## File Summaries
94
+ - `path/to/file.ts` — Brief description
95
+
96
+ ## Analysis
97
+ [Results per the caller's instructions]
98
+ ```
99
+
100
+ ## Why Sub-Agents Matter
101
+
102
+ The value is **context isolation**, not just speed:
103
+
104
+ - **Without sub-agents**: Reading 100+ files in the main context causes compaction. Earlier file analyses get dropped, degrading quality of later analysis steps (review, planning, etc.)
105
+ - **With sub-agents**: Each sub-agent reads ~30 files in its own context, writes results to disk, and exits. The main context only reads the summary files — staying clean for subsequent work.
106
+
107
+ ## Common Mistakes
108
+
109
+ | Mistake | Fix |
110
+ |---------|-----|
111
+ | Delegating the entire workflow to a sub-agent | The orchestrator follows sd-explore directly — only it can dispatch parallel `Agent` calls |
112
+ | Reading all files in one agent | Split into groups of ~30, dispatch parallel agents |
113
+ | Not writing results to files | Each agent MUST write to its output file — this is what prevents context bloat |
114
+ | Groups too large (50+) | Keep groups around 30 files for reliable coverage |
115
+ | Groups too small (5-10) | Wastes agent overhead — merge small directories |
116
+ | Not passing analysis instructions verbatim | The caller's instructions go to each agent as-is |
117
+ | Running agents sequentially | Launch all agents in a single message for parallelism |
118
+ | Skipping Step 1 threshold check | < 30 files don't need splitting — avoid unnecessary overhead |
@@ -18,6 +18,8 @@ Write comprehensive implementation plans assuming the engineer has zero context
18
18
 
19
19
  Assume they are a skilled developer, but know almost nothing about our toolset or problem domain. Assume they don't know good test design very well.
20
20
 
21
+ When a task uses a codebase-specific utility (hook, helper, style token) or test pattern, add a one-line explanation of what it does and the source file path. Example: "`createMountTransition(open)` — manages mount/unmount with CSS transitions (`packages/solid/src/hooks/createMountTransition.ts`)". This applies to test utilities and patterns too — if a test uses a framework-specific pattern (e.g., SolidJS `createRoot` for reactive context), explain why that pattern is needed.
22
+
21
23
  **Announce at start:** "I'm using the sd-plan skill to create the implementation plan."
22
24
 
23
25
  **Save plans to:** `docs/plans/YYYY-MM-DD-<feature-name>.md`
@@ -31,6 +33,18 @@ Assume they are a skilled developer, but know almost nothing about our toolset o
31
33
  - "Run the tests and make sure they pass" - step
32
34
  - "Commit" - step
33
35
 
36
+ **Step size limit:** If a single step produces more than ~30 lines of code, it is too large. Split it into multiple steps (e.g., "Define types and interfaces" → "Create context and hook" → "Implement provider component").
37
+
38
+ **TDD means YAGNI per step:** Step 3 ("Write minimal implementation") must implement ONLY what's needed to pass Step 1's test — nothing more. If the component needs additional behavior (e.g., FIFO eviction, remove), that behavior goes in a SUBSEQUENT task with its own failing test first. Do NOT implement the full component in one task and then test it after the fact.
39
+
40
+ ## Task Ordering
41
+
42
+ **Shared resources BEFORE consumers.** Tasks must be ordered so that every file a task imports already exists from a prior task.
43
+
44
+ - Types, config, i18n entries → before components that use them
45
+ - Provider → before components that call useX() hooks
46
+ - If Task B imports from Task A's file → Task A must come first
47
+
34
48
  ## Plan Document Header
35
49
 
36
50
  **Every plan MUST start with this header:**
@@ -103,12 +117,29 @@ git commit -m "feat: add specific feature"
103
117
  ```
104
118
  ```
105
119
 
120
+ ## Test Requirement
121
+
122
+ **Every task that creates or modifies logic MUST include a test.** No exceptions.
123
+
124
+ - If the logic is testable with unit tests → write a vitest test file. This includes: pure functions, state management, timers/lifecycle logic (use `vi.useFakeTimers()`), event handlers, and state transitions.
125
+ - If the logic is UI-only (visual rendering, Portal placement, CSS animation) → include a manual verification step with exact instructions ("Open the browser, click X, expect Y")
126
+ - The **Files:** section must list the test file: `Test: exact/path/to/tests/file.spec.ts`
127
+ - If you find yourself writing a task with no test step → **STOP and add one**
128
+
106
129
  ## Remember
107
130
  - Exact file paths always
131
+ - Cross-check the design document's file structure — every file listed in the design MUST appear in the plan (create or modify)
108
132
  - Complete code in plan (not "add validation")
133
+ - When modifying an existing file, show ALL necessary import additions/changes — not just the appended code
134
+ - Code must compile cleanly — no unused imports or variables
109
135
  - Exact commands with expected output
110
136
  - DRY, YAGNI, TDD, frequent commits
111
137
 
138
+ ## Related Skills
139
+
140
+ - **sd-brainstorm** — prerequisite: creates the design this skill plans from
141
+ - **sd-plan-dev** — executes the plan this skill creates
142
+
112
143
  ## Execution Handoff
113
144
 
114
145
  After saving the plan, **commit the plan document to git** before proceeding.
@@ -11,15 +11,11 @@ Execute plan tasks via parallel implementers with dependency-aware scheduling.
11
11
 
12
12
  ## When to Use
13
13
 
14
- ```dot
15
- digraph when_to_use {
16
- "Have implementation plan?" [shape=diamond];
17
- "sd-plan-dev" [shape=box];
18
- "Manual execution or brainstorm first" [shape=box];
19
-
20
- "Have implementation plan?" -> "sd-plan-dev" [label="yes"];
21
- "Have implementation plan?" -> "Manual execution or brainstorm first" [label="no"];
22
- }
14
+ ```mermaid
15
+ flowchart TD
16
+ A{Have implementation plan?}
17
+ A -->|yes| B[sd-plan-dev]
18
+ A -->|no| C[Manual execution or brainstorm first]
23
19
  ```
24
20
 
25
21
  ## Execution Method
@@ -37,75 +33,53 @@ All execution uses `Task(general-purpose)` for parallel execution.
37
33
 
38
34
  Independent tasks run as **parallel Task calls in a single message**. After implementers complete, spec and quality reviews run as **parallel Task calls**.
39
35
 
40
- **CRITICAL: Do NOT use `run_in_background: true`** — achieve parallelism by making multiple Task calls in a single message (foreground parallel). This ensures the orchestrator waits for all tasks to complete before proceeding to the next batch, and prevents Stop hooks from firing prematurely.
36
+ **CRITICAL: Always launch parallel tasks as multiple Task calls in a single message (foreground parallel).** Never set `run_in_background: true` it causes Stop hooks to fire prematurely. This rule applies regardless of permission mode (yolo, plan, etc.).
41
37
 
42
38
  ## The Process
43
39
 
44
- ```dot
45
- digraph process {
46
- rankdir=TB;
47
-
48
- "Read plan, extract tasks, create TaskCreate" [shape=box];
49
- "Dependency analysis: identify files per task, build graph, group into batches" [shape=box];
50
-
51
- subgraph cluster_batch {
52
- label="Per Batch (independent tasks)";
53
-
54
- subgraph cluster_parallel_implementers {
55
- label="Parallel implementer Task calls (single message)";
56
- style=dashed;
57
-
58
- subgraph cluster_implementer {
59
- label="Each Implementer";
60
- "Implement the task" [shape=box];
61
- "Questions?" [shape=diamond];
62
- "Return questions to orchestrator" [shape=box];
63
- "Re-launch with answers" [shape=box];
64
- "Commit and report" [shape=box];
65
- }
66
- }
67
-
68
- subgraph cluster_review {
69
- label="Orchestrator review loop (per implementer)";
70
-
71
- subgraph cluster_parallel_reviewers {
72
- label="Parallel reviewer Task calls (single message)";
73
- style=dashed;
74
- "Task: spec reviewer" [shape=box];
75
- "Task: quality reviewer" [shape=box];
76
- }
77
-
78
- "Any issues?" [shape=diamond];
79
- "Task: implementer fix" [shape=box];
80
- "Re-review (parallel Task calls)" [shape=box];
81
- }
82
- }
83
-
84
- "More batches?" [shape=diamond];
85
- "Batch integration check (typecheck + lint)" [shape=box];
86
- "Task: final review for entire implementation" [shape=box];
87
- "Done" [shape=ellipse];
88
-
89
- "Read plan, extract tasks, create TaskCreate" -> "Dependency analysis: identify files per task, build graph, group into batches";
90
- "Dependency analysis: identify files per task, build graph, group into batches" -> "Implement the task";
91
- "Implement the task" -> "Questions?";
92
- "Questions?" -> "Return questions to orchestrator" [label="yes"];
93
- "Return questions to orchestrator" -> "Re-launch with answers";
94
- "Re-launch with answers" -> "Implement the task";
95
- "Questions?" -> "Commit and report" [label="no"];
96
- "Commit and report" -> "Task: spec reviewer";
97
- "Commit and report" -> "Task: quality reviewer";
98
- "Task: spec reviewer" -> "Any issues?";
99
- "Task: quality reviewer" -> "Any issues?";
100
- "Any issues?" -> "Task: implementer fix" [label="yes"];
101
- "Task: implementer fix" -> "Re-review (parallel Task calls)";
102
- "Re-review (parallel Task calls)" -> "Any issues?";
103
- "Any issues?" -> "Batch integration check (typecheck + lint)" [label="no"];
104
- "Batch integration check (typecheck + lint)" -> "More batches?";
105
- "More batches?" -> "Implement the task" [label="yes, next batch"];
106
- "More batches?" -> "Task: final review for entire implementation" [label="no"];
107
- "Task: final review for entire implementation" -> "Done";
108
- }
40
+ ```mermaid
41
+ flowchart TD
42
+ A["Read plan, extract tasks, create TaskCreate"] --> B["Dependency analysis: identify files per task, build graph, group into batches"]
43
+
44
+ subgraph BATCH["Per Batch (independent tasks)"]
45
+ subgraph PAR_IMPL["Parallel implementer Task calls (single message)"]
46
+ subgraph IMPL["Each Implementer"]
47
+ C["Implement the task"] --> D{"Questions?"}
48
+ D -->|yes| E["Return questions to orchestrator"]
49
+ E --> F["Re-launch with answers"]
50
+ F --> C
51
+ D -->|no| G["Commit and report"]
52
+ end
53
+ end
54
+
55
+ subgraph REVIEW["Orchestrator review loop (per implementer)"]
56
+ subgraph PAR_REV["Parallel reviewer Task calls (single message)"]
57
+ H["Task: spec reviewer"]
58
+ I["Task: quality reviewer"]
59
+ end
60
+ J{"Any issues?"}
61
+ K["Task: implementer fix"]
62
+ L["Re-review (parallel Task calls)"]
63
+ end
64
+ end
65
+
66
+ B --> C
67
+ G --> H
68
+ G --> I
69
+ H --> J
70
+ I --> J
71
+ J -->|yes| K
72
+ K --> L
73
+ L --> J
74
+ J -->|no| M["Batch integration check (typecheck + lint)"]
75
+ M --> N{"More batches?"}
76
+ N -->|"yes, next batch"| C
77
+ N -->|no| O["Task: final review for entire implementation"]
78
+ O --> P["Run /simplify on all changed code"]
79
+ P --> Q{"Changes made?"}
80
+ Q -->|yes| R["Typecheck + lint affected packages"]
81
+ R --> S(["Done"])
82
+ Q -->|no| S
109
83
  ```
110
84
 
111
85
  ## Dependency Analysis
@@ -216,9 +190,18 @@ You: Using sd-plan-dev to execute this plan.
216
190
  [Task: final review for entire implementation]
217
191
  Final reviewer: All requirements met, ready to merge
218
192
 
193
+ [Run /simplify on all changed code]
194
+ Simplify: extracted shared validation helper, removed 2 duplicate imports
195
+ [typecheck + lint → pass]
196
+ [Commit: refactor: simplify changed code]
197
+
219
198
  Done!
220
199
  ```
221
200
 
201
+ ## Verification-Only Tasks
202
+
203
+ If a task is purely verification (no code changes — just running tests, typecheck, or manual checks), merge its checks into the batch integration check or final review rather than dispatching an implementer. These tasks exist in the plan for documentation purposes but don't need the full implementer → reviewer cycle.
204
+
222
205
  ## Batch Integration Check
223
206
 
224
207
  Between batches, run targeted verification on affected packages before starting the next batch.
@@ -232,6 +215,39 @@ $PM run lint [affected packages]
232
215
 
233
216
  This catches cross-task integration issues early — especially when the next batch depends on the current batch's output. Do NOT skip this even if individual task reviews passed.
234
217
 
218
+ If typecheck or lint fails, treat the errors as review issues: re-dispatch the implementer(s) whose changes caused the failure with the error output. After fix, re-run the integration check. Do NOT start the next batch until integration passes.
219
+
220
+ ## Final Review Dispatch
221
+
222
+ After all batches complete and pass integration checks, dispatch the final reviewer:
223
+
224
+ 1. Locate the original design document from `docs/plans/` — it shares the same date and topic as the plan file (e.g., plan `2026-03-04-dialog-confirm.md` → design `2026-03-04-dialog-confirm-design.md`)
225
+ 2. Fill `./final-review-prompt.md` with:
226
+ - The full text of the original design document
227
+ - The full text of the implementation plan
228
+ - Summaries of all completed tasks (commit SHAs, files changed, test results)
229
+ 3. Dispatch as `Task(general-purpose)`
230
+ 4. If the final reviewer returns **APPROVED** → done
231
+ 5. If the final reviewer returns **ISSUES**:
232
+ - For cross-task integration issues: create a fix task targeting specific files, run through implementer → review cycle
233
+ - For missing design requirements: create new implementation tasks and run through the full batch cycle
234
+ - Re-run final review after all fixes
235
+
236
+ ## Simplify
237
+
238
+ After the final review passes, run `/simplify` to review all changed code for reuse, quality, and efficiency. This catches cross-task cleanup opportunities that individual reviewers miss.
239
+
240
+ 1. Orchestrator runs `/simplify` via the Skill tool
241
+ 2. If simplify made changes:
242
+ - Run typecheck/lint on affected packages
243
+ - If typecheck/lint fails → fix the issues and re-run typecheck/lint until it passes
244
+ - Commit simplify changes as a separate commit (`refactor: simplify changed code`)
245
+ 3. If simplify made no changes → skip to completion
246
+
247
+ ## Completion
248
+
249
+ After simplify completes (or is skipped), report to the user: number of tasks completed, total files changed, and final review outcome.
250
+
235
251
  ## Red Flags
236
252
 
237
253
  **Never:**
@@ -246,6 +262,7 @@ This catches cross-task integration issues early — especially when the next ba
246
262
  - Accept "close enough" on spec compliance
247
263
  - Skip review loops (issue found → fix → re-review)
248
264
  - Skip batch integration checks between batches
265
+ - Skip `/simplify` after final review
249
266
  - Use `run_in_background: true` on Task calls (use foreground parallel instead)
250
267
 
251
268
  **If implementer returns questions:**
@@ -13,11 +13,9 @@ You are reviewing code quality for a completed implementation.
13
13
  ## Review Scope
14
14
 
15
15
  Use git diff to review only what changed:
16
- ```
17
16
 
18
- git diff [BASE_SHA]..[HEAD_SHA]
17
+ git diff [BASE_SHA]..[HEAD_SHA]
19
18
 
20
- ```
21
19
  BASE_SHA: [commit before task started]
22
20
  HEAD_SHA: [implementer's commit SHA from report]
23
21
 
@@ -20,12 +20,20 @@ You are implementing Task [N]: [task name]
20
20
 
21
21
  If anything is unclear about requirements or approach, return your questions under a `## Questions` heading and STOP. Do not guess — do not implement.
22
22
 
23
+ ## Plan Deviations
24
+
25
+ Plans may contain minor inaccuracies (wrong file paths, outdated API signatures, incorrect line numbers). Handle deviations by severity:
26
+
27
+ - **Minor** (file path renamed, import path different, line numbers shifted): Adapt to the actual codebase and note the deviation in your report.
28
+ - **Major** (API doesn't exist, approach fundamentally different, missing dependency): Return your questions under `## Questions` and STOP.
29
+
23
30
  ## While You Work
24
31
 
25
32
  If you encounter something unexpected mid-implementation (missing APIs, unexpected patterns, ambiguous behavior), **ask questions rather than guess**. Return your questions under `## Questions` and STOP. It's always OK to pause and clarify.
26
33
 
27
34
  ## Your Job
28
35
 
36
+ 0. **Before writing any code**: Read `.claude/refs/sd-code-conventions.md` and check `.claude/rules/sd-refs-linker.md` for additional refs relevant to the code you'll touch (e.g., `sd-solid.md` for SolidJS, `sd-orm.md` for ORM). Follow all project conventions — implementing a task does NOT exempt you from conventions.
29
37
  1. Implement exactly what the task specifies — nothing more, nothing less
30
38
  2. Write tests (follow TDD if the plan says to)
31
39
  3. Verify: tests pass, no type errors
@@ -35,7 +43,7 @@ If you encounter something unexpected mid-implementation (missing APIs, unexpect
35
43
  - **Discipline**: Nothing overbuilt (YAGNI)? Only what was requested?
36
44
  - **Testing**: Tests verify behavior (not implementation)? Comprehensive?
37
45
  5. Fix anything found in self-review
38
- 6. Commit your work with a descriptive message (this is required for review)
46
+ 6. Commit using conventional commit format: `type(scope): description` (e.g., `feat(solid): add ConfirmDialog component`)
39
47
  7. Report back
40
48
 
41
49
  Work from: [directory path]
@@ -45,6 +53,7 @@ Work from: [directory path]
45
53
  When done, provide:
46
54
  - Commit SHA (from step 6)
47
55
  - Files created/modified (with brief description of changes)
56
+ - Plan deviations (if any — what the plan said vs. what you did and why)
48
57
  - Test results
49
58
  - Self-review findings (if any were fixed)
50
59
  - Open concerns (if any)