using-git-worktreeslisted
Install: claude install-skill brunob54/superpowers-orchestrator
# Using Git Worktrees
Create an isolated branch workspace with safe defaults.
## Required Start
Announce: `I'm using the using-git-worktrees skill to set up an isolated workspace.`
## Directory Selection Priority
Check in order:
```bash
ls -d .worktrees 2>/dev/null # Preferred (hidden)
ls -d worktrees 2>/dev/null # Alternative
```
1. If `.worktrees/` exists — use it. If both exist, `.worktrees/` wins.
2. If `worktrees/` exists — use it.
3. Check project guidance file (e.g. `CLAUDE.md`) for a stated preference:
```bash
grep -i "worktree.*director" CLAUDE.md 2>/dev/null
```
4. Ask user.
## Safety Check
For project-local worktree directories, verify ignore rules before creating:
```bash
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
```
If **not** ignored:
1. Add the appropriate line to `.gitignore`.
2. **Commit the `.gitignore` change immediately** before proceeding — an uncommitted ignore entry is easy to lose and leaves the worktree contents exposed to accidental staging.
## Creation Steps
### 1. Detect project root and branch name
```bash
project=$(basename "$(git rev-parse --show-toplevel)")
```
Choose a descriptive `BRANCH_NAME` for the feature being isolated.
### 2. Create worktree and branch
```bash
git worktree add <path> -b <BRANCH_NAME>
```
**Critical:** The `cd <path>` in this step does not persist across separate shell calls. Use the full worktree path — `cd <path> && <command>` — in every