worktrees

Installation
SKILL.md

Worktrees

Give feature work an isolated workspace with a verified-clean starting point. Order of preference: detect isolation that already exists → the harness's native workspace tool → a manual git worktree fallback. Never fight the harness.

Step 0 — Detect and get consent

Check whether you are already inside a linked worktree:

GIT_DIR=$(cd "$(git rev-parse --git-dir)" && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" && pwd -P)
  • GIT_DIR != GIT_COMMON → likely a linked worktree, but guard against submodules first: if git rev-parse --show-superproject-working-tree prints a path, you are in a submodule — treat it as a normal checkout. Otherwise you are already isolated: report the path and branch, skip creation, go to Step 2.
  • GIT_DIR == GIT_COMMON → normal checkout. If the user has a stated worktree preference, honor it silently. If not, ask: "Want me to set this up in an isolated worktree so your current branch stays untouched?" Declined → work in place, go to Step 2.

Done when: you know which of the three cases you are in, and you have consent if creating.

Step 1 — Create the workspace

Installs
49
GitHub Stars
1
First Seen
Jul 7, 2026
worktrees — jayden-dang/skills