using-git-worktreeslisted
Install: claude install-skill FrogBaek/cue
# Using Git Worktrees
**Speak the repository's language.** `.cue/dev/config`'s `language` decides what
you write to the user, and the session hook states it at the top of every session
— this skill runs no cue-dev script that repeats it. This skill body is English
because it is the plugin's source, not because it is your output. Paths, branch
names, code and commands stay exactly as written.
## Overview
Ensure work happens in an isolated workspace, cut with git and worked in by path.
**Core principle:** Detect existing isolation first. Then cut the worktree with
`git worktree add` at a path a script chose, and work in it with `git -C <path>`.
Nothing is handed to a harness worktree tool — not because harness tools are bad,
but because the one this plugin can use gives back less than it takes.
**Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace."
## Step 0: Detect Existing Isolation
**Before creating anything, check if you are already in an isolated workspace.**
```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)
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-superpr