using-git-worktreeslisted
Install: claude install-skill RBraga01/a-team
# Using Git Worktrees
## Why Worktrees
A worktree is a second checkout of the same repo in a separate directory. Each worktree has its own working tree and HEAD, but shares the git object store. This means:
- Subagents work in isolation — no interference with your main session
- You can switch tasks without stashing
- Parallel features develop independently
- Clean rollback: abandon the worktree, nothing pollutes main
## When to Use
Use at the START of every feature or bug fix. Do NOT start implementation until a clean worktree exists or you've confirmed you're already in one.
Mandatory before:
- `subagent-driven-development` skill
- `executing-plans` skill
- Any work touching more than one file
## The Process
### Step 1: Detect Existing Isolation
First check — are you already isolated?
```bash
# Check if current directory is a worktree (not the main checkout)
git worktree list
pwd
```
If you're already in a worktree for this feature: proceed to Step 3 (verify clean baseline).
If you're in the main checkout: proceed to Step 2.
### Step 2: Create the Worktree
```bash
# Create worktree + new branch in one command
git worktree add ../worktrees/<feature-name> -b feat/<feature-name>
# Examples:
git worktree add ../worktrees/stripe-billing -b feat/stripe-billing
git worktree add ../worktrees/fix-auth-bug -b fix/auth-token-expiry
```
The worktree is created at `../worktrees/<feature-name>` (sibling of the project root).
If the project uses `.claude/worktrees/`, use th