git-worktree
Installation
SKILL.md
Git Worktrees for Parallel Agents
Start here (before any task work)
Detect where you are:
[ "$(git rev-parse --path-format=absolute --git-dir)" = "$(git rev-parse --path-format=absolute --git-common-dir)" ] \
&& echo "primary checkout" || echo "worktree"
- Primary checkout → do NOT start editing here. Create a worktree named after the task, bootstrap it (see "Making the worktree complete"),
cdinto it, and do ALL task work there. - Worktree (e.g. Cursor already started you in one) → proceed with the task.
What a worktree is
One repo, multiple folders. git worktree add creates an extra checkout of the same repository in a separate directory, on its own branch. All worktrees share one .git history, but each has its own files. Two agents in two worktrees physically cannot overwrite each other's work.