diff --git a/plugins/superpowers/.claude-plugin/plugin.json b/plugins/superpowers/.claude-plugin/plugin.json index 66627fd..24bdabe 100644 --- a/plugins/superpowers/.claude-plugin/plugin.json +++ b/plugins/superpowers/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "superpowers", "description": "Core skills library for Claude Code: TDD, debugging, collaboration patterns, and proven techniques", - "version": "4.0.3", + "version": "4.3.0", "author": { "name": "Jesse Vincent", "email": "jesse@fsck.com" diff --git a/plugins/superpowers/hooks/hooks.json b/plugins/superpowers/hooks/hooks.json index d174565..8db0a8c 100644 --- a/plugins/superpowers/hooks/hooks.json +++ b/plugins/superpowers/hooks/hooks.json @@ -6,7 +6,8 @@ "hooks": [ { "type": "command", - "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start.sh" + "command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh", + "async": false } ] } diff --git a/plugins/superpowers/hooks/run-hook.cmd b/plugins/superpowers/hooks/run-hook.cmd index 8d8458f..b2a8b3a 100755 --- a/plugins/superpowers/hooks/run-hook.cmd +++ b/plugins/superpowers/hooks/run-hook.cmd @@ -1,6 +1,30 @@ : << 'CMDBLOCK' @echo off -REM Polyglot wrapper: runs .sh scripts cross-platform +REM ============================================================================ +REM DEPRECATED: This polyglot wrapper is no longer used as of Claude Code 2.1.x +REM ============================================================================ +REM +REM Claude Code 2.1.x changed the Windows execution model for hooks: +REM +REM Before (2.0.x): Hooks ran with shell:true, using the system default shell. +REM This wrapper provided cross-platform compatibility by +REM being both a valid .cmd file (Windows) and bash script. +REM +REM After (2.1.x): Claude Code now auto-detects .sh files in hook commands +REM and prepends "bash " on Windows. This broke the wrapper +REM because the command: +REM "run-hook.cmd" session-start.sh +REM became: +REM bash "run-hook.cmd" session-start.sh +REM ...and bash cannot execute a .cmd file. +REM +REM The fix: hooks.json now calls session-start.sh directly. Claude Code 2.1.x +REM handles the bash invocation automatically on Windows. +REM +REM This file is kept for reference and potential backward compatibility. +REM ============================================================================ +REM +REM Original purpose: Polyglot wrapper to run .sh scripts cross-platform REM Usage: run-hook.cmd [args...] REM The script should be in the same directory as this wrapper diff --git a/plugins/superpowers/hooks/session-start.sh b/plugins/superpowers/hooks/session-start.sh index f5d9449..8c029af 100755 --- a/plugins/superpowers/hooks/session-start.sh +++ b/plugins/superpowers/hooks/session-start.sh @@ -17,23 +17,17 @@ fi # Read using-superpowers content using_superpowers_content=$(cat "${PLUGIN_ROOT}/skills/using-superpowers/SKILL.md" 2>&1 || echo "Error reading using-superpowers skill") -# Escape outputs for JSON using pure bash +# Escape string for JSON embedding using bash parameter substitution. +# Each ${s//old/new} is a single C-level pass - orders of magnitude +# faster than the character-by-character loop this replaces. escape_for_json() { - local input="$1" - local output="" - local i char - for (( i=0; i<${#input}; i++ )); do - char="${input:$i:1}" - case "$char" in - $'\\') output+='\\' ;; - '"') output+='\"' ;; - $'\n') output+='\n' ;; - $'\r') output+='\r' ;; - $'\t') output+='\t' ;; - *) output+="$char" ;; - esac - done - printf '%s' "$output" + local s="$1" + s="${s//\\/\\\\}" + s="${s//\"/\\\"}" + s="${s//$'\n'/\\n}" + s="${s//$'\r'/\\r}" + s="${s//$'\t'/\\t}" + printf '%s' "$s" } using_superpowers_escaped=$(escape_for_json "$using_superpowers_content") diff --git a/plugins/superpowers/skills/brainstorming/SKILL.md b/plugins/superpowers/skills/brainstorming/SKILL.md index 2fd19ba..460f73a 100644 --- a/plugins/superpowers/skills/brainstorming/SKILL.md +++ b/plugins/superpowers/skills/brainstorming/SKILL.md @@ -9,7 +9,50 @@ description: "You MUST use this before any creative work - creating features, bu Help turn ideas into fully formed designs and specs through natural collaborative dialogue. -Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design in small sections (200-300 words), checking after each section whether it looks right so far. +Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval. + + +Do NOT invoke any implementation skill, write any code, scaffold any project, or take any implementation action until you have presented a design and the user has approved it. This applies to EVERY project regardless of perceived simplicity. + + +## Anti-Pattern: "This Is Too Simple To Need A Design" + +Every project goes through this process. A todo list, a single-function utility, a config change — all of them. "Simple" projects are where unexamined assumptions cause the most wasted work. The design can be short (a few sentences for truly simple projects), but you MUST present it and get approval. + +## Checklist + +You MUST create a task for each of these items and complete them in order: + +1. **Explore project context** — check files, docs, recent commits +2. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria +3. **Propose 2-3 approaches** — with trade-offs and your recommendation +4. **Present design** — in sections scaled to their complexity, get user approval after each section +5. **Write design doc** — save to `docs/plans/YYYY-MM-DD--design.md` and commit +6. **Transition to implementation** — invoke writing-plans skill to create implementation plan + +## Process Flow + +```dot +digraph brainstorming { + "Explore project context" [shape=box]; + "Ask clarifying questions" [shape=box]; + "Propose 2-3 approaches" [shape=box]; + "Present design sections" [shape=box]; + "User approves design?" [shape=diamond]; + "Write design doc" [shape=box]; + "Invoke writing-plans skill" [shape=doublecircle]; + + "Explore project context" -> "Ask clarifying questions"; + "Ask clarifying questions" -> "Propose 2-3 approaches"; + "Propose 2-3 approaches" -> "Present design sections"; + "Present design sections" -> "User approves design?"; + "User approves design?" -> "Present design sections" [label="no, revise"]; + "User approves design?" -> "Write design doc" [label="yes"]; + "Write design doc" -> "Invoke writing-plans skill"; +} +``` + +**The terminal state is invoking writing-plans.** Do NOT invoke frontend-design, mcp-builder, or any other implementation skill. The ONLY skill you invoke after brainstorming is writing-plans. ## The Process @@ -27,7 +70,7 @@ Start by understanding the current project context, then ask questions one at a **Presenting the design:** - Once you believe you understand what you're building, present the design -- Break it into sections of 200-300 words +- Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced - Ask after each section whether it looks right so far - Cover: architecture, components, data flow, error handling, testing - Be ready to go back and clarify if something doesn't make sense @@ -39,10 +82,9 @@ Start by understanding the current project context, then ask questions one at a - Use elements-of-style:writing-clearly-and-concisely skill if available - Commit the design document to git -**Implementation (if continuing):** -- Ask: "Ready to set up for implementation?" -- Use superpowers:using-git-worktrees to create isolated workspace -- Use superpowers:writing-plans to create detailed implementation plan +**Implementation:** +- Invoke the writing-plans skill to create a detailed implementation plan +- Do NOT invoke any other skill. writing-plans is the next step. ## Key Principles @@ -50,5 +92,5 @@ Start by understanding the current project context, then ask questions one at a - **Multiple choice preferred** - Easier to answer than open-ended when possible - **YAGNI ruthlessly** - Remove unnecessary features from all designs - **Explore alternatives** - Always propose 2-3 approaches before settling -- **Incremental validation** - Present design in sections, validate each +- **Incremental validation** - Present design, get approval before moving on - **Be flexible** - Go back and clarify when something doesn't make sense diff --git a/plugins/superpowers/skills/executing-plans/SKILL.md b/plugins/superpowers/skills/executing-plans/SKILL.md index ca77290..c1b2533 100644 --- a/plugins/superpowers/skills/executing-plans/SKILL.md +++ b/plugins/superpowers/skills/executing-plans/SKILL.md @@ -74,3 +74,11 @@ After all tasks complete and verified: - Reference skills when plan says to - Between batches: just report and wait - Stop when blocked, don't guess +- Never start implementation on main/master branch without explicit user consent + +## Integration + +**Required workflow skills:** +- **superpowers:using-git-worktrees** - REQUIRED: Set up isolated workspace before starting +- **superpowers:writing-plans** - Creates the plan this skill executes +- **superpowers:finishing-a-development-branch** - Complete development after all tasks diff --git a/plugins/superpowers/skills/subagent-driven-development/SKILL.md b/plugins/superpowers/skills/subagent-driven-development/SKILL.md index a9a9454..b578dfa 100644 --- a/plugins/superpowers/skills/subagent-driven-development/SKILL.md +++ b/plugins/superpowers/skills/subagent-driven-development/SKILL.md @@ -199,6 +199,7 @@ Done! ## Red Flags **Never:** +- Start implementation on main/master branch without explicit user consent - Skip reviews (spec compliance OR code quality) - Proceed with unfixed issues - Dispatch multiple implementation subagents in parallel (conflicts) @@ -229,6 +230,7 @@ Done! ## Integration **Required workflow skills:** +- **superpowers:using-git-worktrees** - REQUIRED: Set up isolated workspace before starting - **superpowers:writing-plans** - Creates the plan this skill executes - **superpowers:requesting-code-review** - Code review template for reviewer subagents - **superpowers:finishing-a-development-branch** - Complete development after all tasks diff --git a/plugins/superpowers/skills/using-git-worktrees/SKILL.md b/plugins/superpowers/skills/using-git-worktrees/SKILL.md index 9d52d80..e153843 100644 --- a/plugins/superpowers/skills/using-git-worktrees/SKILL.md +++ b/plugins/superpowers/skills/using-git-worktrees/SKILL.md @@ -210,8 +210,9 @@ Ready to implement auth feature **Called by:** - **brainstorming** (Phase 4) - REQUIRED when design is approved and implementation follows +- **subagent-driven-development** - REQUIRED before executing any tasks +- **executing-plans** - REQUIRED before executing any tasks - Any skill needing isolated workspace **Pairs with:** - **finishing-a-development-branch** - REQUIRED for cleanup after work complete -- **executing-plans** or **subagent-driven-development** - Work happens in this worktree diff --git a/plugins/superpowers/skills/using-superpowers/SKILL.md b/plugins/superpowers/skills/using-superpowers/SKILL.md index 7867fcf..b227eec 100644 --- a/plugins/superpowers/skills/using-superpowers/SKILL.md +++ b/plugins/superpowers/skills/using-superpowers/SKILL.md @@ -26,6 +26,9 @@ This is not negotiable. This is not optional. You cannot rationalize your way ou ```dot digraph skill_flow { "User message received" [shape=doublecircle]; + "About to EnterPlanMode?" [shape=doublecircle]; + "Already brainstormed?" [shape=diamond]; + "Invoke brainstorming skill" [shape=box]; "Might any skill apply?" [shape=diamond]; "Invoke Skill tool" [shape=box]; "Announce: 'Using [skill] to [purpose]'" [shape=box]; @@ -34,6 +37,11 @@ digraph skill_flow { "Follow skill exactly" [shape=box]; "Respond (including clarifications)" [shape=doublecircle]; + "About to EnterPlanMode?" -> "Already brainstormed?"; + "Already brainstormed?" -> "Invoke brainstorming skill" [label="no"]; + "Already brainstormed?" -> "Might any skill apply?" [label="yes"]; + "Invoke brainstorming skill" -> "Might any skill apply?"; + "User message received" -> "Might any skill apply?"; "Might any skill apply?" -> "Invoke Skill tool" [label="yes, even 1%"]; "Might any skill apply?" -> "Respond (including clarifications)" [label="definitely not"]; diff --git a/plugins/superpowers/skills/writing-plans/SKILL.md b/plugins/superpowers/skills/writing-plans/SKILL.md index 448ca31..5fc45b6 100644 --- a/plugins/superpowers/skills/writing-plans/SKILL.md +++ b/plugins/superpowers/skills/writing-plans/SKILL.md @@ -46,7 +46,7 @@ Assume they are a skilled developer, but know almost nothing about our toolset o ## Task Structure -```markdown +````markdown ### Task N: [Component Name] **Files:** @@ -85,7 +85,7 @@ Expected: PASS git add tests/path/test.py src/path/file.py git commit -m "feat: add specific feature" ``` -``` +```` ## Remember - Exact file paths always diff --git a/plugins/superpowers/skills/writing-skills/SKILL.md b/plugins/superpowers/skills/writing-skills/SKILL.md index c60f18a..4cd8ddf 100644 --- a/plugins/superpowers/skills/writing-skills/SKILL.md +++ b/plugins/superpowers/skills/writing-skills/SKILL.md @@ -9,7 +9,7 @@ description: Use when creating new skills, editing existing skills, or verifying **Writing skills IS Test-Driven Development applied to process documentation.** -**Personal skills live in agent-specific directories (`~/.claude/skills` for Claude Code, `~/.codex/skills` for Codex)** +**Personal skills live in agent-specific directories (`~/.claude/skills` for Claude Code, `~/.agents/skills/` for Codex)** You write test cases (pressure scenarios with subagents), watch them fail (baseline behavior), write the skill (documentation), watch tests pass (agents comply), and refactor (close loopholes). diff --git a/plugins/superpowers/skills/writing-skills/testing-skills-with-subagents.md b/plugins/superpowers/skills/writing-skills/testing-skills-with-subagents.md index 9b12f3b..a5acfea 100644 --- a/plugins/superpowers/skills/writing-skills/testing-skills-with-subagents.md +++ b/plugins/superpowers/skills/writing-skills/testing-skills-with-subagents.md @@ -324,7 +324,7 @@ Before deploying skill, verify you followed RED-GREEN-REFACTOR: - [ ] Added explicit counters for each loophole - [ ] Updated rationalization table - [ ] Updated red flags list -- [ ] Updated description ith violation symptoms +- [ ] Updated description with violation symptoms - [ ] Re-tested - agent still complies - [ ] Meta-tested to verify clarity - [ ] Agent follows rule under maximum pressure