diff options
Diffstat (limited to 'skills')
19 files changed, 678 insertions, 659 deletions
diff --git a/skills/brainstorming/SKILL.md b/skills/brainstorming/SKILL.md index 22b98fc..7f5eef0 100644 --- a/skills/brainstorming/SKILL.md +++ b/skills/brainstorming/SKILL.md @@ -23,18 +23,63 @@ why? blue"). This is a quick, clear task. Do it, and say what you did. - **Something non-trivial is missing.** Start the conversation. -## Your First Message +Before you start implementing, you must, in order: + +1. Lay out the approaches in a message of their own, and have your + human partner pick one (see Lay out the approaches). +2. Write the design doc, short or full (see Size the Work). +3. Get their approval of that doc. +4. Invoke the superpowers:writing-plans skill. + +Two things aren't implementing: a spike they said yes to (see Spike to +feel things out), and doing what they asked once they've opted out of +the questions. + +## Look Before You Ask + +In an existing project, or when they've given you context (a spec, a plan, +a handoff, files they pointed at, earlier conversation), dig in before your +first message. Read what they referred to and the code or material it +connects to, and keep reading until you can explain how the relevant +parts work today and what this change would touch. Never ask what the +project or their context already answers. -Your first message is two things, in this order: +## Your First Message -1. One line letting them know that if they'd rather skip the questions and - have you just start, they can say so. If they take you up on it, this - skill is done: state any significant how-it-gets-made choice - (platform, language, medium) in one plain line, then do what they - asked through the normal workflow. -2. One open question that gets them describing. Ask about a real moment - or a concrete picture: "What's the moment you find yourself wishing - this existed?" or "Tell me about the people who'll be in the room." +Move the work forward, with one of these: + +- **They've already said what they want** (a spec, a plan, a detailed + request): aim for about 200 words for the whole message. Echo their + request back in your own words, so they can see whether you've got its + shape: what they want, who it's for, and why, as far as they've said. + Add what you found that bears on it: how the relevant parts work today + and what the change would touch. If you found something they may not + have considered that would change what they're asking for or how it + has to be built, like a constraint, a conflict, or a cheaper path, say + so plainly. How to build it comes later, once you understand what they + want (see Lay out the approaches). End with one line inviting + corrections, then one question about what they want: the thing their + request leaves open whose answer would most change what gets built. + Specs are often incomplete, so confirm before you build on one. +- **They haven't:** one open question, in their own terms, about the + biggest thing their request leaves unsettled. Say why you're asking: + what the answer would change about what you build. For "a website for + my bakery": "If it's mostly for people deciding whether to stop by, + I'd lead with hours and what's in the case today; taking orders is a + different site. What do you want someone to do when they land on it?" + +How the message ends depends on whether their message asked for +brainstorming: + +- **They asked for it** (by name, by invoking it, or by asking for a + design discussion): end with your question. They want this + conversation. +- **They didn't:** they may not want a conversation at all. After your + question, add a light, one-line offer to just get going instead, like + "Or if you'd rather I just dive in, say so." If they take you up on + it, this skill is done: state any significant how-it-gets-made choice + (platform, language, medium) in one plain line, then do what they + asked through the normal workflow. That's the whole message. @@ -43,7 +88,8 @@ That's the whole message. Each message ends with one question: a single sentence with no list of example answers hanging off it. Use plain language, pitched just a little above where your human partner is. Match their vocabulary; never use -process jargon. +process jargon. You never need to quote this skill to your human +partner. Be clear and concise. Lead with what matters. Avoid jargon. When you report what you found, give them the most important findings and offer @@ -75,19 +121,31 @@ out as questions: - current state: what exists now, what they've tried - the details they care about -**Questions that work** anchor in specifics: "Walk me through the last -time...", "If it could only do one of these well, which?", "What would -make you wince if I got it wrong?" A guess they can correct ("I'm -guessing this is because X keeps biting you?") often beats a question. - -**Offer recon.** Once you have a bit of grounding and looking would help, -offer to go look: their codebase or project, their own files and data, -or the web. Say what you'd look for. They decide whether you go. - -**Think wide privately.** Before you propose anything, come up with -several ideas and drop the weak ones, including any that fight what -they've told you about why. Show the comparison only when it helps them -decide. +**Make every question specific** to their project and what they've told +you. Ask Socratically, the way a sharp colleague would: build each +question on their last answer or on something you found, so it helps +them think through a consequence or a case they may have missed +("Voting closes before the meeting, and two members joined this month. +Does someone who joins mid-round get a vote?"). When the reason isn't +already plain, say what you're hoping to learn or what the answer would +change. A proposal they can correct, plus your reason for it, often +beats a question. + +**Offer recon.** Once you have a bit of grounding and looking further +would help, offer to go look: deeper into their codebase or project, +their own files and data, or the web. Say what you'd look for. They +decide whether you go. + +**Lay out the approaches.** Once you understand what they want, and +before you write anything up, put the ways of building it in a message +of its own. Come up with several real alternatives and drop the weak +ones, including any that work against why they want it and any the +existing work rules out. Present the two or three that remain, grounding +each in what the project actually does and saying what it trades off. +Recommend one and say why, then ask which way they want to go. When +there's genuinely one sensible way, say so and explain why the others +don't fit. This is for how it gets built; for what they want, get them +describing first. **Show, don't tell.** Offer the visual companion (below) whenever seeing would help more than reading: @@ -117,8 +175,9 @@ behaves), describe that part back in about 200-300 words, then return to questions about the next part. Playback and questions alternate through the whole conversation; the last chunk covers whatever is left. -Mark anything you're guessing as your guess; only what they said goes in -as theirs. End each chunk by asking what's wrong or missing. +Only what they said goes in as theirs. Anything you filled in goes in +as your proposal, with your reason. End each chunk by asking what's wrong +or missing. Before you send a chunk, check it: does it describe something they'll look at, like a page, a screen, a schedule, or a printout? If so, and @@ -128,14 +187,18 @@ they've accepted, put a mockup next to the description. ## Size the Work -Once you understand what they want, pick a size and say it in plain -words. They can override it. +Once you understand what they want and they've picked an approach, say +how big the work is in plain words. They can override it. -| Size | The full description | Then | -|------|----------------------|------| -| A quick, clear task | the request itself | do it | -| A small change | in chat | build it through the normal workflow | -| A project with a written design | a written design document | a full plan (for software: superpowers:writing-plans) | +| Size | The design doc | +|------|----------------| +| A small change | a short one: what you already covered together, written down | +| A project | the full written design (below) | + +Short or full, the design doc has an **Approaches** part: the two or +three ways you considered building it, what each trades off, which one +they picked, and why. They pick in the conversation, before you write +the doc. If it grows mid-task, stop, say so, and step up a size. @@ -144,20 +207,25 @@ order, and brainstorm them one at a time. ## The Written Design -For a project, write a plain document a talented builder in the domain -could plan from without going back to your human partner. Cover: +Write a plain document a talented builder in the domain could plan +from without going back to your human partner. Cover: - intent and the why - goals, non-goals, anti-goals - constraints +- approaches (above) - the parts of the how they decided, as they decided them - what's left to the builder +For a small change, the short design covers the same points in a line +or two each and goes straight to your human partner, without the +builder check. + **Where it goes:** in a software repo, `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`, committed. Otherwise, ask. Your human partner's preferences override both. -**Builder check:** dispatch a fresh subagent with +**Builder check** (for a project): dispatch a fresh subagent with `builder-check-prompt.md` in this directory. When you tell your human partner you're writing it up, say a reviewer will read it first and you may come back once with a few questions. Don't hand over the document @@ -177,8 +245,8 @@ round of questions the check produces. Without a subagent tool, read the document as that builder yourself. <HARD-GATE> -Nothing gets built until your human partner approves the full -description: in chat for a small change, the document for a project. +Nothing gets built until your human partner approves the design doc: +the short one for a small change, the full one for a project. Building includes writing product code, scaffolding, installing dependencies, creating projects, and invoking an implementation skill. Reading and exploring are fine. @@ -188,18 +256,19 @@ and the gate goes with it. A spike they said yes to may be built; it stays labeled throwaway, and keeping what it produced is a new request that comes back through this gate. -After a project's document is approved, the next step is the plan. For -software, invoke superpowers:writing-plans and no other skill. +After the design doc is approved, the next step is the plan: invoke +superpowers:writing-plans and no other skill. </HARD-GATE> ## Red Flags | Thought | Reality | |---------|---------| -| "I'll offer options to save them effort" | Options steer. Ask them to describe it first. | +| "I'll offer a menu of what they might want" | Options steer. Ask them to describe it first. | | "I'll fill in sensible defaults" | Good. Say them out loud. A default they never heard is one they couldn't reject. | +| "I've answered their questions, so I'll write the doc" | Lay out the approaches first, in a message of their own. | | "I should explain the process first" | Ask your question. The process shows itself. | -| "They said 'sounds good' to the idea" | Approval covers what you showed them. A description you haven't written isn't approved. | +| "They said 'sounds good' to the idea" | Approval covers what you showed them. A design doc you haven't written isn't approved. | | "The spike works, I'll keep building on it" | Keeping it is a new request. Back through the gate. | ## Visual Companion diff --git a/skills/executing-plans/SKILL.md b/skills/executing-plans/SKILL.md index 49077ad..ac77129 100644 --- a/skills/executing-plans/SKILL.md +++ b/skills/executing-plans/SKILL.md @@ -319,55 +319,3 @@ Use superpowers:finishing-a-development-branch. | "The reviewer said Minor, so it's Minor" | The label graded the spec's silence. Grade what the person gets. Re-grade, then gate. | | "The fix is obvious, no need for a failing test first" | The failing test is the only proof the finding was real and is now gone. Without it you have a diff and a hope. | | "I'll fix the minors too while I'm in there" | Every minor you fix is a test, a fix, and a suite run your partner did not ask for. Ledger them; your partner decides. | - -## Example Workflow - -``` -You: I'm using the executing-plans skill to implement this plan inline. - -[Setup: worktree verified] -[Read plan once: docs/superpowers/plans/feature-plan.md; spec read] -[Resolve workspace: sdd-workspace docs/superpowers/plans/feature-plan.md — no ledger inside, fresh start] -[Pre-flight scan: 2 shared-interface rows, 4 self-consistency rows, clean; written to ledger] -[Create todos for all tasks] - -Task 1: Hook installation script - -[task-start plan 1 → brief read; BASE a1b2c3d] -[Step 1: write failing test — written] -[Step 2: run it — FAIL: install_hook not defined. Matches Expected.] -[Step 3: implement — written] -[Step 4: run it — PASS 1/1. Matches Expected.] -[Step 5: commit — d4e5f6a] -[Contract: tests ran, output read, no deviations] -[task-done plan 1 a1b2c3d -- npm test -- hooks → ledger: Task 1: complete (commits a1b2c3d..d4e5f6a, tests: npm test -- hooks → 1/1 pass)] - -Task 2: Recovery modes - -[task-start plan 2 → brief read; BASE d4e5f6a] -[Step 2: run failing test — FAIL, but on an import error: Task 1 exported - installHook, brief consumes install_hook] -[Ruling: brief's consumer name is a typo against Task 1's Produces block; - use installHook — Ledger: Task 2: Ruling: install_hook → installHook — matches Task 1 Produces — cost if wrong: one rename] -[Steps 2-5 as planned; commit b7c8d9e] -[task-done plan 2 d4e5f6a -- npm test -- recovery → ledger: Task 2: complete (commits d4e5f6a..b7c8d9e, tests: npm test -- recovery → 8/8 pass)] - -... - -[After all tasks: review-package plan MERGE_BASE HEAD; dispatch code-reviewer, most capable model] -Reviewer: One Important finding — progress reporting interval hardcoded. Two Minor. -[Re-grade: Important stands; minors → ledger as deferred] -[Fix pass: test_progress_interval_configurable RED → extract PROGRESS_INTERVAL → GREEN; suite 12/12; commit] -[Ledger: Final: fixed hardcoded interval — test_progress_interval_configurable RED→GREEN, suite 12/12] - -Rulings I made: -- Task 2: install_hook → installHook (brief typo; cost if wrong: one rename) - -Deferred minors: -- README lacks a usage example -- recovery.js could split verify/repair into two files - -[Delete this plan's workspace — the record now lives in git] - -Using superpowers:finishing-a-development-branch. -``` diff --git a/skills/subagent-driven-development/SKILL.md b/skills/subagent-driven-development/SKILL.md index f7bbf6a..ea170ed 100644 --- a/skills/subagent-driven-development/SKILL.md +++ b/skills/subagent-driven-development/SKILL.md @@ -70,23 +70,13 @@ digraph process { "Implementer implements, tests, commits, self-reviews" [shape=box]; "Generate review package, dispatch task reviewer (./task-reviewer-prompt.md)" [shape=box]; "Spec ✅ and quality approved?" [shape=diamond]; - "Finding conflicts with plan text?" [shape=diamond]; - "Rule on the conflict, ledger the ruling" [shape=box]; - "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model" [shape=box]; - "Dispatch scoped re-review (./re-review-prompt.md)" [shape=box]; - "All findings addressed?" [shape=diamond]; - "R = 5?" [shape=diamond]; - "Adjudicate each open finding" [shape=box]; - "Any load-bearing finding?" [shape=diamond]; - "Rule and continue; stop only if every path forward is a guess" [shape=box]; - "Park findings in ledger with rulings" [shape=box]; + "Fix loop: read references/fix-loop.md before every round" [shape=box]; "Append completion to ledger, mark todo complete" [shape=box]; } "Setup: worktree, ledger check, read plan, pre-flight review" [shape=box]; "More tasks remain?" [shape=diamond]; - "Dispatch final code reviewer (../requesting-code-review/code-reviewer.md)" [shape=box]; - "Final findings? ONE fix dispatch, one scoped re-review, adjudicate residuals" [shape=box]; + "Final review and finish: read references/final-review.md" [shape=box]; "Final review clean: delete this plan's workspace" [shape=box]; "Use superpowers:finishing-a-development-branch" [shape=box style=filled fillcolor=lightgreen]; @@ -98,25 +88,12 @@ digraph process { "Implementer implements, tests, commits, self-reviews" -> "Generate review package, dispatch task reviewer (./task-reviewer-prompt.md)"; "Generate review package, dispatch task reviewer (./task-reviewer-prompt.md)" -> "Spec ✅ and quality approved?"; "Spec ✅ and quality approved?" -> "Append completion to ledger, mark todo complete" [label="yes"]; - "Spec ✅ and quality approved?" -> "Finding conflicts with plan text?" [label="no"]; - "Finding conflicts with plan text?" -> "Rule on the conflict, ledger the ruling" [label="yes"]; - "Rule on the conflict, ledger the ruling" -> "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model"; - "Finding conflicts with plan text?" -> "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model" [label="no"]; - "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model" -> "Dispatch scoped re-review (./re-review-prompt.md)"; - "Dispatch scoped re-review (./re-review-prompt.md)" -> "All findings addressed?"; - "All findings addressed?" -> "Append completion to ledger, mark todo complete" [label="yes"]; - "All findings addressed?" -> "R = 5?" [label="no"]; - "R = 5?" -> "Fix round R of 5: R≤3 resume implementer; R≥4 fresh implementer, more capable model" [label="no - next round"]; - "R = 5?" -> "Adjudicate each open finding" [label="yes - breaker trips"]; - "Adjudicate each open finding" -> "Any load-bearing finding?"; - "Any load-bearing finding?" -> "Rule and continue; stop only if every path forward is a guess" [label="yes"]; - "Any load-bearing finding?" -> "Park findings in ledger with rulings" [label="no"]; - "Park findings in ledger with rulings" -> "Append completion to ledger, mark todo complete"; + "Spec ✅ and quality approved?" -> "Fix loop: read references/fix-loop.md before every round" [label="no"]; + "Fix loop: read references/fix-loop.md before every round" -> "Append completion to ledger, mark todo complete" [label="addressed, or parked at the cap"]; "Append completion to ledger, mark todo complete" -> "More tasks remain?"; "More tasks remain?" -> "Dispatch implementer subagent (./implementer-prompt.md)" [label="yes"]; - "More tasks remain?" -> "Dispatch final code reviewer (../requesting-code-review/code-reviewer.md)" [label="no"]; - "Dispatch final code reviewer (../requesting-code-review/code-reviewer.md)" -> "Final findings? ONE fix dispatch, one scoped re-review, adjudicate residuals"; - "Final findings? ONE fix dispatch, one scoped re-review, adjudicate residuals" -> "Final review clean: delete this plan's workspace"; + "More tasks remain?" -> "Final review and finish: read references/final-review.md" [label="no"]; + "Final review and finish: read references/final-review.md" -> "Final review clean: delete this plan's workspace"; "Final review clean: delete this plan's workspace" -> "Use superpowers:finishing-a-development-branch"; } ``` @@ -138,13 +115,9 @@ a ledger file, not only in todos. directory (under `<repo-root>/.superpowers/sdd/`), home to every artifact for THIS plan: ledger, briefs, reports, review packages. Another plan's directory is never yours to read or write. -- Check for this plan's ledger at `<workspace>/progress.md`. If its first - line names your plan file, tasks with a `Task <N>: complete` line are DONE - — do not re-dispatch them; resume at the first task without one. A task - whose last line is a fix round is mid-loop: resume the loop at the next - round. A ledger whose first line names a different plan file — or a stray - ledger at the old flat path `.superpowers/sdd/progress.md` — is another - plan's progress: leave it in place and start your own, fresh. +- Check for this plan's ledger at `<workspace>/progress.md`. If one exists, + read [references/resuming.md](references/resuming.md) before anything + else: it says whose ledger it is and where to resume. - Create the ledger with its identity as the first line: `# SDD ledger — plan: <plan file path>`. - The ledger is your recovery map: the commits it names exist in git even @@ -159,27 +132,9 @@ authority the plan argues from, and conflicts inside the plan resolve against it. A plan with no reachable spec gets a ledger note saying so — rulings made without one are provisional. -Before dispatching Task 1, scan the plan once for conflicts, writing down -what you checked as you check it: - -- tasks that contradict each other or the plan's Global Constraints -- anything the plan explicitly mandates that the review rubric treats as a - defect (a test that asserts nothing, verbatim duplication of a logic block) - -The scan's output is a table, not a verdict. One row for every pair of tasks -that share a file or an interface: the two tasks, what one produces against -what the other consumes, and what you found. One row for every task: whether -its own text agrees with itself — the tests it specifies against the code it -specifies, the files it creates against the files it later touches. "The scan -is clean" without those rows is not a scan you ran. - -Write the table to the ledger. Rule on everything you find before execution -begins — each finding against the plan text that mandates it — and record -each ruling in the ledger. If the scan is clean, proceed without comment. -Rule on each conflict it surfaces — the spec is the binding authority, the -plan is its argument — record the ruling beside its row, and dispatch -Task 1. The review loop remains the net for conflicts that only emerge from -implementation. +Before dispatching Task 1, read [references/preflight.md](references/preflight.md) +and run the conflict scan it describes. Its table and rulings go in the +ledger. ## Model Selection @@ -220,13 +175,9 @@ that implementer. Single-file mechanical fixes also take the cheapest tier. ## The Task Loop -**Batch small same-shape work.** When the plan lists several tasks that are -each a small, independent edit of the same kind — the same one-line fix, -constant change, or field addition repeated across files — do not dispatch -one subagent per task. Compose ONE dispatch brief listing every file and -its change, send the whole batch to a single subagent, and review its diff -as one unit. Reserve one-dispatch-per-task for work that needs its own -judgment, its own tests, or its own review surface. +**Small same-shape work:** when the plan lists several small edits of the +same kind across files, read [references/batching.md](references/batching.md) +before dispatching them. Everything you paste into a dispatch prompt — and everything a subagent prints back — stays resident in your context for the rest of the session @@ -289,17 +240,9 @@ Implementer subagents report one of four statuses. Handle each appropriately: **DONE:** Generate the review package (`bash scripts/review-package PLAN_FILE BASE HEAD`, from this skill's directory — it prints the unique file path it wrote; BASE is the commit you recorded before dispatching the implementer — never `HEAD~1`, which silently drops all but the last commit of a multi-commit task), then dispatch the task reviewer with the printed path. -**DONE_WITH_CONCERNS:** The implementer completed the work but flagged doubts. Read the concerns before proceeding. If the concerns are about correctness or scope, address them before review. If they're observations (e.g., "this file is getting large"), note them and proceed to review. - -**NEEDS_CONTEXT:** The implementer needs information that wasn't provided. Provide the missing context and re-dispatch. - -**BLOCKED:** The implementer cannot complete the task. Assess the blocker: -1. If it's a context problem, provide more context and re-dispatch with the same model -2. If the task requires more reasoning, re-dispatch with a more capable model -3. If the task is too large, break it into smaller pieces -4. If the plan itself is wrong, rule on the correction, ledger it, and re-dispatch with the ruling carried in the dispatch - -**Never** ignore an escalation or force the same model to retry without changes. If the implementer said it's stuck, something needs to change. +**Any other status** (DONE_WITH_CONCERNS, NEEDS_CONTEXT, BLOCKED): read +[references/handling-reports.md](references/handling-reports.md) and follow +it, every time you get one. If the implementer asks questions — before starting or mid-task — answer clearly and completely, provide additional context if needed, and don't @@ -342,12 +285,9 @@ needed. loop. If the prompt you are writing contains "do not flag," "don't treat X as a defect," "at most Minor," or "the plan chose" — stop: you are pre-judging, usually to spare yourself a review loop. -The task reviewer may report "⚠️ Cannot verify from diff" items — requirements -that live in unchanged code or span tasks. These do not block the rest of the -review, but you must resolve each one yourself before marking the task -complete: you hold the plan and cross-task context the reviewer -lacks. If you confirm an item is a real gap, treat it as a failed spec -review — it enters the fix loop with the other findings. +If the reviewer reports "⚠️ Cannot verify from diff" items, read +[references/cannot-verify.md](references/cannot-verify.md) before you mark +the task complete. Template: [task-reviewer-prompt.md](task-reviewer-prompt.md) @@ -356,77 +296,10 @@ Template: [task-reviewer-prompt.md](task-reviewer-prompt.md) The loop triggers when the review reports spec ❌, any Critical or Important finding, or a ⚠️ item you confirmed as a real gap. -Before the loop starts, two routes leave it immediately: - -- Record Minor findings in the progress ledger as you go - (`Task <N>: minor (deferred): <one-liner>`), and point the final - whole-branch review at that list so it can triage which must be fixed - before merge. A roll-up nobody reads is a silent discard. Minor findings - never enter the loop. -- A finding labeled plan-mandated — or any finding that conflicts with - what the plan's text requires — is yours to rule on: weigh the finding - against the plan text, decide with the spec as the binding authority, and - ledger the ruling before you act on it. Do not dismiss the finding because - the plan mandates it, and do not dispatch a fix that contradicts the plan - without a recorded ruling. -Everything else enters the loop. A fix round is one fix dispatch plus one -scoped re-review. Five rounds maximum per task: - -**Rounds 1-3 — resume the original implementer.** Send it the open findings -verbatim. Its context is intact: it knows the task, the code, and its own -choices. If your harness cannot send another message to a live subagent, -dispatch a fresh implementer carrying the brief path, the report-file path, -and the findings — the report file is the persistent memory either way. - -**Rounds 4-5 — dispatch a fresh implementer on a more capable model** (per -Model Selection), with the brief path, the report-file path, the open -findings, and this framing: "A prior implementer attempted this task -[N] times; you own it now. Read the report file for what was tried." A loop -that survives three resumes usually means the implementer cannot see its -own problem — fresh eyes and a capability bump in one move. - -**Every round, either way:** the implementer fixes, re-runs the tests -covering the amended code, appends its fix report to the same report file, -and returns the short contract. Before re-dispatching the reviewer, confirm -the fix report contains the covering tests, the command run, and the -output; dispatch the re-review once all three are present. Name the -covering test files in the fix message — a one-line fix does not need the -whole suite. - -**The re-review is scoped.** Run `bash scripts/review-package PLAN_FILE FIX_BASE HEAD` -where FIX_BASE is the head the previous review saw, and dispatch -[re-review-prompt.md](re-review-prompt.md) with the findings list, the -brief, the report file, and the printed diff path. The re-reviewer verdicts -each finding ADDRESSED or NOT ADDRESSED and flags new breakage in the fix -diff only. New Critical/Important breakage in the fix diff joins the open -findings list. Out-of-scope observations go to the ledger as deferred -minors — they never extend the loop. - -**After each round,** append to the ledger: -`Task <N>: fix round <R>/5 (<X> addressed, <Y> open — <finding one-liners>; commits <a7>..<b7>)` - -Never fix findings yourself in the controller session — your context stays -clean for coordination, and controller fixes skip review. - -**The breaker.** When round 5's re-review still leaves findings open, stop -dispatching. Adjudicate each open finding yourself — you hold the plan and -the cross-task context the reviewer lacks: - -- **The reviewer is wrong, or the point is contestable:** park it — - `Task <N>: parked — <finding> — Ruling: <why the code stands>`. The final - review sees both sides. -- **Real, but nothing downstream builds on it:** park it the same way, with - a ruling that says it's real and deferred. -- **Real and load-bearing** — a later task builds on it, or it reveals a - plan defect: rule on the smallest change that unblocks the dependent work, - ledger it as `Task <N>: Ruling: <finding> — <what you decided and why>`, - and carry it into the next task's dispatch. Parking a structural failure - silently lets every dependent task build on it. Stop only when the defect - leaves every path forward a guess. - -Adjudicate only at the cap. Adjudicating earlier to end a loop is -pre-judging with a different name. Every adjudication is a ledger entry — -a silent discard is forbidden. +When it triggers, read [references/fix-loop.md](references/fix-loop.md) and +follow it. Read it again before every round, even if you read it earlier in +this session: it holds the round cap, the breaker, and the ledger line each +round writes, and your memory of it does not survive compaction. ### 5. Complete the task @@ -444,47 +317,9 @@ parked-with-ruling at the cap. ## Final Review -The final whole-branch review gets a package too: run -`bash scripts/review-package PLAN_FILE MERGE_BASE HEAD` (MERGE_BASE = the commit the -branch started from, e.g. `git merge-base main HEAD`) and include the -printed path in the final review dispatch, so the final reviewer reads -one file instead of re-deriving the branch diff with git commands. Dispatch -on the most capable available model (see Model Selection), using -superpowers:requesting-code-review's -[code-reviewer.md](../requesting-code-review/code-reviewer.md). Point it at -the ledger's deferred-minor and parked lines so it can triage which must be -fixed before merge. - -If the final whole-branch review returns findings, dispatch ONE fix subagent -with the complete findings list — not one fixer per finding. -Per-finding fixers each rebuild context and re-run suites; a real -session's final-review fix wave cost more than all its tasks combined. -Then run exactly one scoped re-review of the fix wave -(`bash scripts/review-package PLAN_FILE FIX_BASE HEAD` over the fix range, -[re-review-prompt.md](re-review-prompt.md)). -Adjudicate any residual findings as in the task loop's breaker: park with -rulings, or rule on the load-bearing ones and ledger what you decided. Only -the four classes above stop you here. There is no second fix wave — -residual load-bearing findings surface to your human partner when -finishing-a-development-branch presents the options. - -## Finish - -Before you delete anything, collect every ledger line containing `Ruling:` — -preflight rulings, parked findings, breaker adjudications, all of them — into -your final message under "Rulings I made", in the order you made them, each -with what it costs if wrong. The list is exhaustive: if the ledger holds a -ruling, the list holds it. That list is the only place the decisions you -took on your human partner's behalf reach them — they read it and rework -whatever you got wrong. A ruling that dies with the workspace was a decision -made in secret. - -When the final whole-branch review is clean and its fixes are merged, -delete this plan's workspace (`rm -rf <workspace>`) — the git history is -the record now. Sibling directories belong to other plans; leave them -alone. - -Use superpowers:finishing-a-development-branch. +When every task is complete, read +[references/final-review.md](references/final-review.md) and follow it. It +covers the whole-branch review, its single fix wave, and how you finish. ## Common Rationalizations @@ -499,70 +334,3 @@ Use superpowers:finishing-a-development-branch. | "Reviews slow the loop down" | The loop without reviews is just unverified churn. Reviews are the loop's brakes and steering. | | "Ledger bookkeeping is overhead" | The ledger is what survives compaction. Controllers without one have re-dispatched entire completed task sequences. | | "The implementer spawned its own reviewer — free extra assurance" | It's a duplicate seat reviewing the same diff; the task review is the gate. A worker-spawned reviewer is a defect to flag, not rigor. | - -## Example Workflow - -``` -You: I'm using Subagent-Driven Development to execute this plan. - -[Setup: worktree verified] -[Read plan file once: docs/superpowers/plans/feature-plan.md] -[Resolve workspace: bash scripts/sdd-workspace docs/superpowers/plans/feature-plan.md — no ledger inside, fresh start] -[Create todos for all tasks] - -Task 1: Hook installation script - -[Run task-brief for Task 1; dispatch implementer with brief + report paths + context] - -Implementer: "Before I begin - should the hook be installed at user or system level?" - -You: "User level (~/.config/superpowers/hooks/)" - -Implementer: [Later] - - Implemented install-hook command - - Added tests, 5/5 passing - - Self-review: Found I missed --force flag, added it - - Committed - -[Run review-package PLAN_FILE BASE HEAD; dispatch task reviewer with the printed path] -Task reviewer: Spec ✅ - all requirements met, nothing extra. - Strengths: Good test coverage, clean. Issues: None. Task quality: Approved. - -[Ledger: Task 1: complete (commits a1b2c3d..d4e5f6a, review clean)] - -Task 2: Recovery modes - -[Run task-brief for Task 2; dispatch implementer with brief + report paths + context] - -Implementer: [No questions] - - Added verify/repair modes - - 8/8 tests passing - - Committed - -[Run review-package PLAN_FILE BASE HEAD; dispatch task reviewer with the printed path] -Task reviewer: Spec ❌: - - Missing: Progress reporting (spec says "report every 100 items") - Issues (Important): Magic number (100) - -[Fix round 1: resume the implementer with both findings] -Implementer: Added progress reporting, extracted PROGRESS_INTERVAL constant. - Re-ran test/recovery.test.js — 10/10 passing. Fix report appended. - -[Run review-package PLAN_FILE FIX_BASE HEAD; dispatch scoped re-review] -Re-reviewer: Missing progress reporting — ADDRESSED (src/recovery.js:41). - Magic number — ADDRESSED (src/recovery.js:7). New breakage: none. - Verdict: all findings addressed. - -[Ledger: Task 2: fix round 1/5 (2 addressed, 0 open; commits d4e5f6a..b7c8d9e)] -[Ledger: Task 2: complete (commits d4e5f6a..b7c8d9e, review clean)] - -... - -[After all tasks] -[Run review-package PLAN_FILE MERGE_BASE HEAD; dispatch final code-reviewer, most capable model] -Final reviewer: All requirements met. Deferred minors triaged: none block merge. - -[Delete this plan's workspace — the record now lives in git] - -Done! Using superpowers:finishing-a-development-branch. -``` diff --git a/skills/subagent-driven-development/references/batching.md b/skills/subagent-driven-development/references/batching.md new file mode 100644 index 0000000..6224e4b --- /dev/null +++ b/skills/subagent-driven-development/references/batching.md @@ -0,0 +1,11 @@ +# Batching Small Same-Shape Work + +Part of superpowers:subagent-driven-development. + +**Batch small same-shape work.** When the plan lists several tasks that are +each a small, independent edit of the same kind — the same one-line fix, +constant change, or field addition repeated across files — do not dispatch +one subagent per task. Compose ONE dispatch brief listing every file and +its change, send the whole batch to a single subagent, and review its diff +as one unit. Reserve one-dispatch-per-task for work that needs its own +judgment, its own tests, or its own review surface. diff --git a/skills/subagent-driven-development/references/cannot-verify.md b/skills/subagent-driven-development/references/cannot-verify.md new file mode 100644 index 0000000..e952f2d --- /dev/null +++ b/skills/subagent-driven-development/references/cannot-verify.md @@ -0,0 +1,10 @@ +# "Cannot Verify From Diff" Items + +Part of superpowers:subagent-driven-development. + +The task reviewer may report "⚠️ Cannot verify from diff" items — requirements +that live in unchanged code or span tasks. These do not block the rest of the +review, but you must resolve each one yourself before marking the task +complete: you hold the plan and cross-task context the reviewer +lacks. If you confirm an item is a real gap, treat it as a failed spec +review — it enters the fix loop with the other findings. diff --git a/skills/subagent-driven-development/references/final-review.md b/skills/subagent-driven-development/references/final-review.md new file mode 100644 index 0000000..851a5c5 --- /dev/null +++ b/skills/subagent-driven-development/references/final-review.md @@ -0,0 +1,47 @@ +# Final Review and Finish + +Part of superpowers:subagent-driven-development. Every task in the plan is +complete. + +The final whole-branch review gets a package too: run +`bash scripts/review-package PLAN_FILE MERGE_BASE HEAD` (MERGE_BASE = the commit the +branch started from, e.g. `git merge-base main HEAD`) and include the +printed path in the final review dispatch, so the final reviewer reads +one file instead of re-deriving the branch diff with git commands. Dispatch +on the most capable available model (see SKILL.md's Model Selection), using +superpowers:requesting-code-review's +[code-reviewer.md](../../requesting-code-review/code-reviewer.md). Point it at +the ledger's deferred-minor and parked lines so it can triage which must be +fixed before merge. + +If the final whole-branch review returns findings, dispatch ONE fix subagent +with the complete findings list — not one fixer per finding. +Per-finding fixers each rebuild context and re-run suites; a real +session's final-review fix wave cost more than all its tasks combined. +Then run exactly one scoped re-review of the fix wave +(`bash scripts/review-package PLAN_FILE FIX_BASE HEAD` over the fix range, +[re-review-prompt.md](../re-review-prompt.md)). +Adjudicate any residual findings as in the fix loop's breaker +(references/fix-loop.md): park with rulings, or rule on the load-bearing +ones and ledger what you decided. Only the four things that stop a running +plan (top of SKILL.md) stop you here. There is no second fix wave — +residual load-bearing findings surface to your human partner when +finishing-a-development-branch presents the options. + +### Finish + +Before you delete anything, collect every ledger line containing `Ruling:` — +preflight rulings, parked findings, breaker adjudications, all of them — into +your final message under "Rulings I made", in the order you made them, each +with what it costs if wrong. The list is exhaustive: if the ledger holds a +ruling, the list holds it. That list is the only place the decisions you +took on your human partner's behalf reach them — they read it and rework +whatever you got wrong. A ruling that dies with the workspace was a decision +made in secret. + +When the final whole-branch review is clean and its fixes are merged, +delete this plan's workspace (`rm -rf <workspace>`) — the git history is +the record now. Sibling directories belong to other plans; leave them +alone. + +Use superpowers:finishing-a-development-branch. diff --git a/skills/subagent-driven-development/references/fix-loop.md b/skills/subagent-driven-development/references/fix-loop.md new file mode 100644 index 0000000..0b476e9 --- /dev/null +++ b/skills/subagent-driven-development/references/fix-loop.md @@ -0,0 +1,77 @@ +# The Fix Loop + +Part of superpowers:subagent-driven-development. The task review reported +spec ❌, a Critical or Important finding, or a ⚠️ item you confirmed as a real +gap. + +Before the loop starts, two routes leave it immediately: + +- Record Minor findings in the progress ledger as you go + (`Task <N>: minor (deferred): <one-liner>`), and point the final + whole-branch review at that list so it can triage which must be fixed + before merge. A roll-up nobody reads is a silent discard. Minor findings + never enter the loop. +- A finding labeled plan-mandated — or any finding that conflicts with + what the plan's text requires — is yours to rule on: weigh the finding + against the plan text, decide with the spec as the binding authority, and + ledger the ruling before you act on it. Do not dismiss the finding because + the plan mandates it, and do not dispatch a fix that contradicts the plan + without a recorded ruling. +Everything else enters the loop. A fix round is one fix dispatch plus one +scoped re-review. Five rounds maximum per task: + +**Rounds 1-3 — resume the original implementer.** Send it the open findings +verbatim. Its context is intact: it knows the task, the code, and its own +choices. If your harness cannot send another message to a live subagent, +dispatch a fresh implementer carrying the brief path, the report-file path, +and the findings — the report file is the persistent memory either way. + +**Rounds 4-5 — dispatch a fresh implementer on a more capable model** (per +SKILL.md's Model Selection), with the brief path, the report-file path, the open +findings, and this framing: "A prior implementer attempted this task +[N] times; you own it now. Read the report file for what was tried." A loop +that survives three resumes usually means the implementer cannot see its +own problem — fresh eyes and a capability bump in one move. + +**Every round, either way:** the implementer fixes, re-runs the tests +covering the amended code, appends its fix report to the same report file, +and returns the short contract. Before re-dispatching the reviewer, confirm +the fix report contains the covering tests, the command run, and the +output; dispatch the re-review once all three are present. Name the +covering test files in the fix message — a one-line fix does not need the +whole suite. + +**The re-review is scoped.** Run `bash scripts/review-package PLAN_FILE FIX_BASE HEAD` +where FIX_BASE is the head the previous review saw, and dispatch +[re-review-prompt.md](../re-review-prompt.md) with the findings list, the +brief, the report file, and the printed diff path. The re-reviewer verdicts +each finding ADDRESSED or NOT ADDRESSED and flags new breakage in the fix +diff only. New Critical/Important breakage in the fix diff joins the open +findings list. Out-of-scope observations go to the ledger as deferred +minors — they never extend the loop. + +**After each round,** append to the ledger: +`Task <N>: fix round <R>/5 (<X> addressed, <Y> open — <finding one-liners>; commits <a7>..<b7>)` + +Never fix findings yourself in the controller session — your context stays +clean for coordination, and controller fixes skip review. + +**The breaker.** When round 5's re-review still leaves findings open, stop +dispatching. Adjudicate each open finding yourself — you hold the plan and +the cross-task context the reviewer lacks: + +- **The reviewer is wrong, or the point is contestable:** park it — + `Task <N>: parked — <finding> — Ruling: <why the code stands>`. The final + review sees both sides. +- **Real, but nothing downstream builds on it:** park it the same way, with + a ruling that says it's real and deferred. +- **Real and load-bearing** — a later task builds on it, or it reveals a + plan defect: rule on the smallest change that unblocks the dependent work, + ledger it as `Task <N>: Ruling: <finding> — <what you decided and why>`, + and carry it into the next task's dispatch. Parking a structural failure + silently lets every dependent task build on it. Stop only when the defect + leaves every path forward a guess. + +Adjudicate only at the cap. Adjudicating earlier to end a loop is +pre-judging with a different name. Every adjudication is a ledger entry — +a silent discard is forbidden. diff --git a/skills/subagent-driven-development/references/handling-reports.md b/skills/subagent-driven-development/references/handling-reports.md new file mode 100644 index 0000000..cf91cdc --- /dev/null +++ b/skills/subagent-driven-development/references/handling-reports.md @@ -0,0 +1,15 @@ +# Handling a Report That Isn't DONE + +Part of superpowers:subagent-driven-development. + +**DONE_WITH_CONCERNS:** The implementer completed the work but flagged doubts. Read the concerns before proceeding. If the concerns are about correctness or scope, address them before review. If they're observations (e.g., "this file is getting large"), note them and proceed to review. + +**NEEDS_CONTEXT:** The implementer needs information that wasn't provided. Provide the missing context and re-dispatch. + +**BLOCKED:** The implementer cannot complete the task. Assess the blocker: +1. If it's a context problem, provide more context and re-dispatch with the same model +2. If the task requires more reasoning, re-dispatch with a more capable model +3. If the task is too large, break it into smaller pieces +4. If the plan itself is wrong, rule on the correction, ledger it, and re-dispatch with the ruling carried in the dispatch + +**Never** ignore an escalation or force the same model to retry without changes. If the implementer said it's stuck, something needs to change. diff --git a/skills/subagent-driven-development/references/preflight.md b/skills/subagent-driven-development/references/preflight.md new file mode 100644 index 0000000..1701648 --- /dev/null +++ b/skills/subagent-driven-development/references/preflight.md @@ -0,0 +1,26 @@ +# The Pre-flight Scan + +Part of superpowers:subagent-driven-development. Run it once, before +dispatching Task 1. + +Before dispatching Task 1, scan the plan once for conflicts, writing down +what you checked as you check it: + +- tasks that contradict each other or the plan's Global Constraints +- anything the plan explicitly mandates that the review rubric treats as a + defect (a test that asserts nothing, verbatim duplication of a logic block) + +The scan's output is a table, not a verdict. One row for every pair of tasks +that share a file or an interface: the two tasks, what one produces against +what the other consumes, and what you found. One row for every task: whether +its own text agrees with itself — the tests it specifies against the code it +specifies, the files it creates against the files it later touches. "The scan +is clean" without those rows is not a scan you ran. + +Write the table to the ledger. Rule on everything you find before execution +begins — each finding against the plan text that mandates it — and record +each ruling in the ledger. If the scan is clean, proceed without comment. +Rule on each conflict it surfaces — the spec is the binding authority, the +plan is its argument — record the ruling beside its row, and dispatch +Task 1. The review loop remains the net for conflicts that only emerge from +implementation. diff --git a/skills/subagent-driven-development/references/resuming.md b/skills/subagent-driven-development/references/resuming.md new file mode 100644 index 0000000..409b826 --- /dev/null +++ b/skills/subagent-driven-development/references/resuming.md @@ -0,0 +1,12 @@ +# Resuming From an Existing Ledger + +Part of superpowers:subagent-driven-development. This plan's workspace +already has a ledger at `<workspace>/progress.md`. + +If the ledger's first line names your plan file, tasks with a `Task <N>: +complete` line are DONE — do not re-dispatch them; resume at the first +task without one. A task whose last line is a fix round is mid-loop: +resume the loop at the next round. A ledger whose first line names a +different plan file — or a stray ledger at the old flat path +`.superpowers/sdd/progress.md` — is another plan's progress: leave it in +place and start your own, fresh. diff --git a/skills/writing-skills/SKILL.md b/skills/writing-skills/SKILL.md index 182dfad..09d76b7 100644 --- a/skills/writing-skills/SKILL.md +++ b/skills/writing-skills/SKILL.md @@ -17,7 +17,7 @@ You write test cases (pressure scenarios with subagents), watch them fail (basel **REQUIRED BACKGROUND:** You MUST understand superpowers:test-driven-development before using this skill. That skill defines the fundamental RED-GREEN-REFACTOR cycle. This skill adapts TDD to documentation. -**Official guidance:** For Anthropic's official skill authoring best practices, see anthropic-best-practices.md. This document provides additional patterns and guidelines that complement the TDD-focused approach in this skill. +**Official guidance:** For Anthropic's official skill authoring best practices, see references/anthropic-best-practices.md. This document provides additional patterns and guidelines that complement the TDD-focused approach in this skill. ## What is a Skill? @@ -90,236 +90,23 @@ skills/ - Code patterns (< 50 lines) - Everything else -## SKILL.md Structure +## Writing SKILL.md -**Frontmatter (YAML):** -- Two required fields: `name` and `description` (see [agentskills.io/specification](https://agentskills.io/specification) for all supported fields) -- Max 1024 characters total -- `name`: Use letters, numbers, and hyphens only (no parentheses, special chars) -- `description`: Third-person, describes ONLY when to use (NOT what it does) - - Start with "Use when..." to focus on triggering conditions - - Include specific symptoms, situations, and contexts - - **NEVER summarize the skill's process or workflow** (see SDO section for why) - - Keep under 500 characters if possible +A skill's `description` says only when to use it: triggering conditions and +symptoms, starting with "Use when...". It never summarizes the skill's +workflow, because an agent that reads a workflow summary follows it instead +of reading the skill. -```markdown ---- -name: Skill-Name-With-Hyphens -description: Use when [specific triggering conditions and symptoms] ---- - -# Skill Name - -## Overview -What is this? Core principle in 1-2 sentences. - -## When to Use -[Small inline flowchart IF decision non-obvious] - -Bullet list with SYMPTOMS and use cases -When NOT to use - -## Core Pattern (for techniques/patterns) -Before/after code comparison - -## Quick Reference -Table or bullets for scanning common operations - -## Implementation -Inline code for simple patterns -Link to file for heavy reference or reusable tools - -## Common Mistakes -What goes wrong + fixes - -## Real-World Impact (optional) -Concrete results -``` - - -## Skill Discovery Optimization (SDO) - -**Critical for discovery:** Future agents need to FIND your skill - -### 1. Rich Description Field - -**Purpose:** Your agent reads the description to decide which skills to load for a given task. Make it answer: "Should I read this skill right now?" - -**Format:** Start with "Use when..." to focus on triggering conditions - -**CRITICAL: Description = When to Use, NOT What the Skill Does** - -The description should ONLY describe triggering conditions. Do NOT summarize the skill's process or workflow in the description. - -**Why this matters:** Testing revealed that when a description summarizes the skill's workflow, an agent may follow the description instead of reading the full skill content. A description saying "code review between tasks" caused an agent to do ONE review, even though the skill's flowchart clearly showed TWO reviews (spec compliance then code quality). - -When the description was changed to just "Use when executing implementation plans with independent tasks" (no workflow summary), the agent correctly read the flowchart and followed the two-stage review process. - -**The trap:** Descriptions that summarize workflow create a shortcut agents will take. The skill body becomes documentation agents skip. - -```yaml -# ❌ BAD: Summarizes workflow - agents may follow this instead of reading skill -description: Use when executing plans - dispatches subagent per task with code review between tasks - -# ❌ BAD: Too much process detail -description: Use for TDD - write test first, watch it fail, write minimal code, refactor - -# ✅ GOOD: Just triggering conditions, no workflow summary -description: Use when executing implementation plans with independent tasks in the current session - -# ✅ GOOD: Triggering conditions only -description: Use when implementing any feature or bugfix, before writing implementation code -``` - -**Content:** -- Use concrete triggers, symptoms, and situations that signal this skill applies -- Describe the *problem* (race conditions, inconsistent behavior) not *language-specific symptoms* (setTimeout, sleep) -- Keep triggers technology-agnostic unless the skill itself is technology-specific -- If skill is technology-specific, make that explicit in the trigger -- Write in third person (injected into system prompt) -- **NEVER summarize the skill's process or workflow** - -```yaml -# ❌ BAD: Too abstract, vague, doesn't include when to use -description: For async testing - -# ❌ BAD: First person -description: I can help you with async tests when they're flaky - -# ❌ BAD: Mentions technology but skill isn't specific to it -description: Use when tests use setTimeout/sleep and are flaky - -# ✅ GOOD: Starts with "Use when", describes problem, no workflow -description: Use when tests have race conditions, timing dependencies, or pass/fail inconsistently - -# ✅ GOOD: Technology-specific skill with explicit trigger -description: Use when using React Router and handling authentication redirects -``` - -### 2. Keyword Coverage - -Use words an agent would search for: -- Error messages: "Hook timed out", "ENOTEMPTY", "race condition" -- Symptoms: "flaky", "hanging", "zombie", "pollution" -- Synonyms: "timeout/hang/freeze", "cleanup/teardown/afterEach" -- Tools: Actual commands, library names, file types - -### 3. Descriptive Naming - -**Use active voice, verb-first:** -- ✅ `creating-skills` not `skill-creation` -- ✅ `condition-based-waiting` not `async-test-helpers` - -### 4. Token Efficiency (Critical) - -**Problem:** getting-started and frequently-referenced skills load into EVERY conversation. Every token counts. - -**Target word counts:** -- getting-started workflows: <150 words each -- Frequently-loaded skills: <200 words total -- Other skills: <500 words (still be concise) - -**Techniques:** - -**Move details to tool help:** -```bash -# ❌ BAD: Document all flags in SKILL.md -search-conversations supports --text, --both, --after DATE, --before DATE, --limit N - -# ✅ GOOD: Reference --help -search-conversations supports multiple modes and filters. Run --help for details. -``` - -**Use cross-references:** -```markdown -# ❌ BAD: Repeat workflow details -When searching, dispatch subagent with template... -[20 lines of repeated instructions] - -# ✅ GOOD: Reference other skill -Always use subagents (50-100x context savings). REQUIRED: Use [other-skill-name] for workflow. -``` +When you write or change a skill's frontmatter, name or description, or +need to cut its size, read [references/discovery.md](references/discovery.md): +the SKILL.md template, description and keyword guidance, naming, token +budgets, and cross-referencing other skills. -**Compress examples:** -```markdown -# ❌ BAD: Verbose example (42 words) -your human partner: "How did we handle authentication errors in React Router before?" -You: I'll search past conversations for React Router authentication patterns. -[Dispatch subagent with search query: "React Router authentication error handling 401"] - -# ✅ GOOD: Minimal example (20 words) -Partner: "How did we handle auth errors in React Router?" -You: Searching... -[Dispatch subagent → synthesis] -``` - -**Eliminate redundancy:** -- Don't repeat what's in cross-referenced skills -- Don't explain what's obvious from command -- Don't include multiple examples of same pattern - -**Verification:** -```bash -wc -w skills/path/SKILL.md -# getting-started workflows: aim for <150 each -# Other frequently-loaded: aim for <200 total -``` - -**Name by what you DO or core insight:** -- ✅ `condition-based-waiting` > `async-test-helpers` -- ✅ `using-skills` not `skill-usage` -- ✅ `flatten-with-flags` > `data-structure-refactoring` -- ✅ `root-cause-tracing` > `debugging-techniques` - -**Gerunds (-ing) work well for processes:** -- `creating-skills`, `testing-skills`, `debugging-with-logs` -- Active, describes the action you're taking - -### 5. Cross-Referencing Other Skills +## Flowcharts -**When writing documentation that references other skills:** - -Use skill name only, with explicit requirement markers: -- ✅ Good: `**REQUIRED SUB-SKILL:** Use superpowers:test-driven-development` -- ✅ Good: `**REQUIRED BACKGROUND:** You MUST understand superpowers:systematic-debugging` -- ❌ Bad: `See skills/testing/test-driven-development` (unclear if required) -- ❌ Bad: `@skills/testing/test-driven-development/SKILL.md` (force-loads, burns context) - -**Why no @ links:** `@` syntax force-loads files immediately, consuming 200k+ context before you need them. - -## Flowchart Usage - -```dot -digraph when_flowchart { - "Need to show information?" [shape=diamond]; - "Decision where I might go wrong?" [shape=diamond]; - "Use markdown" [shape=box]; - "Small inline flowchart" [shape=box]; - - "Need to show information?" -> "Decision where I might go wrong?" [label="yes"]; - "Decision where I might go wrong?" -> "Small inline flowchart" [label="yes"]; - "Decision where I might go wrong?" -> "Use markdown" [label="no"]; -} -``` - -**Use flowcharts ONLY for:** -- Non-obvious decision points -- Process loops where you might stop too early -- "When to use A vs B" decisions - -**Never use flowcharts for:** -- Reference material → Tables, lists -- Code examples → Markdown blocks -- Linear instructions → Numbered lists -- Labels without semantic meaning (step1, helper2) - -See `graphviz-conventions.dot` in this directory for graphviz style rules. - -**Visualizing for your human partner:** Use `render-graphs.js` in this directory to render a skill's flowcharts to SVG: -```bash -node ./render-graphs.js ../some-skill # Each diagram separately -node ./render-graphs.js ../some-skill --combine # All diagrams in one SVG -``` +When you add or change a flowchart in a skill, read +[references/flowcharts.md](references/flowcharts.md) first: when a flowchart +earns its place, the graphviz conventions, and how to render one. ## Code Examples @@ -464,7 +251,7 @@ Before writing guidance, classify the baseline failure. The form that bulletproo | Baseline failure | Right form | Wrong form | |---|---|---| -| Skips/violates a rule under pressure (knows better, does it anyway) | Prohibition + rationalization table + red flags (see Bulletproofing below) | Soft guidance ("prefer...", "consider...") | +| Skips/violates a rule under pressure (knows better, does it anyway) | Prohibition + rationalization table + red flags (see references/bulletproofing.md) | Soft guidance ("prefer...", "consider...") | | Complies, but output has the wrong shape (bloated prompt, buried verdict, restated spec) | Positive recipe or contract: state what the output IS — its parts, in order | Prohibition list ("don't restate", "never narrate") | | Omits a required element from something they already produce | Structural: REQUIRED field or slot in the template they fill in | Prose reminders near the template | | Behavior should depend on a condition | Conditional keyed to an observable predicate ("if the brief exists, reference it") | Unconditional rule + exemption clauses | @@ -475,81 +262,12 @@ Before writing guidance, classify the baseline failure. The form that bulletproo - **No nuance clauses.** "Don't X unless it matters" reopens the negotiation — appending a single nuance clause to a winning recipe degraded it from consistent to noisy in the same wording tests. Express a real exception as its own conditional on an observable predicate. - **Exemption clauses don't scope.** "This limit doesn't apply to code blocks" still suppresses code blocks. If part of the output must be exempt, restructure so the rule can't reach it. -## Bulletproofing Skills Against Rationalization - -Skills that enforce discipline (like TDD) need to resist rationalization. Agents are smart and will find loopholes when under pressure. - -**Scope:** this toolkit is for discipline failures — an agent that knows the rule and skips it under pressure. For wrong-shaped output or omitted elements, prohibition-based bulletproofing backfires; use the forms in Match the Form to the Failure instead. - -**Psychology note:** Understanding WHY persuasion techniques work helps you apply them systematically. See persuasion-principles.md for research foundation (Cialdini, 2021; Meincke et al., 2025) on authority, commitment, scarcity, social proof, and unity principles. - -### Close Every Loophole Explicitly - -Don't just state the rule - forbid specific workarounds: - -<Bad> -```markdown -Write code before test? Delete it. -``` -</Bad> - -<Good> -```markdown -Write code before test? Delete it. Start over. - -**No exceptions:** -- Don't keep it as "reference" -- Don't "adapt" it while writing tests -- Don't look at it -- Delete means delete -``` -</Good> - -### Address "Spirit vs Letter" Arguments - -Add foundational principle early: +## Bulletproofing Against Rationalization -```markdown -**Violating the letter of the rules is violating the spirit of the rules.** -``` - -This cuts off entire class of "I'm following the spirit" rationalizations. - -### Build Rationalization Table - -Capture rationalizations from baseline testing (see Testing section below). Every excuse agents make goes in the table: - -```markdown -| Excuse | Reality | -|--------|---------| -| "Too simple to test" | Simple code breaks. Test takes 30 seconds. | -| "I'll test after" | Tests passing immediately prove nothing. | -| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" | -``` - -### Create Red Flags List - -Make it easy for agents to self-check when rationalizing: - -```markdown -## Red Flags - STOP and Start Over - -- Code before test -- "I already manually tested it" -- "Tests after achieve the same purpose" -- "It's about spirit not ritual" -- "This is different because..." - -**All of these mean: Delete code. Start over with TDD.** -``` - -### Update SDO for Violation Symptoms - -Add to description: symptoms of when you're ABOUT to violate the rule: - -```yaml -description: use when implementing any feature or bugfix, before writing implementation code -``` +When the baseline failure is a discipline failure, read +[references/bulletproofing.md](references/bulletproofing.md) before you write +the guidance: closing loopholes, the spirit-vs-letter line, the +rationalization table, and the red-flags list. ## RED-GREEN-REFACTOR for Skills @@ -586,7 +304,7 @@ Full pressure-scenario runs are the final gate, but they are slow and expensive Micro-tests verify wording; they do not replace pressure scenarios for discipline skills. -**Testing methodology:** See [testing-skills-with-subagents.md](testing-skills-with-subagents.md) for the complete testing methodology: +**Testing methodology:** See [references/testing-skills-with-subagents.md](references/testing-skills-with-subagents.md) for the complete testing methodology: - How to write pressure scenarios - Pressure types (time, sunk cost, authority, exhaustion) - Plugging holes systematically diff --git a/skills/writing-skills/examples/CLAUDE_MD_TESTING.md b/skills/writing-skills/references/CLAUDE_MD_TESTING.md index 47881fc..47881fc 100644 --- a/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +++ b/skills/writing-skills/references/CLAUDE_MD_TESTING.md diff --git a/skills/writing-skills/anthropic-best-practices.md b/skills/writing-skills/references/anthropic-best-practices.md index 15ea9ea..15ea9ea 100644 --- a/skills/writing-skills/anthropic-best-practices.md +++ b/skills/writing-skills/references/anthropic-best-practices.md diff --git a/skills/writing-skills/references/bulletproofing.md b/skills/writing-skills/references/bulletproofing.md new file mode 100644 index 0000000..38e26fb --- /dev/null +++ b/skills/writing-skills/references/bulletproofing.md @@ -0,0 +1,80 @@ +# Bulletproofing Skills Against Rationalization + +Part of superpowers:writing-skills. Use it when the baseline failure is a +discipline failure: the agent knows the rule and skips it under pressure. + +## Bulletproofing Skills Against Rationalization + +Skills that enforce discipline (like TDD) need to resist rationalization. Agents are smart and will find loopholes when under pressure. + +**Scope:** this toolkit is for discipline failures — an agent that knows the rule and skips it under pressure. For wrong-shaped output or omitted elements, prohibition-based bulletproofing backfires; use the forms in Match the Form to the Failure instead. + +**Psychology note:** Understanding WHY persuasion techniques work helps you apply them systematically. See persuasion-principles.md in this directory for research foundation (Cialdini, 2021; Meincke et al., 2025) on authority, commitment, scarcity, social proof, and unity principles. + +### Close Every Loophole Explicitly + +Don't just state the rule - forbid specific workarounds: + +<Bad> +```markdown +Write code before test? Delete it. +``` +</Bad> + +<Good> +```markdown +Write code before test? Delete it. Start over. + +**No exceptions:** +- Don't keep it as "reference" +- Don't "adapt" it while writing tests +- Don't look at it +- Delete means delete +``` +</Good> + +### Address "Spirit vs Letter" Arguments + +Add foundational principle early: + +```markdown +**Violating the letter of the rules is violating the spirit of the rules.** +``` + +This cuts off entire class of "I'm following the spirit" rationalizations. + +### Build Rationalization Table + +Capture rationalizations from baseline testing (see Testing section below). Every excuse agents make goes in the table: + +```markdown +| Excuse | Reality | +|--------|---------| +| "Too simple to test" | Simple code breaks. Test takes 30 seconds. | +| "I'll test after" | Tests passing immediately prove nothing. | +| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" | +``` + +### Create Red Flags List + +Make it easy for agents to self-check when rationalizing: + +```markdown +## Red Flags - STOP and Start Over + +- Code before test +- "I already manually tested it" +- "Tests after achieve the same purpose" +- "It's about spirit not ritual" +- "This is different because..." + +**All of these mean: Delete code. Start over with TDD.** +``` + +### Update SDO for Violation Symptoms + +Add to description: symptoms of when you're ABOUT to violate the rule: + +```yaml +description: use when implementing any feature or bugfix, before writing implementation code +``` diff --git a/skills/writing-skills/references/discovery.md b/skills/writing-skills/references/discovery.md new file mode 100644 index 0000000..fc3009d --- /dev/null +++ b/skills/writing-skills/references/discovery.md @@ -0,0 +1,201 @@ +# Writing SKILL.md for Discovery + +Part of superpowers:writing-skills: the SKILL.md template and how to name, +describe and size a skill so agents find it and read it. + +## SKILL.md Structure + +**Frontmatter (YAML):** +- Two required fields: `name` and `description` (see [agentskills.io/specification](https://agentskills.io/specification) for all supported fields) +- Max 1024 characters total +- `name`: Use letters, numbers, and hyphens only (no parentheses, special chars) +- `description`: Third-person, describes ONLY when to use (NOT what it does) + - Start with "Use when..." to focus on triggering conditions + - Include specific symptoms, situations, and contexts + - **NEVER summarize the skill's process or workflow** (see Skill Discovery Optimization below for why) + - Keep under 500 characters if possible + +```markdown +--- +name: Skill-Name-With-Hyphens +description: Use when [specific triggering conditions and symptoms] +--- + +# Skill Name + +## Overview +What is this? Core principle in 1-2 sentences. + +## When to Use +[Small inline flowchart IF decision non-obvious] + +Bullet list with SYMPTOMS and use cases +When NOT to use + +## Core Pattern (for techniques/patterns) +Before/after code comparison + +## Quick Reference +Table or bullets for scanning common operations + +## Implementation +Inline code for simple patterns +Link to file for heavy reference or reusable tools + +## Common Mistakes +What goes wrong + fixes + +## Real-World Impact (optional) +Concrete results +``` + + +## Skill Discovery Optimization (SDO) + +**Critical for discovery:** Future agents need to FIND your skill + +### 1. Rich Description Field + +**Purpose:** Your agent reads the description to decide which skills to load for a given task. Make it answer: "Should I read this skill right now?" + +**Format:** Start with "Use when..." to focus on triggering conditions + +**CRITICAL: Description = When to Use, NOT What the Skill Does** + +The description should ONLY describe triggering conditions. Do NOT summarize the skill's process or workflow in the description. + +**Why this matters:** Testing revealed that when a description summarizes the skill's workflow, an agent may follow the description instead of reading the full skill content. A description saying "code review between tasks" caused an agent to do ONE review, even though the skill's flowchart clearly showed TWO reviews (spec compliance then code quality). + +When the description was changed to just "Use when executing implementation plans with independent tasks" (no workflow summary), the agent correctly read the flowchart and followed the two-stage review process. + +**The trap:** Descriptions that summarize workflow create a shortcut agents will take. The skill body becomes documentation agents skip. + +```yaml +# ❌ BAD: Summarizes workflow - agents may follow this instead of reading skill +description: Use when executing plans - dispatches subagent per task with code review between tasks + +# ❌ BAD: Too much process detail +description: Use for TDD - write test first, watch it fail, write minimal code, refactor + +# ✅ GOOD: Just triggering conditions, no workflow summary +description: Use when executing implementation plans with independent tasks in the current session + +# ✅ GOOD: Triggering conditions only +description: Use when implementing any feature or bugfix, before writing implementation code +``` + +**Content:** +- Use concrete triggers, symptoms, and situations that signal this skill applies +- Describe the *problem* (race conditions, inconsistent behavior) not *language-specific symptoms* (setTimeout, sleep) +- Keep triggers technology-agnostic unless the skill itself is technology-specific +- If skill is technology-specific, make that explicit in the trigger +- Write in third person (injected into system prompt) +- **NEVER summarize the skill's process or workflow** + +```yaml +# ❌ BAD: Too abstract, vague, doesn't include when to use +description: For async testing + +# ❌ BAD: First person +description: I can help you with async tests when they're flaky + +# ❌ BAD: Mentions technology but skill isn't specific to it +description: Use when tests use setTimeout/sleep and are flaky + +# ✅ GOOD: Starts with "Use when", describes problem, no workflow +description: Use when tests have race conditions, timing dependencies, or pass/fail inconsistently + +# ✅ GOOD: Technology-specific skill with explicit trigger +description: Use when using React Router and handling authentication redirects +``` + +### 2. Keyword Coverage + +Use words an agent would search for: +- Error messages: "Hook timed out", "ENOTEMPTY", "race condition" +- Symptoms: "flaky", "hanging", "zombie", "pollution" +- Synonyms: "timeout/hang/freeze", "cleanup/teardown/afterEach" +- Tools: Actual commands, library names, file types + +### 3. Descriptive Naming + +**Use active voice, verb-first:** +- ✅ `creating-skills` not `skill-creation` +- ✅ `condition-based-waiting` not `async-test-helpers` + +### 4. Token Efficiency (Critical) + +**Problem:** getting-started and frequently-referenced skills load into EVERY conversation. Every token counts. + +**Target word counts:** +- getting-started workflows: <150 words each +- Frequently-loaded skills: <200 words total +- Other skills: <500 words (still be concise) + +**Techniques:** + +**Move details to tool help:** +```bash +# ❌ BAD: Document all flags in SKILL.md +search-conversations supports --text, --both, --after DATE, --before DATE, --limit N + +# ✅ GOOD: Reference --help +search-conversations supports multiple modes and filters. Run --help for details. +``` + +**Use cross-references:** +```markdown +# ❌ BAD: Repeat workflow details +When searching, dispatch subagent with template... +[20 lines of repeated instructions] + +# ✅ GOOD: Reference other skill +Always use subagents (50-100x context savings). REQUIRED: Use [other-skill-name] for workflow. +``` + +**Compress examples:** +```markdown +# ❌ BAD: Verbose example (42 words) +your human partner: "How did we handle authentication errors in React Router before?" +You: I'll search past conversations for React Router authentication patterns. +[Dispatch subagent with search query: "React Router authentication error handling 401"] + +# ✅ GOOD: Minimal example (20 words) +Partner: "How did we handle auth errors in React Router?" +You: Searching... +[Dispatch subagent → synthesis] +``` + +**Eliminate redundancy:** +- Don't repeat what's in cross-referenced skills +- Don't explain what's obvious from command +- Don't include multiple examples of same pattern + +**Verification:** +```bash +wc -w skills/path/SKILL.md +# getting-started workflows: aim for <150 each +# Other frequently-loaded: aim for <200 total +``` + +**Name by what you DO or core insight:** +- ✅ `condition-based-waiting` > `async-test-helpers` +- ✅ `using-skills` not `skill-usage` +- ✅ `flatten-with-flags` > `data-structure-refactoring` +- ✅ `root-cause-tracing` > `debugging-techniques` + +**Gerunds (-ing) work well for processes:** +- `creating-skills`, `testing-skills`, `debugging-with-logs` +- Active, describes the action you're taking + +### 5. Cross-Referencing Other Skills + +**When writing documentation that references other skills:** + +Use skill name only, with explicit requirement markers: +- ✅ Good: `**REQUIRED SUB-SKILL:** Use superpowers:test-driven-development` +- ✅ Good: `**REQUIRED BACKGROUND:** You MUST understand superpowers:systematic-debugging` +- ❌ Bad: `See skills/testing/test-driven-development` (unclear if required) +- ❌ Bad: `@skills/testing/test-driven-development/SKILL.md` (force-loads, burns context) + +**Why no @ links:** `@` syntax force-loads files immediately, consuming 200k+ context before you need them. diff --git a/skills/writing-skills/references/flowcharts.md b/skills/writing-skills/references/flowcharts.md new file mode 100644 index 0000000..63f9bfa --- /dev/null +++ b/skills/writing-skills/references/flowcharts.md @@ -0,0 +1,37 @@ +# Flowcharts in Skills + +Part of superpowers:writing-skills. + +## Flowchart Usage + +```dot +digraph when_flowchart { + "Need to show information?" [shape=diamond]; + "Decision where I might go wrong?" [shape=diamond]; + "Use markdown" [shape=box]; + "Small inline flowchart" [shape=box]; + + "Need to show information?" -> "Decision where I might go wrong?" [label="yes"]; + "Decision where I might go wrong?" -> "Small inline flowchart" [label="yes"]; + "Decision where I might go wrong?" -> "Use markdown" [label="no"]; +} +``` + +**Use flowcharts ONLY for:** +- Non-obvious decision points +- Process loops where you might stop too early +- "When to use A vs B" decisions + +**Never use flowcharts for:** +- Reference material → Tables, lists +- Code examples → Markdown blocks +- Linear instructions → Numbered lists +- Labels without semantic meaning (step1, helper2) + +See `graphviz-conventions.dot` in this directory for graphviz style rules. + +**Visualizing for your human partner:** Use `render-graphs.js` in the writing-skills directory to render a skill's flowcharts to SVG, run from there: +```bash +node ./render-graphs.js ../some-skill # Each diagram separately +node ./render-graphs.js ../some-skill --combine # All diagrams in one SVG +``` diff --git a/skills/writing-skills/graphviz-conventions.dot b/skills/writing-skills/references/graphviz-conventions.dot index 3509e2f..3509e2f 100644 --- a/skills/writing-skills/graphviz-conventions.dot +++ b/skills/writing-skills/references/graphviz-conventions.dot diff --git a/skills/writing-skills/persuasion-principles.md b/skills/writing-skills/references/persuasion-principles.md index 9756416..9756416 100644 --- a/skills/writing-skills/persuasion-principles.md +++ b/skills/writing-skills/references/persuasion-principles.md diff --git a/skills/writing-skills/testing-skills-with-subagents.md b/skills/writing-skills/references/testing-skills-with-subagents.md index a5acfea..e5bf682 100644 --- a/skills/writing-skills/testing-skills-with-subagents.md +++ b/skills/writing-skills/references/testing-skills-with-subagents.md @@ -12,7 +12,7 @@ You run scenarios without the skill (RED - watch agent fail), write skill addres **REQUIRED BACKGROUND:** You MUST understand superpowers:test-driven-development before using this skill. That skill defines the fundamental RED-GREEN-REFACTOR cycle. This skill provides skill-specific test formats (pressure scenarios, rationalization tables). -**Complete worked example:** See examples/CLAUDE_MD_TESTING.md for a full test campaign testing CLAUDE.md documentation variants. +**Complete worked example:** See CLAUDE_MD_TESTING.md in this directory for a full test campaign testing CLAUDE.md documentation variants. ## When to Use @@ -139,7 +139,7 @@ Forces explicit choice. **Best tests combine 3+ pressures.** -**Why this works:** See persuasion-principles.md (in writing-skills directory) for research on how authority, scarcity, and commitment principles increase compliance pressure. +**Why this works:** See persuasion-principles.md (in this directory) for research on how authority, scarcity, and commitment principles increase compliance pressure. ### Key Elements of Good Scenarios |
