worktree-newlisted
Install: claude install-skill Enverge-Labs/skills
# Git worktrees
Isolate each task in its own worktree so the main checkout stays on the default branch and parallel work never collides.
## First: find the repo and defer to a local doc
Run these before anything else — they resolve the repo you're actually in (never hardcode a path):
```bash
ROOT="$(git rev-parse --show-toplevel)" || { echo "not a git repo"; exit 1; }
DEFAULT_BRANCH="$(git -C "$ROOT" symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's@^origin/@@' || echo main)"
```
**If `$ROOT/WORKTREES.md` exists, read it and follow it instead** — the repo's own doc is the source of truth and may override the conventions below. Only fall back to this skill's defaults when the repo has no `WORKTREES.md`.
## Naming (default convention)
| Item | Pattern | Example |
|------|---------|---------|
| Directory | `.claude/worktrees/<slug>/` | `.claude/worktrees/add-start-timestamp` |
| Branch | `worktree-<slug>` | `worktree-add-start-timestamp` |
`<slug>` = kebab-case task title (lowercase, hyphens).
## Create
From an up-to-date default branch:
```bash
git -C "$ROOT" fetch origin
SLUG="my-feature-name"
git -C "$ROOT" worktree add -b "worktree-${SLUG}" ".claude/worktrees/${SLUG}" "origin/${DEFAULT_BRANCH}"
cd "$ROOT/.claude/worktrees/${SLUG}"
```
If the branch already exists, drop `-b` and point at it:
```bash
git -C "$ROOT" worktree add ".claude/worktrees/${SLUG}" "worktree-${SLUG}"
```
## Ship
```bash
git add -A && git commit -m "…"
git push -u