📦 deps(skills): sync thirdparty skills

This commit is contained in:
ci[bot] 2026-05-05 16:03:45 +00:00
parent a2e3cb07de
commit 64950e7979
13 changed files with 351 additions and 315 deletions

View File

@ -65,6 +65,6 @@ After all tasks complete and verified:
## Integration ## Integration
**Required workflow skills:** **Required workflow skills:**
- **superpowers:using-git-worktrees** - REQUIRED: Set up isolated workspace before starting - **superpowers:using-git-worktrees** - Ensures isolated workspace (creates one or verifies existing)
- **superpowers:writing-plans** - Creates the plan this skill executes - **superpowers:writing-plans** - Creates the plan this skill executes
- **superpowers:finishing-a-development-branch** - Complete development after all tasks - **superpowers:finishing-a-development-branch** - Complete development after all tasks

View File

@ -9,7 +9,7 @@ description: Use when implementation is complete, all tests pass, and you need t
Guide completion of development work by presenting clear options and handling chosen workflow. Guide completion of development work by presenting clear options and handling chosen workflow.
**Core principle:** Verify tests → Present options → Execute choice → Clean up. **Core principle:** Verify tests → Detect environment → Present options → Execute choice → Clean up.
**Announce at start:** "I'm using the finishing-a-development-branch skill to complete this work." **Announce at start:** "I'm using the finishing-a-development-branch skill to complete this work."
@ -37,7 +37,24 @@ Stop. Don't proceed to Step 2.
**If tests pass:** Continue to Step 2. **If tests pass:** Continue to Step 2.
### Step 2: Determine Base Branch ### Step 2: Detect Environment
**Determine workspace state before presenting options:**
```bash
GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
```
This determines which menu to show and how cleanup works:
| State | Menu | Cleanup |
|-------|------|---------|
| `GIT_DIR == GIT_COMMON` (normal repo) | Standard 4 options | No worktree to clean up |
| `GIT_DIR != GIT_COMMON`, named branch | Standard 4 options | Provenance-based (see Step 6) |
| `GIT_DIR != GIT_COMMON`, detached HEAD | Reduced 3 options (no merge) | No cleanup (externally managed) |
### Step 3: Determine Base Branch
```bash ```bash
# Try common base branches # Try common base branches
@ -46,9 +63,9 @@ git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
Or ask: "This branch split from main - is that correct?" Or ask: "This branch split from main - is that correct?"
### Step 3: Present Options ### Step 4: Present Options
Present exactly these 4 options: **Normal repo and named-branch worktree — present exactly these 4 options:**
``` ```
Implementation complete. What would you like to do? Implementation complete. What would you like to do?
@ -61,30 +78,45 @@ Implementation complete. What would you like to do?
Which option? Which option?
``` ```
**Detached HEAD — present exactly these 3 options:**
```
Implementation complete. You're on a detached HEAD (externally managed workspace).
1. Push as new branch and create a Pull Request
2. Keep as-is (I'll handle it later)
3. Discard this work
Which option?
```
**Don't add explanation** - keep options concise. **Don't add explanation** - keep options concise.
### Step 4: Execute Choice ### Step 5: Execute Choice
#### Option 1: Merge Locally #### Option 1: Merge Locally
```bash ```bash
# Switch to base branch # Get main repo root for CWD safety
MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
cd "$MAIN_ROOT"
# Merge first — verify success before removing anything
git checkout <base-branch> git checkout <base-branch>
# Pull latest
git pull git pull
# Merge feature branch
git merge <feature-branch> git merge <feature-branch>
# Verify tests on merged result # Verify tests on merged result
<test command> <test command>
# If tests pass # Only after merge succeeds: cleanup worktree (Step 6), then delete branch
git branch -d <feature-branch>
``` ```
Then: Cleanup worktree (Step 5) Then: Cleanup worktree (Step 6), then delete branch:
```bash
git branch -d <feature-branch>
```
#### Option 2: Push and Create PR #### Option 2: Push and Create PR
@ -103,7 +135,7 @@ EOF
)" )"
``` ```
Then: Cleanup worktree (Step 5) **Do NOT clean up worktree** — user needs it alive to iterate on PR feedback.
#### Option 3: Keep As-Is #### Option 3: Keep As-Is
@ -127,36 +159,46 @@ Wait for exact confirmation.
If confirmed: If confirmed:
```bash ```bash
git checkout <base-branch> MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
cd "$MAIN_ROOT"
```
Then: Cleanup worktree (Step 6), then force-delete branch:
```bash
git branch -D <feature-branch> git branch -D <feature-branch>
``` ```
Then: Cleanup worktree (Step 5) ### Step 6: Cleanup Workspace
### Step 5: Cleanup Worktree **Only runs for Options 1 and 4.** Options 2 and 3 always preserve the worktree.
**For Options 1, 2, 4:**
Check if in worktree:
```bash ```bash
git worktree list | grep $(git branch --show-current) GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
WORKTREE_PATH=$(git rev-parse --show-toplevel)
``` ```
If yes: **If `GIT_DIR == GIT_COMMON`:** Normal repo, no worktree to clean up. Done.
**If worktree path is under `.worktrees/`, `worktrees/`, or `~/.config/superpowers/worktrees/`:** Superpowers created this worktree — we own cleanup.
```bash ```bash
git worktree remove <worktree-path> MAIN_ROOT=$(git -C "$(git rev-parse --git-common-dir)/.." rev-parse --show-toplevel)
cd "$MAIN_ROOT"
git worktree remove "$WORKTREE_PATH"
git worktree prune # Self-healing: clean up any stale registrations
``` ```
**For Option 3:** Keep worktree. **Otherwise:** The host environment (harness) owns this workspace. Do NOT remove it. If your platform provides a workspace-exit tool, use it. Otherwise, leave the workspace in place.
## Quick Reference ## Quick Reference
| Option | Merge | Push | Keep Worktree | Cleanup Branch | | Option | Merge | Push | Keep Worktree | Cleanup Branch |
|--------|-------|------|---------------|----------------| |--------|-------|------|---------------|----------------|
| 1. Merge locally | ✓ | - | - | ✓ | | 1. Merge locally | yes | - | - | yes |
| 2. Create PR | - | ✓ | ✓ | - | | 2. Create PR | - | yes | yes | - |
| 3. Keep as-is | - | - | | - | | 3. Keep as-is | - | - | yes | - |
| 4. Discard | - | - | - | (force) | | 4. Discard | - | - | - | yes (force) |
## Common Mistakes ## Common Mistakes
@ -165,13 +207,25 @@ git worktree remove <worktree-path>
- **Fix:** Always verify tests before offering options - **Fix:** Always verify tests before offering options
**Open-ended questions** **Open-ended questions**
- **Problem:** "What should I do next?" ambiguous - **Problem:** "What should I do next?" is ambiguous
- **Fix:** Present exactly 4 structured options - **Fix:** Present exactly 4 structured options (or 3 for detached HEAD)
**Automatic worktree cleanup** **Cleaning up worktree for Option 2**
- **Problem:** Remove worktree when might need it (Option 2, 3) - **Problem:** Remove worktree user needs for PR iteration
- **Fix:** Only cleanup for Options 1 and 4 - **Fix:** Only cleanup for Options 1 and 4
**Deleting branch before removing worktree**
- **Problem:** `git branch -d` fails because worktree still references the branch
- **Fix:** Merge first, remove worktree, then delete branch
**Running git worktree remove from inside the worktree**
- **Problem:** Command fails silently when CWD is inside the worktree being removed
- **Fix:** Always `cd` to main repo root before `git worktree remove`
**Cleaning up harness-owned worktrees**
- **Problem:** Removing a worktree the harness created causes phantom state
- **Fix:** Only clean up worktrees under `.worktrees/`, `worktrees/`, or `~/.config/superpowers/worktrees/`
**No confirmation for discard** **No confirmation for discard**
- **Problem:** Accidentally delete work - **Problem:** Accidentally delete work
- **Fix:** Require typed "discard" confirmation - **Fix:** Require typed "discard" confirmation
@ -183,18 +237,15 @@ git worktree remove <worktree-path>
- Merge without verifying tests on result - Merge without verifying tests on result
- Delete work without confirmation - Delete work without confirmation
- Force-push without explicit request - Force-push without explicit request
- Remove a worktree before confirming merge success
- Clean up worktrees you didn't create (provenance check)
- Run `git worktree remove` from inside the worktree
**Always:** **Always:**
- Verify tests before offering options - Verify tests before offering options
- Present exactly 4 options - Detect environment before presenting menu
- Present exactly 4 options (or 3 for detached HEAD)
- Get typed confirmation for Option 4 - Get typed confirmation for Option 4
- Clean up worktree for Options 1 & 4 only - Clean up worktree for Options 1 & 4 only
- `cd` to main repo root before worktree removal
## Integration - Run `git worktree prune` after removal
**Called by:**
- **subagent-driven-development** (Step 7) - After all tasks complete
- **executing-plans** (Step 5) - After all batches complete
**Pairs with:**
- **using-git-worktrees** - Cleans up worktree created by that skill

View File

@ -5,7 +5,7 @@ description: Use when completing tasks, implementing major features, or before m
# Requesting Code Review # Requesting Code Review
Dispatch superpowers:code-reviewer subagent to catch issues before they cascade. The reviewer gets precisely crafted context for evaluation — never your session's history. This keeps the reviewer focused on the work product, not your thought process, and preserves your own context for continued work. Dispatch a code reviewer subagent to catch issues before they cascade. The reviewer gets precisely crafted context for evaluation — never your session's history. This keeps the reviewer focused on the work product, not your thought process, and preserves your own context for continued work.
**Core principle:** Review early, review often. **Core principle:** Review early, review often.
@ -29,16 +29,15 @@ BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
HEAD_SHA=$(git rev-parse HEAD) HEAD_SHA=$(git rev-parse HEAD)
``` ```
**2. Dispatch code-reviewer subagent:** **2. Dispatch code reviewer subagent:**
Use Task tool with superpowers:code-reviewer type, fill template at `code-reviewer.md` Use Task tool with `general-purpose` type, fill template at `code-reviewer.md`
**Placeholders:** **Placeholders:**
- `{WHAT_WAS_IMPLEMENTED}` - What you just built - `{DESCRIPTION}` - Brief summary of what you built
- `{PLAN_OR_REQUIREMENTS}` - What it should do - `{PLAN_OR_REQUIREMENTS}` - What it should do
- `{BASE_SHA}` - Starting commit - `{BASE_SHA}` - Starting commit
- `{HEAD_SHA}` - Ending commit - `{HEAD_SHA}` - Ending commit
- `{DESCRIPTION}` - Brief summary
**3. Act on feedback:** **3. Act on feedback:**
- Fix Critical issues immediately - Fix Critical issues immediately
@ -56,12 +55,11 @@ You: Let me request code review before proceeding.
BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}') BASE_SHA=$(git log --oneline | grep "Task 1" | head -1 | awk '{print $1}')
HEAD_SHA=$(git rev-parse HEAD) HEAD_SHA=$(git rev-parse HEAD)
[Dispatch superpowers:code-reviewer subagent] [Dispatch code reviewer subagent]
WHAT_WAS_IMPLEMENTED: Verification and repair functions for conversation index DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
PLAN_OR_REQUIREMENTS: Task 2 from docs/superpowers/plans/deployment-plan.md PLAN_OR_REQUIREMENTS: Task 2 from docs/superpowers/plans/deployment-plan.md
BASE_SHA: a7981ec BASE_SHA: a7981ec
HEAD_SHA: 3df7661 HEAD_SHA: 3df7661
DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
[Subagent returns]: [Subagent returns]:
Strengths: Clean architecture, real tests Strengths: Clean architecture, real tests
@ -82,7 +80,7 @@ You: [Fix progress indicators]
- Fix before moving to next task - Fix before moving to next task
**Executing Plans:** **Executing Plans:**
- Review after each batch (3 tasks) - Review after each task or at natural checkpoints
- Get feedback, apply, continue - Get feedback, apply, continue
**Ad-Hoc Development:** **Ad-Hoc Development:**

View File

@ -1,13 +1,16 @@
# Code Review Agent # Code Reviewer Prompt Template
You are reviewing code changes for production readiness. Use this template when dispatching a code reviewer subagent.
**Your task:** **Purpose:** Review completed work against requirements and code quality standards before it cascades into more work.
1. Review {WHAT_WAS_IMPLEMENTED}
2. Compare against {PLAN_OR_REQUIREMENTS} ```
3. Check code quality, architecture, testing Task tool (general-purpose):
4. Categorize issues by severity description: "Review code changes"
5. Assess production readiness prompt: |
You are a Senior Code Reviewer with expertise in software architecture,
design patterns, and best practices. Your job is to review completed work
against its plan or requirements and identify issues before they cascade.
## What Was Implemented ## What Was Implemented
@ -15,7 +18,7 @@ You are reviewing code changes for production readiness.
## Requirements / Plan ## Requirements / Plan
{PLAN_REFERENCE} {PLAN_OR_REQUIREMENTS}
## Git Range to Review ## Git Range to Review
@ -27,39 +30,49 @@ git diff --stat {BASE_SHA}..{HEAD_SHA}
git diff {BASE_SHA}..{HEAD_SHA} git diff {BASE_SHA}..{HEAD_SHA}
``` ```
## Review Checklist ## What to Check
**Code Quality:** **Plan alignment:**
- Does the implementation match the plan / requirements?
- Are deviations justified improvements, or problematic departures?
- Is all planned functionality present?
**Code quality:**
- Clean separation of concerns? - Clean separation of concerns?
- Proper error handling? - Proper error handling?
- Type safety (if applicable)? - Type safety where applicable?
- DRY principle followed? - DRY without premature abstraction?
- Edge cases handled? - Edge cases handled?
**Architecture:** **Architecture:**
- Sound design decisions? - Sound design decisions?
- Scalability considerations? - Reasonable scalability and performance?
- Performance implications?
- Security concerns? - Security concerns?
- Integrates cleanly with surrounding code?
**Testing:** **Testing:**
- Tests actually test logic (not mocks)? - Tests verify real behavior, not mocks?
- Edge cases covered? - Edge cases covered?
- Integration tests where needed? - Integration tests where they matter?
- All tests passing? - All tests passing?
**Requirements:** **Production readiness:**
- All plan requirements met? - Migration strategy if schema changed?
- Implementation matches spec?
- No scope creep?
- Breaking changes documented?
**Production Readiness:**
- Migration strategy (if schema changes)?
- Backward compatibility considered? - Backward compatibility considered?
- Documentation complete? - Documentation complete?
- No obvious bugs? - No obvious bugs?
## Calibration
Categorize issues by actual severity. Not everything is Critical.
Acknowledge what was done well before listing issues — accurate praise
helps the implementer trust the rest of the feedback.
If you find significant deviations from the plan, flag them specifically
so the implementer can confirm whether the deviation was intentional.
If you find issues with the plan itself rather than the implementation,
say so.
## Output Format ## Output Format
### Strengths ### Strengths
@ -74,9 +87,9 @@ git diff {BASE_SHA}..{HEAD_SHA}
[Architecture problems, missing features, poor error handling, test gaps] [Architecture problems, missing features, poor error handling, test gaps]
#### Minor (Nice to Have) #### Minor (Nice to Have)
[Code style, optimization opportunities, documentation improvements] [Code style, optimization opportunities, documentation polish]
**For each issue:** For each issue:
- File:line reference - File:line reference
- What's wrong - What's wrong
- Why it matters - Why it matters
@ -87,25 +100,34 @@ git diff {BASE_SHA}..{HEAD_SHA}
### Assessment ### Assessment
**Ready to merge?** [Yes/No/With fixes] **Ready to merge?** [Yes | No | With fixes]
**Reasoning:** [Technical assessment in 1-2 sentences] **Reasoning:** [1-2 sentence technical assessment]
## Critical Rules ## Critical Rules
**DO:** **DO:**
- Categorize by actual severity (not everything is Critical) - Categorize by actual severity
- Be specific (file:line, not vague) - Be specific (file:line, not vague)
- Explain WHY issues matter - Explain WHY each issue matters
- Acknowledge strengths - Acknowledge strengths
- Give clear verdict - Give a clear verdict
**DON'T:** **DON'T:**
- Say "looks good" without checking - Say "looks good" without checking
- Mark nitpicks as Critical - Mark nitpicks as Critical
- Give feedback on code you didn't review - Give feedback on code you didn't actually read
- Be vague ("improve error handling") - Be vague ("improve error handling")
- Avoid giving a clear verdict - Avoid giving a clear verdict
```
**Placeholders:**
- `{DESCRIPTION}` — brief summary of what was built
- `{PLAN_OR_REQUIREMENTS}` — what it should do (plan file path, task text, or requirements)
- `{BASE_SHA}` — starting commit
- `{HEAD_SHA}` — ending commit
**Reviewer returns:** Strengths, Issues (Critical / Important / Minor), Recommendations, Assessment
## Example Output ## Example Output

View File

@ -11,6 +11,8 @@ Execute plan by dispatching fresh subagent per task, with two-stage review after
**Core principle:** Fresh subagent per task + two-stage review (spec then quality) = high quality, fast iteration **Core principle:** Fresh subagent per task + two-stage review (spec then quality) = high quality, fast iteration
**Continuous execution:** Do not pause to check in with your human partner between tasks. Execute all tasks from the plan without stopping. The only reasons to stop are: BLOCKED status you cannot resolve, ambiguity that genuinely prevents progress, or all tasks complete. "Should I continue?" prompts and progress summaries waste their time — they asked you to execute the plan, so execute it.
## When to Use ## When to Use
```dot ```dot
@ -265,7 +267,7 @@ Done!
## Integration ## Integration
**Required workflow skills:** **Required workflow skills:**
- **superpowers:using-git-worktrees** - REQUIRED: Set up isolated workspace before starting - **superpowers:using-git-worktrees** - Ensures isolated workspace (creates one or verifies existing)
- **superpowers:writing-plans** - Creates the plan this skill executes - **superpowers:writing-plans** - Creates the plan this skill executes
- **superpowers:requesting-code-review** - Code review template for reviewer subagents - **superpowers:requesting-code-review** - Code review template for reviewer subagents
- **superpowers:finishing-a-development-branch** - Complete development after all tasks - **superpowers:finishing-a-development-branch** - Complete development after all tasks

View File

@ -7,14 +7,13 @@ Use this template when dispatching a code quality reviewer subagent.
**Only dispatch after spec compliance review passes.** **Only dispatch after spec compliance review passes.**
``` ```
Task tool (superpowers:code-reviewer): Task tool (general-purpose):
Use template at requesting-code-review/code-reviewer.md Use template at requesting-code-review/code-reviewer.md
WHAT_WAS_IMPLEMENTED: [from implementer's report] DESCRIPTION: [task summary, from implementer's report]
PLAN_OR_REQUIREMENTS: Task N from [plan-file] PLAN_OR_REQUIREMENTS: Task N from [plan-file]
BASE_SHA: [commit before task] BASE_SHA: [commit before task]
HEAD_SHA: [current commit] HEAD_SHA: [current commit]
DESCRIPTION: [task summary]
``` ```
**In addition to standard code quality concerns, the reviewer should check:** **In addition to standard code quality concerns, the reviewer should check:**

View File

@ -4,7 +4,7 @@ Reference example of extracting, structuring, and bulletproofing a critical skil
## Source Material ## Source Material
Extracted debugging framework from `/Users/jesse/.claude/CLAUDE.md`: Extracted debugging framework from `~/.claude/CLAUDE.md`:
- 4-phase systematic process (Investigation → Pattern Analysis → Hypothesis → Implementation) - 4-phase systematic process (Investigation → Pattern Analysis → Hypothesis → Implementation)
- Core mandate: ALWAYS find root cause, NEVER fix symptoms - Core mandate: ALWAYS find root cause, NEVER fix symptoms
- Rules designed to resist time pressure and rationalization - Rules designed to resist time pressure and rationalization

View File

@ -33,7 +33,7 @@ digraph when_to_use {
### 1. Observe the Symptom ### 1. Observe the Symptom
``` ```
Error: git init failed in /Users/jesse/project/packages/core Error: git init failed in ~/project/packages/core
``` ```
### 2. Find Immediate Cause ### 2. Find Immediate Cause

View File

@ -1,104 +1,117 @@
--- ---
name: using-git-worktrees name: using-git-worktrees
description: Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification description: Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback
--- ---
# Using Git Worktrees # Using Git Worktrees
## Overview ## Overview
Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching. Ensure work happens in an isolated workspace. Prefer your platform's native worktree tools. Fall back to manual git worktrees only when no native tool is available.
**Core principle:** Systematic directory selection + safety verification = reliable isolation. **Core principle:** Detect existing isolation first. Then use native tools. Then fall back to git. Never fight the harness.
**Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace." **Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace."
## Directory Selection Process ## Step 0: Detect Existing Isolation
Follow this priority order: **Before creating anything, check if you are already in an isolated workspace.**
### 1. Check Existing Directories
```bash ```bash
# Check in priority order GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
BRANCH=$(git branch --show-current)
```
**Submodule guard:** `GIT_DIR != GIT_COMMON` is also true inside git submodules. Before concluding "already in a worktree," verify you are not in a submodule:
```bash
# If this returns a path, you're in a submodule, not a worktree — treat as normal repo
git rev-parse --show-superproject-working-tree 2>/dev/null
```
**If `GIT_DIR != GIT_COMMON` (and not a submodule):** You are already in a linked worktree. Skip to Step 3 (Project Setup). Do NOT create another worktree.
Report with branch state:
- On a branch: "Already in isolated workspace at `<path>` on branch `<name>`."
- Detached HEAD: "Already in isolated workspace at `<path>` (detached HEAD, externally managed). Branch creation needed at finish time."
**If `GIT_DIR == GIT_COMMON` (or in a submodule):** You are in a normal repo checkout.
Has the user already indicated their worktree preference in your instructions? If not, ask for consent before creating a worktree:
> "Would you like me to set up an isolated worktree? It protects your current branch from changes."
Honor any existing declared preference without asking. If the user declines consent, work in place and skip to Step 3.
## Step 1: Create Isolated Workspace
**You have two mechanisms. Try them in this order.**
### 1a. Native Worktree Tools (preferred)
The user has asked for an isolated workspace (Step 0 consent). Do you already have a way to create a worktree? It might be a tool with a name like `EnterWorktree`, `WorktreeCreate`, a `/worktree` command, or a `--worktree` flag. If you do, use it and skip to Step 3.
Native tools handle directory placement, branch creation, and cleanup automatically. Using `git worktree add` when you have a native tool creates phantom state your harness can't see or manage.
Only proceed to Step 1b if you have no native worktree tool available.
### 1b. Git Worktree Fallback
**Only use this if Step 1a does not apply** — you have no native worktree tool available. Create a worktree manually using git.
#### Directory Selection
Follow this priority order. Explicit user preference always beats observed filesystem state.
1. **Check your instructions for a declared worktree directory preference.** If the user has already specified one, use it without asking.
2. **Check for an existing project-local worktree directory:**
```bash
ls -d .worktrees 2>/dev/null # Preferred (hidden) ls -d .worktrees 2>/dev/null # Preferred (hidden)
ls -d worktrees 2>/dev/null # Alternative ls -d worktrees 2>/dev/null # Alternative
``` ```
If found, use it. If both exist, `.worktrees` wins.
**If found:** Use that directory. If both exist, `.worktrees` wins. 3. **Check for an existing global directory:**
### 2. Check CLAUDE.md
```bash ```bash
grep -i "worktree.*director" CLAUDE.md 2>/dev/null project=$(basename "$(git rev-parse --show-toplevel)")
ls -d ~/.config/superpowers/worktrees/$project 2>/dev/null
``` ```
If found, use it (backward compatibility with legacy global path).
**If preference specified:** Use it without asking. 4. **If there is no other guidance available**, default to `.worktrees/` at the project root.
### 3. Ask User #### Safety Verification (project-local directories only)
If no directory exists and no CLAUDE.md preference:
```
No worktree directory found. Where should I create worktrees?
1. .worktrees/ (project-local, hidden)
2. ~/.config/superpowers/worktrees/<project-name>/ (global location)
Which would you prefer?
```
## Safety Verification
### For Project-Local Directories (.worktrees or worktrees)
**MUST verify directory is ignored before creating worktree:** **MUST verify directory is ignored before creating worktree:**
```bash ```bash
# Check if directory is ignored (respects local, global, and system gitignore)
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
``` ```
**If NOT ignored:** **If NOT ignored:** Add to .gitignore, commit the change, then proceed.
Per Jesse's rule "Fix broken things immediately":
1. Add appropriate line to .gitignore
2. Commit the change
3. Proceed with worktree creation
**Why critical:** Prevents accidentally committing worktree contents to repository. **Why critical:** Prevents accidentally committing worktree contents to repository.
### For Global Directory (~/.config/superpowers/worktrees) Global directories (`~/.config/superpowers/worktrees/`) need no verification.
No .gitignore verification needed - outside project entirely. #### Create the Worktree
## Creation Steps
### 1. Detect Project Name
```bash ```bash
project=$(basename "$(git rev-parse --show-toplevel)") project=$(basename "$(git rev-parse --show-toplevel)")
```
### 2. Create Worktree # Determine path based on chosen location
# For project-local: path="$LOCATION/$BRANCH_NAME"
# For global: path="~/.config/superpowers/worktrees/$project/$BRANCH_NAME"
```bash
# Determine full path
case $LOCATION in
.worktrees|worktrees)
path="$LOCATION/$BRANCH_NAME"
;;
~/.config/superpowers/worktrees/*)
path="~/.config/superpowers/worktrees/$project/$BRANCH_NAME"
;;
esac
# Create worktree with new branch
git worktree add "$path" -b "$BRANCH_NAME" git worktree add "$path" -b "$BRANCH_NAME"
cd "$path" cd "$path"
``` ```
### 3. Run Project Setup **Sandbox fallback:** If `git worktree add` fails with a permission error (sandbox denial), tell the user the sandbox blocked worktree creation and you're working in the current directory instead. Then run setup and baseline tests in place.
## Step 3: Project Setup
Auto-detect and run appropriate setup: Auto-detect and run appropriate setup:
@ -117,23 +130,20 @@ if [ -f pyproject.toml ]; then poetry install; fi
if [ -f go.mod ]; then go mod download; fi if [ -f go.mod ]; then go mod download; fi
``` ```
### 4. Verify Clean Baseline ## Step 4: Verify Clean Baseline
Run tests to ensure worktree starts clean: Run tests to ensure workspace starts clean:
```bash ```bash
# Examples - use project-appropriate command # Use project-appropriate command
npm test npm test / cargo test / pytest / go test ./...
cargo test
pytest
go test ./...
``` ```
**If tests fail:** Report failures, ask whether to proceed or investigate. **If tests fail:** Report failures, ask whether to proceed or investigate.
**If tests pass:** Report ready. **If tests pass:** Report ready.
### 5. Report Location ### Report
``` ```
Worktree ready at <full-path> Worktree ready at <full-path>
@ -145,16 +155,32 @@ Ready to implement <feature-name>
| Situation | Action | | Situation | Action |
|-----------|--------| |-----------|--------|
| Already in linked worktree | Skip creation (Step 0) |
| In a submodule | Treat as normal repo (Step 0 guard) |
| Native worktree tool available | Use it (Step 1a) |
| No native tool | Git worktree fallback (Step 1b) |
| `.worktrees/` exists | Use it (verify ignored) | | `.worktrees/` exists | Use it (verify ignored) |
| `worktrees/` exists | Use it (verify ignored) | | `worktrees/` exists | Use it (verify ignored) |
| Both exist | Use `.worktrees/` | | Both exist | Use `.worktrees/` |
| Neither exists | Check CLAUDE.md → Ask user | | Neither exists | Check instruction file, then default `.worktrees/` |
| Global path exists | Use it (backward compat) |
| Directory not ignored | Add to .gitignore + commit | | Directory not ignored | Add to .gitignore + commit |
| Permission error on create | Sandbox fallback, work in place |
| Tests fail during baseline | Report failures + ask | | Tests fail during baseline | Report failures + ask |
| No package.json/Cargo.toml | Skip dependency install | | No package.json/Cargo.toml | Skip dependency install |
## Common Mistakes ## Common Mistakes
### Fighting the harness
- **Problem:** Using `git worktree add` when the platform already provides isolation
- **Fix:** Step 0 detects existing isolation. Step 1a defers to native tools.
### Skipping detection
- **Problem:** Creating a nested worktree inside an existing one
- **Fix:** Always run Step 0 before creating anything
### Skipping ignore verification ### Skipping ignore verification
- **Problem:** Worktree contents get tracked, pollute git status - **Problem:** Worktree contents get tracked, pollute git status
@ -163,56 +189,27 @@ Ready to implement <feature-name>
### Assuming directory location ### Assuming directory location
- **Problem:** Creates inconsistency, violates project conventions - **Problem:** Creates inconsistency, violates project conventions
- **Fix:** Follow priority: existing > CLAUDE.md > ask - **Fix:** Follow priority: existing > global legacy > instruction file > default
### Proceeding with failing tests ### Proceeding with failing tests
- **Problem:** Can't distinguish new bugs from pre-existing issues - **Problem:** Can't distinguish new bugs from pre-existing issues
- **Fix:** Report failures, get explicit permission to proceed - **Fix:** Report failures, get explicit permission to proceed
### Hardcoding setup commands
- **Problem:** Breaks on projects using different tools
- **Fix:** Auto-detect from project files (package.json, etc.)
## Example Workflow
```
You: I'm using the using-git-worktrees skill to set up an isolated workspace.
[Check .worktrees/ - exists]
[Verify ignored - git check-ignore confirms .worktrees/ is ignored]
[Create worktree: git worktree add .worktrees/auth -b feature/auth]
[Run npm install]
[Run npm test - 47 passing]
Worktree ready at /Users/jesse/myproject/.worktrees/auth
Tests passing (47 tests, 0 failures)
Ready to implement auth feature
```
## Red Flags ## Red Flags
**Never:** **Never:**
- Create a worktree when Step 0 detects existing isolation
- Use `git worktree add` when you have a native worktree tool (e.g., `EnterWorktree`). This is the #1 mistake — if you have it, use it.
- Skip Step 1a by jumping straight to Step 1b's git commands
- Create worktree without verifying it's ignored (project-local) - Create worktree without verifying it's ignored (project-local)
- Skip baseline test verification - Skip baseline test verification
- Proceed with failing tests without asking - Proceed with failing tests without asking
- Assume directory location when ambiguous
- Skip CLAUDE.md check
**Always:** **Always:**
- Follow directory priority: existing > CLAUDE.md > ask - Run Step 0 detection first
- Prefer native tools over git fallback
- Follow directory priority: existing > global legacy > instruction file > default
- Verify directory is ignored for project-local - Verify directory is ignored for project-local
- Auto-detect and run project setup - Auto-detect and run project setup
- Verify clean test baseline - Verify clean test baseline
## Integration
**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

View File

@ -4,9 +4,9 @@ Skills use Claude Code tool names. When you encounter these in a skill, use your
| Skill references | Codex equivalent | | Skill references | Codex equivalent |
|-----------------|------------------| |-----------------|------------------|
| `Task` tool (dispatch subagent) | `spawn_agent` (see [Named agent dispatch](#named-agent-dispatch)) | | `Task` tool (dispatch subagent) | `spawn_agent` (see [Subagent dispatch requires multi-agent support](#subagent-dispatch-requires-multi-agent-support)) |
| Multiple `Task` calls (parallel) | Multiple `spawn_agent` calls | | Multiple `Task` calls (parallel) | Multiple `spawn_agent` calls |
| Task returns result | `wait` | | Task returns result | `wait_agent` |
| Task completes automatically | `close_agent` to free slot | | Task completes automatically | `close_agent` to free slot |
| `TodoWrite` (task tracking) | `update_plan` | | `TodoWrite` (task tracking) | `update_plan` |
| `Skill` tool (invoke a skill) | Skills load natively — just follow the instructions | | `Skill` tool (invoke a skill) | Skills load natively — just follow the instructions |
@ -22,53 +22,12 @@ Add to your Codex config (`~/.codex/config.toml`):
multi_agent = true multi_agent = true
``` ```
This enables `spawn_agent`, `wait`, and `close_agent` for skills like `dispatching-parallel-agents` and `subagent-driven-development`. This enables `spawn_agent`, `wait_agent`, and `close_agent` for skills like `dispatching-parallel-agents` and `subagent-driven-development`.
## Named agent dispatch Legacy note: Codex builds before `rust-v0.115.0` exposed spawned-agent
waiting as `wait`. Current Codex uses `wait_agent` for spawned agents. The
Claude Code skills reference named agent types like `superpowers:code-reviewer`. `wait` name now belongs to code-mode `exec/wait`, which resumes a yielded exec
Codex does not have a named agent registry — `spawn_agent` creates generic agents cell by `cell_id`; it is not the spawned-agent result tool.
from built-in roles (`default`, `explorer`, `worker`).
When a skill says to dispatch a named agent type:
1. Find the agent's prompt file (e.g., `agents/code-reviewer.md` or the skill's
local prompt template like `code-quality-reviewer-prompt.md`)
2. Read the prompt content
3. Fill any template placeholders (`{BASE_SHA}`, `{WHAT_WAS_IMPLEMENTED}`, etc.)
4. Spawn a `worker` agent with the filled content as the `message`
| Skill instruction | Codex equivalent |
|-------------------|------------------|
| `Task tool (superpowers:code-reviewer)` | `spawn_agent(agent_type="worker", message=...)` with `code-reviewer.md` content |
| `Task tool (general-purpose)` with inline prompt | `spawn_agent(message=...)` with the same prompt |
### Message framing
The `message` parameter is user-level input, not a system prompt. Structure it
for maximum instruction adherence:
```
Your task is to perform the following. Follow the instructions below exactly.
<agent-instructions>
[filled prompt content from the agent's .md file]
</agent-instructions>
Execute this now. Output ONLY the structured response following the format
specified in the instructions above.
```
- Use task-delegation framing ("Your task is...") rather than persona framing ("You are...")
- Wrap instructions in XML tags — the model treats tagged blocks as authoritative
- End with an explicit execution directive to prevent summarization of the instructions
### When this workaround can be removed
This approach compensates for Codex's plugin system not yet supporting an `agents`
field in `plugin.json`. When `RawPluginManifest` gains an `agents` field, the
plugin can symlink to `agents/` (mirroring the existing `skills/` symlink) and
skills can dispatch named agent types directly.
## Environment Detection ## Environment Detection

View File

@ -12,23 +12,13 @@ Skills use Claude Code tool names. When you encounter these in a skill, use your
| `Glob` (search files by name) | `glob` | | `Glob` (search files by name) | `glob` |
| `Skill` tool (invoke a skill) | `skill` | | `Skill` tool (invoke a skill) | `skill` |
| `WebFetch` | `web_fetch` | | `WebFetch` | `web_fetch` |
| `Task` tool (dispatch subagent) | `task` (see [Agent types](#agent-types)) | | `Task` tool (dispatch subagent) | `task` with `agent_type: "general-purpose"` or `"explore"` |
| Multiple `Task` calls (parallel) | Multiple `task` calls | | Multiple `Task` calls (parallel) | Multiple `task` calls |
| Task status/output | `read_agent`, `list_agents` | | Task status/output | `read_agent`, `list_agents` |
| `TodoWrite` (task tracking) | `sql` with built-in `todos` table | | `TodoWrite` (task tracking) | `sql` with built-in `todos` table |
| `WebSearch` | No equivalent — use `web_fetch` with a search engine URL | | `WebSearch` | No equivalent — use `web_fetch` with a search engine URL |
| `EnterPlanMode` / `ExitPlanMode` | No equivalent — stay in the main session | | `EnterPlanMode` / `ExitPlanMode` | No equivalent — stay in the main session |
## Agent types
Copilot CLI's `task` tool accepts an `agent_type` parameter:
| Claude Code agent | Copilot CLI equivalent |
|-------------------|----------------------|
| `general-purpose` | `"general-purpose"` |
| `Explore` | `"explore"` |
| Named plugin agents (e.g. `superpowers:code-reviewer`) | Discovered automatically from installed plugins |
## Async shell sessions ## Async shell sessions
Copilot CLI supports persistent async shell sessions, which have no direct Claude Code equivalent: Copilot CLI supports persistent async shell sessions, which have no direct Claude Code equivalent:

View File

@ -14,11 +14,29 @@ Skills use Claude Code tool names. When you encounter these in a skill, use your
| `Skill` tool (invoke a skill) | `activate_skill` | | `Skill` tool (invoke a skill) | `activate_skill` |
| `WebSearch` | `google_web_search` | | `WebSearch` | `google_web_search` |
| `WebFetch` | `web_fetch` | | `WebFetch` | `web_fetch` |
| `Task` tool (dispatch subagent) | No equivalent — Gemini CLI does not support subagents | | `Task` tool (dispatch subagent) | `@agent-name` (see [Subagent support](#subagent-support)) |
## No subagent support ## Subagent support
Gemini CLI has no equivalent to Claude Code's `Task` tool. Skills that rely on subagent dispatch (`subagent-driven-development`, `dispatching-parallel-agents`) will fall back to single-session execution via `executing-plans`. Gemini CLI supports subagents natively via the `@` syntax. Use the built-in `@generalist` agent to dispatch any task — it has access to all tools and follows the prompt you provide.
When a skill says to dispatch a named agent type, use `@generalist` with the full prompt from the skill's prompt template:
| Skill instruction | Gemini CLI equivalent |
|-------------------|----------------------|
| `Task tool (superpowers:implementer)` | `@generalist` with the filled `implementer-prompt.md` template |
| `Task tool (superpowers:spec-reviewer)` | `@generalist` with the filled `spec-reviewer-prompt.md` template |
| `Task tool (superpowers:code-reviewer)` | `@code-reviewer` (bundled agent) or `@generalist` with the filled review prompt |
| `Task tool (superpowers:code-quality-reviewer)` | `@generalist` with the filled `code-quality-reviewer-prompt.md` template |
| `Task tool (general-purpose)` with inline prompt | `@generalist` with your inline prompt |
### Prompt filling
Skills provide prompt templates with placeholders like `{WHAT_WAS_IMPLEMENTED}` or `[FULL TEXT of task]`. Fill all placeholders and pass the complete prompt as the message to `@generalist`. The prompt template itself contains the agent's role, review criteria, and expected output format — `@generalist` will follow it.
### Parallel dispatch
Gemini CLI supports parallel subagent dispatch. When a skill asks you to dispatch multiple independent subagent tasks in parallel, request all of those `@generalist` or named subagent tasks together in the same prompt. Keep dependent tasks sequential, but do not serialize independent subagent tasks just to preserve a simpler history.
## Additional Gemini CLI tools ## Additional Gemini CLI tools

View File

@ -13,7 +13,7 @@ Assume they are a skilled developer, but know almost nothing about our toolset o
**Announce at start:** "I'm using the writing-plans skill to create the implementation plan." **Announce at start:** "I'm using the writing-plans skill to create the implementation plan."
**Context:** This should be run in a dedicated worktree (created by brainstorming skill). **Context:** If working in an isolated worktree, it should have been created via the `superpowers:using-git-worktrees` skill at execution time.
**Save plans to:** `docs/superpowers/plans/YYYY-MM-DD-<feature-name>.md` **Save plans to:** `docs/superpowers/plans/YYYY-MM-DD-<feature-name>.md`
- (User preferences for plan location override this default) - (User preferences for plan location override this default)