This commit is contained in:
pi
2026-04-12 19:11:51 +01:00
parent 5d5d0e2d26
commit f706efdcdb
171 changed files with 115 additions and 19193 deletions

View File

@@ -26,7 +26,7 @@ You MUST create a task for each of these items and complete them in order:
3. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
4. **Propose 2-3 approaches** — with trade-offs and your recommendation
5. **Present design** — in sections scaled to their complexity, get user approval after each section
6. **Write design doc** — save to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` and commit
6. **Write design doc** — save to `docs/specs/YYYY-MM-DD-<topic>-design.md` and commit
7. **Spec self-review** — quick inline check for placeholders, contradictions, ambiguity, scope (see below)
8. **User reviews written spec** — ask user to review the spec file before proceeding
9. **Transition to implementation** — invoke writing-plans skill to create implementation plan
@@ -108,7 +108,7 @@ digraph brainstorming {
**Documentation:**
- Write the validated design (spec) to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`
- Write the validated design (spec) to `docs/specs/YYYY-MM-DD-<topic>-design.md`
- (User preferences for spec location override this default)
- Use elements-of-style:writing-clearly-and-concisely skill if available
- Commit the design document to git

View File

@@ -4,7 +4,7 @@ Use this template when dispatching a spec document reviewer subagent.
**Purpose:** Verify the spec is complete, consistent, and ready for implementation planning.
**Dispatch after:** Spec document is written to docs/superpowers/specs/
**Dispatch after:** Spec document is written to docs/specs/
```
Task tool (general-purpose):

View File

@@ -135,7 +135,7 @@ Then: Cleanup worktree (Step 5)
### Step 5: Cleanup Worktree
**For Options 1, 2, 4:**
**Default for Options 1, 2, 4:** Clean up the worktree unless the user explicitly asked to preserve it.
Check if in worktree:
```bash
@@ -154,7 +154,7 @@ git worktree remove <worktree-path>
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|--------|-------|------|---------------|----------------|
| 1. Merge locally | ✓ | - | - | ✓ |
| 2. Create PR | - | ✓ | | - |
| 2. Create PR | - | ✓ | - | - |
| 3. Keep as-is | - | - | ✓ | - |
| 4. Discard | - | - | - | ✓ (force) |
@@ -168,9 +168,9 @@ git worktree remove <worktree-path>
- **Problem:** "What should I do next?" → ambiguous
- **Fix:** Present exactly 4 structured options
**Automatic worktree cleanup**
- **Problem:** Remove worktree when might need it (Option 2, 3)
- **Fix:** Only cleanup for Options 1 and 4
**Wrong cleanup default**
- **Problem:** Preserve worktrees after merge/PR when cleanup is supposed to be the default
- **Fix:** Cleanup for Options 1, 2, and 4 unless the user explicitly asks to keep the worktree
**No confirmation for discard**
- **Problem:** Accidentally delete work
@@ -188,7 +188,8 @@ git worktree remove <worktree-path>
- Verify tests before offering options
- Present exactly 4 options
- Get typed confirmation for Option 4
- Clean up worktree for Options 1 & 4 only
- Clean up worktree for Options 1, 2, and 4 by default
- Preserve the worktree for Option 3 or when the user explicitly says to keep it
## Integration

View File

@@ -58,7 +58,7 @@ HEAD_SHA=$(git rev-parse HEAD)
[Dispatch superpowers:code-reviewer subagent]
WHAT_WAS_IMPLEMENTED: Verification and repair functions for conversation index
PLAN_OR_REQUIREMENTS: Task 2 from docs/superpowers/plans/deployment-plan.md
PLAN_OR_REQUIREMENTS: Task 2 from docs/plans/deployment-plan.md
BASE_SHA: a7981ec
HEAD_SHA: 3df7661
DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types

View File

@@ -128,7 +128,7 @@ Implementer subagents report one of four statuses. Handle each appropriately:
```
You: I'm using Subagent-Driven Development to execute this plan.
[Read plan file once: docs/superpowers/plans/feature-plan.md]
[Read plan file once: docs/plans/feature-plan.md]
[Extract all 5 tasks with full text and context]
[Create TodoWrite with all tasks]

View File

@@ -1,6 +1,6 @@
---
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 - creates isolated git worktrees with safety verification
---
# Using Git Worktrees
@@ -9,68 +9,37 @@ description: Use when starting feature work that needs isolation from current wo
Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.
**Core principle:** Systematic directory selection + safety verification = reliable isolation.
**Core principle:** Use repo-root `.worktree/` + safety verification for reliable isolation.
**Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace."
## Directory Selection Process
## Directory Rule
Follow this priority order:
Use repo-root `.worktree/` by default.
### 1. Check Existing Directories
Do **not** suggest:
- `.worktrees/`
- `worktrees/`
- `~/.config/superpowers/worktrees/...`
```bash
# Check in priority order
ls -d .worktrees 2>/dev/null # Preferred (hidden)
ls -d worktrees 2>/dev/null # Alternative
```
**If found:** Use that directory. If both exist, `.worktrees` wins.
### 2. Check CLAUDE.md
```bash
grep -i "worktree.*director" CLAUDE.md 2>/dev/null
```
**If preference specified:** Use it without asking.
### 3. Ask User
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?
```
Only deviate if the user explicitly asks for a different location.
## Safety Verification
### For Project-Local Directories (.worktrees or worktrees)
**MUST verify directory is ignored before creating worktree:**
**MUST verify `.worktree/` is ignored before creating a worktree:**
```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 .worktree/ 2>/dev/null || git check-ignore -q .worktree 2>/dev/null
```
**If NOT ignored:**
Per Jesse's rule "Fix broken things immediately":
1. Add appropriate line to .gitignore
1. Add `.worktree/` to `.gitignore`
2. Commit the change
3. Proceed with worktree creation
**Why critical:** Prevents accidentally committing worktree contents to repository.
### For Global Directory (~/.config/superpowers/worktrees)
No .gitignore verification needed - outside project entirely.
**Why critical:** Prevents accidentally committing worktree contents to the repository.
## Creation Steps
@@ -83,17 +52,7 @@ project=$(basename "$(git rev-parse --show-toplevel)")
### 2. Create Worktree
```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
path=".worktree/$BRANCH_NAME"
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"
```
@@ -145,48 +104,45 @@ Ready to implement <feature-name>
| Situation | Action |
|-----------|--------|
| `.worktrees/` exists | Use it (verify ignored) |
| `worktrees/` exists | Use it (verify ignored) |
| Both exist | Use `.worktrees/` |
| Neither exists | Check CLAUDE.md → Ask user |
| Directory not ignored | Add to .gitignore + commit |
| Tests fail during baseline | Report failures + ask |
| No package.json/Cargo.toml | Skip dependency install |
| Starting feature work | Use `.worktree/<branch-name>` |
| `.worktree/` not ignored | Add `.worktree/` to `.gitignore`, commit, continue |
| Tests fail during baseline | Report failures and ask |
| No package manager/build file | Skip dependency install |
| User explicitly wants another location | Follow the user's instruction |
## Common Mistakes
### Skipping ignore verification
- **Problem:** Worktree contents get tracked, pollute git status
- **Fix:** Always use `git check-ignore` before creating project-local worktree
- **Problem:** Worktree contents get tracked and pollute git status
- **Fix:** Always verify `.worktree/` is ignored first
### Assuming directory location
### Using the wrong directory
- **Problem:** Creates inconsistency, violates project conventions
- **Fix:** Follow priority: existing > CLAUDE.md > ask
- **Problem:** Inconsistent worktree layout across repositories
- **Fix:** Use repo-root `.worktree/` unless the user explicitly overrides it
### Proceeding with failing tests
- **Problem:** Can't distinguish new bugs from pre-existing issues
- **Fix:** Report failures, get explicit permission to proceed
- **Fix:** Report failures and get explicit permission to proceed
### Hardcoding setup commands
- **Problem:** Breaks on projects using different tools
- **Fix:** Auto-detect from project files (package.json, etc.)
- **Fix:** Auto-detect from project files (`package.json`, `Cargo.toml`, 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]
[Verify .worktree/ is ignored]
[Create worktree: git worktree add .worktree/auth -b feature/auth]
[Run npm install]
[Run npm test - 47 passing]
Worktree ready at /Users/jesse/myproject/.worktrees/auth
Worktree ready at /Users/jesse/myproject/.worktree/auth
Tests passing (47 tests, 0 failures)
Ready to implement auth feature
```
@@ -194,17 +150,16 @@ Ready to implement auth feature
## Red Flags
**Never:**
- Create worktree without verifying it's ignored (project-local)
- Create a worktree without verifying `.worktree/` is ignored
- Skip baseline test verification
- Proceed with failing tests without asking
- Assume directory location when ambiguous
- Skip CLAUDE.md check
- Suggest `.worktrees/`, `worktrees/`, or `~/.config/superpowers/worktrees/...` by default
**Always:**
- Follow directory priority: existing > CLAUDE.md > ask
- Verify directory is ignored for project-local
- Use repo-root `.worktree/` by default
- Verify `.worktree/` is ignored
- Auto-detect and run project setup
- Verify clean test baseline
- Verify a clean test baseline
## Integration

View File

@@ -15,7 +15,7 @@ Assume they are a skilled developer, but know almost nothing about our toolset o
**Context:** This should be run in a dedicated worktree (created by brainstorming skill).
**Save plans to:** `docs/superpowers/plans/YYYY-MM-DD-<feature-name>.md`
**Save plans to:** `docs/plans/YYYY-MM-DD-<feature-name>.md`
- (User preferences for plan location override this default)
## Scope Check
@@ -135,7 +135,7 @@ If you find issues, fix them inline. No need to re-review — just fix and move
After saving the plan, offer execution choice:
**"Plan complete and saved to `docs/superpowers/plans/<filename>.md`. Two execution options:**
**"Plan complete and saved to `docs/plans/<filename>.md`. Two execution options:**
**1. Subagent-Driven (recommended)** - I dispatch a fresh subagent per task, review between tasks, fast iteration