Skip to content

Commit 3a026d0

Browse files
committed
absorb superpowers improvements: SDD scripts, reviewer prompts, task right-sizing
- pb-subagent-driven-development: add task-brief/review-package/sdd-workspace scripts, implementer-prompt.md, task-reviewer-prompt.md, process diagram, enhanced reviewer rules, file handoffs, durable progress - pb-plan: add task right-sizing and per-task Interfaces blocks - pb-writing-skills: add Skill Types, Micro-Test Wording methodology - pb-dispatching-parallel-agents: add parallel dispatch mechanics note, real example - pb-finishing-a-development-branch: add remote platform detection (GitHub/GitLab) - pb-systematic-debugging: add graphviz decision diagram - pb-test-driven-development: add graphviz TDD cycle diagram
1 parent 9631a5c commit 3a026d0

12 files changed

Lines changed: 870 additions & 120 deletions

File tree

skills/pb-dispatching-parallel-agents/SKILL.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ Task("Fix tool-approval-race-conditions.test.ts failures")
5454
// All three run concurrently
5555
```
5656

57+
Multiple dispatch calls in one response = parallel execution. One per response = sequential.
58+
5759
### 4. Review and Integrate
5860

5961
When agents return:
@@ -120,6 +122,33 @@ After all agents complete and you integrate changes:
120122
3. Verify no regressions introduced
121123
4. Spot-check key files for correctness
122124

125+
## Real Example from Session
126+
127+
**Scenario:** 6 test failures across 3 files after major refactoring
128+
129+
**Failures:**
130+
131+
- test_abort.py: 3 failures (timing issues)
132+
- test_batch_completion.py: 2 failures (tools not executing)
133+
- test_tool_approval_race.py: 1 failure (execution count = 0)
134+
135+
**Decision:** Independent domains — abort logic separate from batch completion separate from race conditions
136+
137+
**Dispatch:**
138+
```
139+
Agent 1 → Fix test_abort.py
140+
Agent 2 → Fix test_batch_completion.py
141+
Agent 3 → Fix test_tool_approval_race.py
142+
```
143+
144+
**Results:**
145+
146+
- Agent 1: Replaced timeouts with event-based waiting
147+
- Agent 2: Fixed event structure bug (threadId in wrong place)
148+
- Agent 3: Added wait for async tool execution to complete
149+
150+
**Integration:** All fixes independent, no conflicts, full suite green
151+
123152
## Integration with pb-spec
124153

125154
- **pb-build:** Use when multiple independent tasks can be built concurrently (rare — pb-build is sequential by design)

skills/pb-finishing-a-development-branch/SKILL.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,34 @@ git commit -m "feat: <description>"
6060
#### Option 2: Push and Create PR
6161

6262
```bash
63+
# Detect remote platform
64+
REMOTE_URL=$(git remote get-url origin 2>/dev/null || echo "")
65+
66+
# Push branch
6367
git push -u origin <branch>
64-
gh pr create --title "<title>" --body "$(cat <<'EOF'
68+
69+
# Create PR/MR based on platform
70+
if echo "$REMOTE_URL" | grep -q "github.com"; then
71+
gh pr create --title "<title>" --body "$(cat <<'EOF'
72+
## Summary
73+
<2-3 bullets of what changed>
74+
75+
## Test Plan
76+
- [ ] <verification steps>
77+
EOF
78+
)"
79+
elif echo "$REMOTE_URL" | grep -q "gitlab"; then
80+
glab mr create --title "<title>" --description "$(cat <<'EOF'
6581
## Summary
6682
<2-3 bullets of what changed>
6783
6884
## Test Plan
6985
- [ ] <verification steps>
7086
EOF
7187
)"
88+
else
89+
echo "Pushed branch. Create a merge request manually on your platform."
90+
fi
7291
```
7392

7493
#### Option 3: Keep As-Is

skills/pb-plan/SKILL.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,15 @@ Write a **scenario-driven task list** to `specs/<spec-dir>/tasks.md`. Tasks are
338338
| **Status** | Planning |
339339
| **Mode** | Lightweight |
340340
341+
## Task Right-Sizing
342+
343+
A task is the smallest unit that carries its own test cycle and is worth a
344+
fresh reviewer's gate. When drawing task boundaries: fold setup,
345+
configuration, scaffolding, and documentation steps into the task whose
346+
deliverable needs them; split only where a reviewer could meaningfully
347+
reject one task while approving its neighbor. Each task ends with an
348+
independently testable deliverable.
349+
341350
## Execution Strategy
342351
343352
> **Outside-In TDD:** Each task implements ONE scenario. Follow RED → GREEN → REFACTOR strictly.
@@ -374,6 +383,9 @@ Write a **scenario-driven task list** to `specs/<spec-dir>/tasks.md`. Tasks are
374383
- **Complexity:** `Low` | `Medium` | `High`
375384
- **Required Skills:** [e.g., Python, SQLAlchemy, JWT]
376385
- **EvalRule:** `[BDD command] --tags=@[tag]` must pass; `uv run pytest` must pass
386+
- **Interfaces:**
387+
- **Consumes:** [what this task uses from earlier tasks — exact signatures]
388+
- **Produces:** [what later tasks rely on — exact function names, parameter and return types. A task's implementer sees only their own task; this block is how they learn the names and types neighboring tasks use.]
377389
- **Loop Type:** `BDD+TDD`
378390
- **Behavioral Contract:** `[Describe behavior]`
379391
- **Status:** 🔴 TODO

skills/pb-subagent-driven-development/SKILL.md

Lines changed: 314 additions & 119 deletions
Large diffs are not rendered by default.
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Implementer Subagent Prompt Template
2+
3+
Use this template when dispatching an implementer subagent.
4+
5+
```
6+
Task("Implement Task N: [task name]", model="[MODEL]")
7+
description: "Implement Task N: [task name]"
8+
model: [MODEL — REQUIRED: choose per SKILL.md Model Selection; an omitted
9+
model silently inherits the session's most expensive one]
10+
prompt: |
11+
You are implementing Task N: [task name]
12+
13+
## Task Description
14+
15+
Read your task brief first: [BRIEF_FILE]
16+
It contains the full task text from the plan.
17+
18+
## Context
19+
20+
[Scene-setting: where this fits, dependencies, architectural context]
21+
22+
## Before You Begin
23+
24+
If you have questions about:
25+
- The requirements or acceptance criteria
26+
- The approach or implementation strategy
27+
- Dependencies or assumptions
28+
- Anything unclear in the task description
29+
30+
**Ask them now.** Raise any concerns before starting work.
31+
32+
## Your Job
33+
34+
Once you're clear on requirements:
35+
1. Implement exactly what the task specifies
36+
2. Write tests (following TDD if task says to)
37+
3. Verify implementation works
38+
4. Commit your work
39+
5. Self-review (see below)
40+
6. Report back
41+
42+
Work from: [directory]
43+
44+
**While you work:** If you encounter something unexpected or unclear, **ask questions**.
45+
It's always OK to pause and clarify. Don't guess or make assumptions.
46+
47+
While iterating, run the focused test for what you're changing; run the
48+
full suite once before committing, not after every edit.
49+
50+
## Code Organization
51+
52+
You reason best about code you can hold in context at once, and your edits are more
53+
reliable when files are focused. Keep this in mind:
54+
- Follow the file structure defined in the plan
55+
- Each file should have one clear responsibility with a well-defined interface
56+
- If a file you're creating is growing beyond the plan's intent, stop and report
57+
it as DONE_WITH_CONCERNS — don't split files on your own without plan guidance
58+
- If an existing file you're modifying is already large or tangled, work carefully
59+
and note it as a concern in your report
60+
- In existing codebases, follow established patterns. Improve code you're touching
61+
the way a good developer would, but don't restructure things outside your task.
62+
63+
## When You're in Over Your Head
64+
65+
It is always OK to stop and say "this is too hard for me." Bad work is worse than
66+
no work. You will not be penalized for escalating.
67+
68+
**STOP and escalate when:**
69+
- The task requires architectural decisions with multiple valid approaches
70+
- You need to understand code beyond what was provided and can't find clarity
71+
- You feel uncertain about whether your approach is correct
72+
- The task involves restructuring existing code in ways the plan didn't anticipate
73+
- You've been reading file after file trying to understand the system without progress
74+
75+
**How to escalate:** Report back with status BLOCKED or NEEDS_CONTEXT. Describe
76+
specifically what you're stuck on, what you've tried, and what kind of help you need.
77+
The controller can provide more context, re-dispatch with a more capable model,
78+
or break the task into smaller pieces.
79+
80+
## Before Reporting Back: Self-Review
81+
82+
Review your work with fresh eyes. Ask yourself:
83+
84+
**Completeness:**
85+
- Did I fully implement everything in the spec?
86+
- Did I miss any requirements?
87+
- Are there edge cases I didn't handle?
88+
89+
**Quality:**
90+
- Is this my best work?
91+
- Are names clear and accurate (match what things do, not how they work)?
92+
- Is the code clean and maintainable?
93+
94+
**Discipline:**
95+
- Did I avoid overbuilding (YAGNI)?
96+
- Did I only build what was requested?
97+
- Did I follow existing patterns in the codebase?
98+
99+
**Testing:**
100+
- Do tests actually verify behavior (not just mock behavior)?
101+
- Did I follow TDD if required?
102+
- Are tests comprehensive?
103+
- Is the test output pristine (no stray warnings or noise)?
104+
105+
If you find issues during self-review, fix them now before reporting.
106+
107+
## After Review Findings
108+
109+
If a reviewer finds issues and you fix them, re-run the tests that cover
110+
the amended code and append the results to your report file. Reviewers
111+
will not re-run tests for you — your report is the test evidence.
112+
113+
## Report Format
114+
115+
Write your full report to [REPORT_FILE]:
116+
- What you implemented (or what you attempted, if blocked)
117+
- What you tested and test results
118+
- **TDD Evidence** (if TDD was required for this task):
119+
- RED: command run, relevant failing output before implementation, and why the failure was expected
120+
- GREEN: command run and relevant passing output after implementation
121+
- Files changed
122+
- Self-review findings (if any)
123+
- Any issues or concerns
124+
125+
Then report back with ONLY (under 15 lines — the detail lives in the
126+
report file):
127+
- **Status:** DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT
128+
- Commits created (short SHA + subject)
129+
- One-line test summary (e.g. "14/14 passing, output pristine")
130+
- Your concerns, if any
131+
- The report file path
132+
133+
If BLOCKED or NEEDS_CONTEXT, put the specifics in the final message
134+
itself — the controller acts on it directly.
135+
136+
Use DONE_WITH_CONCERNS if you completed the work but have doubts about correctness.
137+
Use BLOCKED if you cannot complete the task. Use NEEDS_CONTEXT if you need
138+
information that wasn't provided. Never silently produce work you're unsure about.
139+
```
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
# Generate a review package: commit list, stat summary, and the net
3+
# diff with extended context, written to a file the reviewer reads in one
4+
# call. Using the recorded per-task BASE (not HEAD~1) keeps multi-commit
5+
# tasks intact.
6+
#
7+
# Usage: review-package BASE HEAD [OUTFILE]
8+
# Default OUTFILE: <repo-root>/.pb-spec/sdd/review-<base7>..<head7>.diff
9+
# (named per range, so a re-review after fixes gets a distinct fresh file).
10+
set -euo pipefail
11+
12+
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
13+
echo "usage: review-package BASE HEAD [OUTFILE]" >&2
14+
exit 2
15+
fi
16+
17+
base=$1
18+
head=$2
19+
20+
git rev-parse --verify --quiet "$base" >/dev/null || { echo "bad BASE: $base" >&2; exit 2; }
21+
git rev-parse --verify --quiet "$head" >/dev/null || { echo "bad HEAD: $head" >&2; exit 2; }
22+
23+
if [ $# -eq 3 ]; then
24+
out=$3
25+
else
26+
dir=$("$(cd "$(dirname "$0")" && pwd)/sdd-workspace")
27+
out="$dir/review-$(git rev-parse --short "$base")..$(git rev-parse --short "$head").diff"
28+
fi
29+
30+
{
31+
echo "# Review package: ${base}..${head}"
32+
echo
33+
echo "## Commits"
34+
git log --oneline "${base}..${head}"
35+
echo
36+
echo "## Files changed"
37+
git diff --stat "${base}..${head}"
38+
echo
39+
echo "## Diff"
40+
git diff -U10 "${base}..${head}"
41+
} > "$out"
42+
43+
commits=$(git rev-list --count "${base}..${head}")
44+
echo "wrote ${out}: ${commits} commit(s), $(wc -c < "$out" | tr -d ' ') bytes"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
# Resolve and ensure the working-tree directory SDD uses for its short-lived
3+
# artifacts: task briefs, implementer reports, review packages, and the
4+
# progress ledger. Print the directory's absolute path.
5+
#
6+
# The workspace lives in the working tree (not under .git/) because Claude Code
7+
# treats .git/ as a protected path and denies agent writes there — which blocks
8+
# an implementer subagent from writing its report file. A self-ignoring
9+
# .gitignore keeps the workspace out of `git status` and out of accidental
10+
# commits without modifying any tracked file.
11+
#
12+
# Single source of truth for the workspace location, so task-brief and
13+
# review-package cannot drift to different directories.
14+
#
15+
# Usage: sdd-workspace
16+
set -euo pipefail
17+
18+
root=$(git rev-parse --show-toplevel)
19+
dir="$root/.pb-spec/sdd"
20+
mkdir -p "$dir"
21+
printf '*\n' > "$dir/.gitignore"
22+
cd "$dir" && pwd
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
# Extract one task's full text from an implementation plan into a file the
3+
# implementer reads in one call, so the task text never has to be pasted
4+
# through the controller's context.
5+
#
6+
# Usage: task-brief PLAN_FILE TASK_NUMBER [OUTFILE]
7+
# Default OUTFILE: <repo-root>/.pb-spec/sdd/task-<N>-brief.md
8+
# (per worktree; concurrent runs in the same working tree share it).
9+
set -euo pipefail
10+
11+
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
12+
echo "usage: task-brief PLAN_FILE TASK_NUMBER [OUTFILE]" >&2
13+
exit 2
14+
fi
15+
16+
plan=$1
17+
n=$2
18+
[ -f "$plan" ] || { echo "no such plan file: $plan" >&2; exit 2; }
19+
20+
if [ $# -eq 3 ]; then
21+
out=$3
22+
else
23+
dir=$("$(cd "$(dirname "$0")" && pwd)/sdd-workspace")
24+
out="$dir/task-${n}-brief.md"
25+
fi
26+
27+
awk -v n="$n" '
28+
/^```/ { infence = !infence }
29+
!infence && /^#+[ \t]+Task[ \t]+[0-9]+/ {
30+
intask = ($0 ~ ("^#+[ \t]+Task[ \t]+" n "([^0-9]|$)"))
31+
}
32+
intask { print }
33+
' "$plan" > "$out"
34+
35+
if [ ! -s "$out" ]; then
36+
echo "task ${n} not found in ${plan} (no heading matching 'Task ${n}')" >&2
37+
exit 3
38+
fi
39+
40+
echo "wrote ${out}: $(wc -l < "$out" | tr -d ' ') lines"

0 commit comments

Comments
 (0)