@simplysm/sd-claude 13.0.78 → 13.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/claude/rules/sd-claude-rules.md +4 -63
- package/claude/rules/sd-simplysm-usage.md +7 -0
- package/claude/sd-session-start.sh +10 -0
- package/claude/skills/sd-api-review/SKILL.md +89 -0
- package/claude/skills/sd-check/SKILL.md +55 -57
- package/claude/skills/sd-commit/SKILL.md +37 -42
- package/claude/skills/sd-debug/SKILL.md +75 -265
- package/claude/skills/sd-document/SKILL.md +63 -53
- package/claude/skills/sd-document/_common.py +94 -0
- package/claude/skills/sd-document/extract_docx.py +19 -48
- package/claude/skills/sd-document/extract_pdf.py +22 -50
- package/claude/skills/sd-document/extract_pptx.py +17 -40
- package/claude/skills/sd-document/extract_xlsx.py +19 -40
- package/claude/skills/sd-email-analyze/SKILL.md +23 -31
- package/claude/skills/sd-email-analyze/email-analyzer.py +79 -65
- package/claude/skills/sd-init/SKILL.md +133 -0
- package/claude/skills/sd-plan/SKILL.md +69 -120
- package/claude/skills/sd-readme/SKILL.md +106 -131
- package/claude/skills/sd-review/SKILL.md +38 -155
- package/claude/skills/sd-simplify/SKILL.md +59 -0
- package/package.json +3 -2
- package/README.md +0 -297
- package/claude/refs/sd-angular.md +0 -127
- package/claude/refs/sd-code-conventions.md +0 -155
- package/claude/refs/sd-directories.md +0 -7
- package/claude/refs/sd-library-issue.md +0 -7
- package/claude/refs/sd-migration.md +0 -7
- package/claude/refs/sd-orm-v12.md +0 -81
- package/claude/refs/sd-orm.md +0 -23
- package/claude/refs/sd-service.md +0 -5
- package/claude/refs/sd-simplysm-docs.md +0 -52
- package/claude/refs/sd-solid.md +0 -68
- package/claude/refs/sd-workflow.md +0 -25
- package/claude/rules/sd-refs-linker.md +0 -52
- package/claude/sd-statusline.js +0 -296
- package/claude/skills/sd-api-name-review/SKILL.md +0 -154
- package/claude/skills/sd-brainstorm/SKILL.md +0 -215
- package/claude/skills/sd-debug/condition-based-waiting-example.ts +0 -158
- package/claude/skills/sd-debug/condition-based-waiting.md +0 -114
- package/claude/skills/sd-debug/defense-in-depth.md +0 -128
- package/claude/skills/sd-debug/find-polluter.sh +0 -64
- package/claude/skills/sd-debug/root-cause-tracing.md +0 -168
- package/claude/skills/sd-discuss/SKILL.md +0 -91
- package/claude/skills/sd-explore/SKILL.md +0 -118
- package/claude/skills/sd-plan-dev/SKILL.md +0 -294
- package/claude/skills/sd-plan-dev/code-quality-reviewer-prompt.md +0 -49
- package/claude/skills/sd-plan-dev/final-review-prompt.md +0 -50
- package/claude/skills/sd-plan-dev/implementer-prompt.md +0 -60
- package/claude/skills/sd-plan-dev/spec-reviewer-prompt.md +0 -45
- package/claude/skills/sd-review/api-reviewer-prompt.md +0 -75
- package/claude/skills/sd-review/code-reviewer-prompt.md +0 -82
- package/claude/skills/sd-review/convention-checker-prompt.md +0 -61
- package/claude/skills/sd-review/refactoring-analyzer-prompt.md +0 -92
- package/claude/skills/sd-skill/SKILL.md +0 -417
- package/claude/skills/sd-skill/anthropic-best-practices.md +0 -156
- package/claude/skills/sd-skill/cso-guide.md +0 -161
- package/claude/skills/sd-skill/examples/CLAUDE_MD_TESTING.md +0 -200
- package/claude/skills/sd-skill/persuasion-principles.md +0 -220
- package/claude/skills/sd-skill/testing-skills-with-subagents.md +0 -408
- package/claude/skills/sd-skill/writing-guide.md +0 -159
- package/claude/skills/sd-tdd/SKILL.md +0 -385
- package/claude/skills/sd-tdd/testing-anti-patterns.md +0 -317
- package/claude/skills/sd-use/SKILL.md +0 -67
- package/claude/skills/sd-worktree/SKILL.md +0 -78
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
# Root Cause Tracing
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
Bugs often manifest deep in the call stack (git init in wrong directory, file created in wrong location, database opened with wrong path). Your instinct is to fix where the error appears, but that's treating a symptom.
|
|
6
|
-
|
|
7
|
-
**Core principle:** Trace backward through the call chain until you find the original trigger, then fix at the source.
|
|
8
|
-
|
|
9
|
-
## When to Use
|
|
10
|
-
|
|
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"]
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
**Use when:**
|
|
20
|
-
|
|
21
|
-
- Error happens deep in execution (not at entry point)
|
|
22
|
-
- Stack trace shows long call chain
|
|
23
|
-
- Unclear where invalid data originated
|
|
24
|
-
- Need to find which test/code triggers the problem
|
|
25
|
-
|
|
26
|
-
## The Tracing Process
|
|
27
|
-
|
|
28
|
-
### 1. Observe the Symptom
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
Error: git init failed in /Users/jesse/project/packages/core
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### 2. Find Immediate Cause
|
|
35
|
-
|
|
36
|
-
**What code directly causes this?**
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
await execFileAsync("git", ["init"], { cwd: projectDir });
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### 3. Ask: What Called This?
|
|
43
|
-
|
|
44
|
-
```typescript
|
|
45
|
-
WorktreeManager.createSessionWorktree(projectDir, sessionId)
|
|
46
|
-
→ called by Session.initializeWorkspace()
|
|
47
|
-
→ called by Session.create()
|
|
48
|
-
→ called by test at Project.create()
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### 4. Keep Tracing Up
|
|
52
|
-
|
|
53
|
-
**What value was passed?**
|
|
54
|
-
|
|
55
|
-
- `projectDir = ''` (empty string!)
|
|
56
|
-
- Empty string as `cwd` resolves to `process.cwd()`
|
|
57
|
-
- That's the source code directory!
|
|
58
|
-
|
|
59
|
-
### 5. Find Original Trigger
|
|
60
|
-
|
|
61
|
-
**Where did empty string come from?**
|
|
62
|
-
|
|
63
|
-
```typescript
|
|
64
|
-
const context = setupCoreTest(); // Returns { tempDir: '' }
|
|
65
|
-
Project.create("name", context.tempDir); // Accessed before beforeEach!
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Adding Stack Traces
|
|
69
|
-
|
|
70
|
-
When you can't trace manually, add instrumentation:
|
|
71
|
-
|
|
72
|
-
```typescript
|
|
73
|
-
// Before the problematic operation
|
|
74
|
-
async function gitInit(directory: string) {
|
|
75
|
-
const stack = new Error().stack;
|
|
76
|
-
console.error("DEBUG git init:", {
|
|
77
|
-
directory,
|
|
78
|
-
cwd: process.cwd(),
|
|
79
|
-
nodeEnv: process.env.NODE_ENV,
|
|
80
|
-
stack,
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
await execFileAsync("git", ["init"], { cwd: directory });
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
**Critical:** Use `console.error()` in tests (not logger - may not show)
|
|
88
|
-
|
|
89
|
-
**Run and capture** (detect PM: `pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, otherwise → npm):
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
$PM test 2>&1 | grep 'DEBUG git init'
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**Analyze stack traces:**
|
|
96
|
-
|
|
97
|
-
- Look for test file names
|
|
98
|
-
- Find the line number triggering the call
|
|
99
|
-
- Identify the pattern (same test? same parameter?)
|
|
100
|
-
|
|
101
|
-
## Finding Which Test Causes Pollution
|
|
102
|
-
|
|
103
|
-
If something appears during tests but you don't know which test:
|
|
104
|
-
|
|
105
|
-
Use the bisection script `find-polluter.sh` in this directory:
|
|
106
|
-
|
|
107
|
-
```bash
|
|
108
|
-
./find-polluter.sh '.git' 'src/**/*.test.ts'
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Runs tests one-by-one, stops at first polluter. See script for usage.
|
|
112
|
-
|
|
113
|
-
## Real Example: Empty projectDir
|
|
114
|
-
|
|
115
|
-
**Symptom:** `.git` created in `packages/core/` (source code)
|
|
116
|
-
|
|
117
|
-
**Trace chain:**
|
|
118
|
-
|
|
119
|
-
1. `git init` runs in `process.cwd()` ← empty cwd parameter
|
|
120
|
-
2. WorktreeManager called with empty projectDir
|
|
121
|
-
3. Session.create() passed empty string
|
|
122
|
-
4. Test accessed `context.tempDir` before beforeEach
|
|
123
|
-
5. setupCoreTest() returns `{ tempDir: '' }` initially
|
|
124
|
-
|
|
125
|
-
**Root cause:** Top-level variable initialization accessing empty value
|
|
126
|
-
|
|
127
|
-
**Fix:** Made tempDir a getter that throws if accessed before beforeEach
|
|
128
|
-
|
|
129
|
-
**Also added defense-in-depth:**
|
|
130
|
-
|
|
131
|
-
- Layer 1: Project.create() validates directory
|
|
132
|
-
- Layer 2: WorkspaceManager validates not empty
|
|
133
|
-
- Layer 3: NODE_ENV guard refuses git init outside tmpdir
|
|
134
|
-
- Layer 4: Stack trace logging before git init
|
|
135
|
-
|
|
136
|
-
## Key Principle
|
|
137
|
-
|
|
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
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
**NEVER fix just where the error appears.** Trace back to find the original trigger.
|
|
153
|
-
|
|
154
|
-
## Stack Trace Tips
|
|
155
|
-
|
|
156
|
-
**In tests:** Use `console.error()` not logger - logger may be suppressed
|
|
157
|
-
**Before operation:** Log before the dangerous operation, not after it fails
|
|
158
|
-
**Include context:** Directory, cwd, environment variables, timestamps
|
|
159
|
-
**Capture stack:** `new Error().stack` shows complete call chain
|
|
160
|
-
|
|
161
|
-
## Real-World Impact
|
|
162
|
-
|
|
163
|
-
From debugging session (2025-10-03):
|
|
164
|
-
|
|
165
|
-
- Found root cause through 5-level trace
|
|
166
|
-
- Fixed at source (getter validation)
|
|
167
|
-
- Added 4 layers of defense
|
|
168
|
-
- 1847 tests passed, zero pollution
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sd-discuss
|
|
3
|
-
description: "Technical discussion with industry research (explicit invocation only)"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Standards-Based Technical Discussion
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
Facilitate balanced, evidence-based technical discussions by researching industry standards and project conventions BEFORE forming opinions.
|
|
11
|
-
|
|
12
|
-
## The Process
|
|
13
|
-
|
|
14
|
-
### 1. Understand the Question
|
|
15
|
-
|
|
16
|
-
Ask ONE question to understand the user's motivation:
|
|
17
|
-
|
|
18
|
-
- What problem triggered this question?
|
|
19
|
-
- What constraints matter most?
|
|
20
|
-
|
|
21
|
-
### 2. Research Before Opinions
|
|
22
|
-
|
|
23
|
-
**MANDATORY before forming any opinion:**
|
|
24
|
-
|
|
25
|
-
**Project research** (Read/Grep tools):
|
|
26
|
-
|
|
27
|
-
- Read the actual source code related to the question
|
|
28
|
-
- Check CLAUDE.md for project conventions
|
|
29
|
-
- Find similar patterns in the codebase
|
|
30
|
-
|
|
31
|
-
**Industry research** (WebSearch tool):
|
|
32
|
-
|
|
33
|
-
- Search for current community consensus and trends
|
|
34
|
-
- Check relevant specifications (TC39, W3C, RFCs)
|
|
35
|
-
- Find recent benchmarks, migration case studies, or survey data
|
|
36
|
-
- Check how popular libraries/frameworks approach this
|
|
37
|
-
|
|
38
|
-
### 3. Present Balanced Arguments
|
|
39
|
-
|
|
40
|
-
Present each option as if you were **advocating FOR it**. Equal depth, equal effort.
|
|
41
|
-
|
|
42
|
-
For each option:
|
|
43
|
-
|
|
44
|
-
- **Industry support**: Libraries, standards, and projects that use this approach (with sources)
|
|
45
|
-
- **Technical advantages**: Concrete benefits with evidence
|
|
46
|
-
- **When this wins**: Specific scenarios where this is clearly better
|
|
47
|
-
|
|
48
|
-
### 4. Project Context Analysis
|
|
49
|
-
|
|
50
|
-
- How does the current codebase align with each option?
|
|
51
|
-
- What would migration cost look like?
|
|
52
|
-
- What existing patterns favor one approach?
|
|
53
|
-
|
|
54
|
-
### 5. Decision Criteria
|
|
55
|
-
|
|
56
|
-
Provide a decision matrix — NOT a single recommendation:
|
|
57
|
-
|
|
58
|
-
| Criteria | Option A | Option B |
|
|
59
|
-
| ------------------- | -------- | -------- |
|
|
60
|
-
| Industry alignment | ... | ... |
|
|
61
|
-
| Project consistency | ... | ... |
|
|
62
|
-
| Migration cost | ... | ... |
|
|
63
|
-
| Long-term trend | ... | ... |
|
|
64
|
-
|
|
65
|
-
Then ask: "Which criteria matter most to you?"
|
|
66
|
-
|
|
67
|
-
## Key Rules
|
|
68
|
-
|
|
69
|
-
1. **Research FIRST, opinion LAST** — No opinions before WebSearch + project code reading
|
|
70
|
-
2. **Equal advocacy** — Each option gets the same depth of analysis
|
|
71
|
-
3. **Evidence over intuition** — Cite sources, show data
|
|
72
|
-
4. **No "obvious" answers** — If it were obvious, there'd be no discussion
|
|
73
|
-
5. **Interactive** — Ask questions, don't monologue
|
|
74
|
-
6. **Project-aware** — Ground the discussion in the actual codebase
|
|
75
|
-
|
|
76
|
-
## Red Flags - STOP and Research More
|
|
77
|
-
|
|
78
|
-
- Presenting one side with more depth than the other
|
|
79
|
-
- Claiming "industry standard" without citing sources
|
|
80
|
-
- Recommending without checking the project's current patterns
|
|
81
|
-
- Giving a conclusion without asking user's priorities
|
|
82
|
-
|
|
83
|
-
## Common Mistakes
|
|
84
|
-
|
|
85
|
-
| Mistake | Fix |
|
|
86
|
-
| ---------------------------------------- | ------------------------------------------- |
|
|
87
|
-
| Jump to recommendation | Research first, present balanced options |
|
|
88
|
-
| "Industry standard is X" without sources | WebSearch for actual data and citations |
|
|
89
|
-
| Ignoring project context | Read codebase patterns before discussing |
|
|
90
|
-
| Monologue instead of discussion | Ask about user's priorities and constraints |
|
|
91
|
-
| Treating "modern" as "better" | Evaluate on actual trade-offs, not trends |
|
|
@@ -1,118 +0,0 @@
|
|
|
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 |
|
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sd-plan-dev
|
|
3
|
-
description: "Parallel execution of plan tasks (explicit invocation only)"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Parallel Plan Execution
|
|
7
|
-
|
|
8
|
-
Execute plan tasks via parallel implementers with dependency-aware scheduling.
|
|
9
|
-
|
|
10
|
-
**Core principle:** Dependency analysis + parallel implementers + orchestrator-managed reviews = maximum throughput
|
|
11
|
-
|
|
12
|
-
## When to Use
|
|
13
|
-
|
|
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]
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Execution Method
|
|
22
|
-
|
|
23
|
-
All execution uses `Task(general-purpose)` for parallel execution.
|
|
24
|
-
|
|
25
|
-
- **implementer**: `Task(general-purpose, model: min(sonnet, current))` — implements one task, commits, reports
|
|
26
|
-
- **spec reviewer**: `Task(general-purpose)` — dispatched by orchestrator after implementer completes (read-only)
|
|
27
|
-
- **quality reviewer**: `Task(general-purpose)` — dispatched by orchestrator in parallel with spec reviewer (read-only)
|
|
28
|
-
- **final reviewer**: `Task(general-purpose)` — dispatched by orchestrator after all batches complete (read-only)
|
|
29
|
-
|
|
30
|
-
**Model selection:**
|
|
31
|
-
- **implementer**: use `min(sonnet, current model)`. If the user's current model is haiku, use haiku. Otherwise use sonnet.
|
|
32
|
-
- **All other agents**: inherit current model (no explicit `model` parameter).
|
|
33
|
-
|
|
34
|
-
Independent tasks run as **parallel Task calls in a single message**. After implementers complete, spec and quality reviews run as **parallel Task calls**.
|
|
35
|
-
|
|
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.).
|
|
37
|
-
|
|
38
|
-
## The Process
|
|
39
|
-
|
|
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
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Dependency Analysis
|
|
86
|
-
|
|
87
|
-
Before launching tasks, analyze the plan to build a dependency graph:
|
|
88
|
-
|
|
89
|
-
1. **For each task**: identify which files/modules it will create or modify
|
|
90
|
-
2. **Find overlaps**: tasks touching the same files depend on each other
|
|
91
|
-
3. **Respect logical dependencies**: if task B uses what task A creates, B depends on A
|
|
92
|
-
4. **Group into batches**: tasks with no dependencies between them form one batch
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
Example: 5 tasks
|
|
96
|
-
Task 1: creates utils/validator.ts
|
|
97
|
-
Task 2: creates hooks/useAuth.ts
|
|
98
|
-
Task 3: creates components/Login.tsx (uses hooks/useAuth.ts)
|
|
99
|
-
Task 4: modifies utils/validator.ts
|
|
100
|
-
Task 5: creates api/endpoints.ts
|
|
101
|
-
|
|
102
|
-
Batch 1: [Task 1, Task 2, Task 5] — independent, parallel
|
|
103
|
-
Batch 2: [Task 3] — depends on Task 2
|
|
104
|
-
Batch 3: [Task 4] — depends on Task 1
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
## Implementer Prompt
|
|
108
|
-
|
|
109
|
-
Each implementer receives a prompt based on `./implementer-prompt.md`. Fill in all `[bracketed]` sections before dispatching.
|
|
110
|
-
|
|
111
|
-
## Reviewer Dispatch
|
|
112
|
-
|
|
113
|
-
After an implementer completes and reports, the orchestrator dispatches reviewers:
|
|
114
|
-
|
|
115
|
-
1. Record the implementer's commit SHA and files changed from its report
|
|
116
|
-
2. Dispatch TWO parallel Task calls (single message):
|
|
117
|
-
- spec reviewer — fill `./spec-reviewer-prompt.md` with task requirements + implementer report
|
|
118
|
-
- quality reviewer — fill `./code-quality-reviewer-prompt.md` with implementer report + BASE_SHA/HEAD_SHA
|
|
119
|
-
3. If either reviewer returns CHANGES_NEEDED:
|
|
120
|
-
- Re-dispatch implementer with fix instructions (all issues from both reviewers combined)
|
|
121
|
-
- After fix, re-dispatch only the failed reviewers (parallel Task calls)
|
|
122
|
-
- Repeat until both approve
|
|
123
|
-
4. Proceed to next task or batch
|
|
124
|
-
|
|
125
|
-
## Prompt Templates
|
|
126
|
-
|
|
127
|
-
- `./implementer-prompt.md` — implementer instructions
|
|
128
|
-
- `./spec-reviewer-prompt.md` — spec compliance review prompt
|
|
129
|
-
- `./code-quality-reviewer-prompt.md` — code quality review prompt
|
|
130
|
-
- `./final-review-prompt.md` — final integration review prompt
|
|
131
|
-
|
|
132
|
-
## Example Workflow
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
You: Using sd-plan-dev to execute this plan.
|
|
136
|
-
|
|
137
|
-
[Read plan file: docs/plans/feature-plan.md]
|
|
138
|
-
[Extract all 5 tasks with full text + create TaskCreate]
|
|
139
|
-
|
|
140
|
-
[Dependency analysis]
|
|
141
|
-
Task 1 (validator): no deps
|
|
142
|
-
Task 2 (auth hook): no deps
|
|
143
|
-
Task 3 (login component): depends on Task 2
|
|
144
|
-
Task 4 (validator update): depends on Task 1
|
|
145
|
-
Task 5 (api endpoints): no deps
|
|
146
|
-
|
|
147
|
-
Batch 1: [Task 1, Task 2, Task 5]
|
|
148
|
-
Batch 2: [Task 3, Task 4]
|
|
149
|
-
|
|
150
|
-
--- Batch 1: parallel implementers ---
|
|
151
|
-
|
|
152
|
-
[3 parallel implementer Task calls in single message]
|
|
153
|
-
|
|
154
|
-
Implementer 1: Implemented validator, tests 5/5 pass → committed
|
|
155
|
-
Implementer 2: "Should auth use JWT or session?" (question returned)
|
|
156
|
-
Implementer 5: Implemented endpoints, tests 3/3 pass → committed
|
|
157
|
-
|
|
158
|
-
[Answer Implementer 2 question: "JWT"]
|
|
159
|
-
[Re-launch Implementer 2 with answer]
|
|
160
|
-
Implementer 2: Implemented auth hook with JWT, tests 4/4 pass → committed
|
|
161
|
-
|
|
162
|
-
[Orchestrator dispatches reviewers for each completed implementer]
|
|
163
|
-
|
|
164
|
-
Task 1 reviews: [parallel] spec ✅, quality ✅ → Done
|
|
165
|
-
Task 2 reviews: [parallel] spec ✅, quality ✅ → Done
|
|
166
|
-
Task 5 reviews: [parallel] spec ✅, quality ❌ (magic number)
|
|
167
|
-
→ Re-dispatch Implementer 5 to fix → committed
|
|
168
|
-
→ Re-review quality ✅ → Done
|
|
169
|
-
|
|
170
|
-
[Batch 1 complete → integration check]
|
|
171
|
-
|
|
172
|
-
--- Batch 2: parallel implementers ---
|
|
173
|
-
|
|
174
|
-
[2 parallel implementer Task calls in single message]
|
|
175
|
-
|
|
176
|
-
Implementer 3: Implemented login component → committed
|
|
177
|
-
Implementer 4: Updated validator → committed
|
|
178
|
-
|
|
179
|
-
[Orchestrator dispatches reviewers]
|
|
180
|
-
|
|
181
|
-
Task 3 reviews: [parallel] spec ❌ (missing error state), quality ✅
|
|
182
|
-
→ Re-dispatch Implementer 3 to fix → committed
|
|
183
|
-
→ Re-review spec ✅ → Done
|
|
184
|
-
Task 4 reviews: [parallel] spec ✅, quality ✅ → Done
|
|
185
|
-
|
|
186
|
-
[Batch 2 complete → integration check]
|
|
187
|
-
|
|
188
|
-
--- Final ---
|
|
189
|
-
|
|
190
|
-
[Task: final review for entire implementation]
|
|
191
|
-
Final reviewer: All requirements met, ready to merge
|
|
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
|
-
|
|
198
|
-
Done!
|
|
199
|
-
```
|
|
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
|
-
|
|
205
|
-
## Batch Integration Check
|
|
206
|
-
|
|
207
|
-
Between batches, run targeted verification on affected packages before starting the next batch.
|
|
208
|
-
|
|
209
|
-
Detect the package manager first (`pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, otherwise → npm):
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
$PM run typecheck [affected packages]
|
|
213
|
-
$PM run lint [affected packages]
|
|
214
|
-
```
|
|
215
|
-
|
|
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.
|
|
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
|
-
|
|
251
|
-
## Red Flags
|
|
252
|
-
|
|
253
|
-
**Never:**
|
|
254
|
-
|
|
255
|
-
- Start implementation on main/master without explicit user consent
|
|
256
|
-
- Skip reviews (spec compliance OR code quality)
|
|
257
|
-
- Proceed with unfixed issues
|
|
258
|
-
- Put tasks with file overlap in the same parallel batch
|
|
259
|
-
- Skip dependency analysis
|
|
260
|
-
- Make implementer read plan file directly (provide full text instead)
|
|
261
|
-
- Skip scene-setting context
|
|
262
|
-
- Accept "close enough" on spec compliance
|
|
263
|
-
- Skip review loops (issue found → fix → re-review)
|
|
264
|
-
- Skip batch integration checks between batches
|
|
265
|
-
- Skip `/simplify` after final review
|
|
266
|
-
- Use `run_in_background: true` on Task calls (use foreground parallel instead)
|
|
267
|
-
|
|
268
|
-
**If implementer returns questions:**
|
|
269
|
-
|
|
270
|
-
- Answer clearly and completely
|
|
271
|
-
- Re-launch that implementer with answers included
|
|
272
|
-
- Other parallel implementers continue unaffected
|
|
273
|
-
|
|
274
|
-
**If reviewers find issues:**
|
|
275
|
-
|
|
276
|
-
- Orchestrator re-dispatches implementer with all issues from both reviewers combined
|
|
277
|
-
- After fix, re-dispatch only the failed reviewers (parallel Task calls)
|
|
278
|
-
- Repeat until both approved
|
|
279
|
-
|
|
280
|
-
**If implementer fails or times out:**
|
|
281
|
-
|
|
282
|
-
- Do NOT silently proceed — the affected files may be in an indeterminate state
|
|
283
|
-
- Check if other tasks in the same batch depend on the failed task's output
|
|
284
|
-
- Independent tasks' results still stand
|
|
285
|
-
- Escalate to user with specific error details before proceeding
|
|
286
|
-
- Do NOT re-launch on potentially partially-modified files without inspection
|
|
287
|
-
|
|
288
|
-
## Integration
|
|
289
|
-
|
|
290
|
-
**Related skills:**
|
|
291
|
-
|
|
292
|
-
- **sd-plan** — creates the plan this skill executes
|
|
293
|
-
- **sd-tdd** — implementers follow TDD
|
|
294
|
-
- **sd-worktree** — branch isolation for worktree-based workflows
|