Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
camacho avatar

Isolate

  • 391 installs
  • 1 repo stars
  • Updated May 26, 2026
  • camacho/ai-skills

isolate is a Claude Code skill that creates a git worktree branched from the latest origin/main with freshness verification and project setup so developers and coding agents can run parallel tasks without cross-contamina

About

isolate is a Claude Code skill from camacho/ai-skills that sets up an isolated git worktree before task work begins. The skill detects the parent branch via reflog, branches from the current remote main with freshness verification, and runs project setup so agents never start on stale code. Developers invoke isolate when starting feature or fix work that needs branch isolation—typically after /orient supplies a branch name like feat/auth or fix/login-crash. The workflow announces setup explicitly and accepts an optional base ref override when stacking on a branch other than main. isolate keeps parallel agent runs and developer sessions from polluting the active working tree.

  • Git worktree isolation patterns
  • Parallel agent session safety
  • Branch and workspace separation
  • Clean teardown after experiments
  • Conflict-free concurrent development

Isolate by the numbers

  • 391 all-time installs (skills.sh)
  • Ranked #119 of 733 Git & Pull Requests skills by installs in the Skillselion catalog
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/camacho/ai-skills --skill isolate

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs391
repo stars1
Last updatedMay 26, 2026
Repositorycamacho/ai-skills

How do you isolate agent work in git worktrees?

Run parallel agent or developer work in isolated sandboxes or git worktrees without cross-contaminating branches, builds, or in-progress changes.

Who is it for?

Developers and coding agents starting parallel feature or fix work who need a clean worktree synced to the latest remote main.

Skip if: Developers already on the correct feature branch with a clean working tree who do not need a separate worktree.

When should I use this skill?

Task work needs branch isolation before planning or coding, especially for parallel agent runs on feat/* or fix/* branches.

What you get

Fresh git worktree, task branch from origin/main, and verified project setup

  • Isolated git worktree
  • Task feature branch

By the numbers

  • Branches worktrees from origin/main with freshness verification
  • Integrates with /orient Step 1 for branch naming

Files

SKILL.mdMarkdownGitHub ↗

Isolate

Create a worktree branched from the latest origin/main so task work never starts on stale code.

Announce: "Setting up an isolated worktree for this task."

Inputs

  • Branch name: from /orient Step 1 (e.g., feat/auth, fix/login-crash). Ask if not provided.
  • Base ref: the current branch's parent (detected via reflog, default main). Override only when explicitly stacking on a different branch.

Detect parent branch

The parent branch (what this branch will eventually merge into) is determined from the reflog:

PARENT_BRANCH=$(
  git reflog show HEAD --pretty=format:'%gs' \
    | grep "^branch: Created from" \
    | head -1 \
    | sed 's/branch: Created from //' \
    | sed 's|^origin/||'
)
PARENT_BRANCH=${PARENT_BRANCH:-main}

Returns empty when the branch was created from a detached HEAD or in a web session with no reflog — falls back to main. Correct 99% of the time for normal local development.

Already in a Worktree?

If the session CWD is already inside a linked worktree (not the primary), freshen the branch instead of creating a new one:

WORKTREE="<absolute-path-to-current-worktree>"
git -C "$WORKTREE" fetch origin "$PARENT_BRANCH"
git -C "$WORKTREE" merge "origin/$PARENT_BRANCH"

If conflicts arise, stop and present them to the user. Do not auto-resolve.

After freshening, skip ahead to Baseline test.

Step 1: Select directory

PriorityCheckAction
1.worktrees/ existsUse it
2worktrees/ existsUse it
3Both exist.worktrees/ wins
4CLAUDE.md specifiesFollow preference
5None foundAsk user (.worktrees/ recommended)

Step 2: Verify gitignored

git check-ignore -q .worktrees

If NOT ignored, fix before proceeding:

echo ".worktrees" >> .gitignore
git add .gitignore
git commit -m "chore: gitignore worktree directory"

Step 3: Fetch and create

A worktree branched from a stale local parent means baked-in merge conflicts. Always fetch first, always branch from origin/$PARENT_BRANCH (not the local copy).

REPO_ROOT="$(git rev-parse --show-toplevel)"
WORKTREE_DIR="$REPO_ROOT/.worktrees/<name>"

git fetch origin "$PARENT_BRANCH"
git worktree add "$WORKTREE_DIR" -b <prefix>/<name> "origin/$PARENT_BRANCH"

Lock the worktree immediately so git worktree prune doesn't sweep it during long-running agent sessions. Run from the main repo context (not the worktree):

git -C "$REPO_ROOT" worktree lock --reason "Agent session in progress" "$WORKTREE_DIR"

/ship will unlock before removing the worktree at the end of the task.

Claude Code: optionally call EnterWorktree({path}) to move session CWD into the new worktree.

Step 4: Install dependencies

Auto-detect from manifest files:

FileCommand
pnpm-lock.yamlpnpm install
yarn.lockyarn install
package-lock.jsonnpm install
package.json (no lockfile)Ask before installing
Cargo.tomlcargo build
requirements.txtpip install -r requirements.txt
pyproject.tomlpoetry install
go.modgo mod download

Run from the worktree path: pnpm --dir "$WORKTREE_DIR" install

Step 5: Baseline test

Run the project's test suite. If tests fail, report failures and ask whether to proceed. Do not silently continue.

Report

Worktree ready at <absolute-path>
Branch: <prefix>/<name> (from origin/main @ <short-sha>)
Tests: <N> passing

Path Discipline

cd does not persist between Claude Code Bash calls. Use absolute paths for all file operations and git -C <abs-path> for git commands.

Integration

Called by: /task (Step 2), /brainstorming, /build Pairs with: /ship (cleans up worktree after work is done)

Related skills

How it compares

Use isolate instead of manual git checkout when parallel agents or tasks need separate worktrees synced to remote main.

FAQ

What does isolate create before coding starts?

isolate creates a git worktree branched from the latest origin/main after verifying freshness against the remote. The skill detects the parent branch via reflog, applies project setup, and keeps task work off the developer's current working branch.

How does isolate get the branch name?

isolate expects a branch name from /orient Step 1, such as feat/auth or fix/login-crash, and asks if none is provided. Developers can override the base ref when explicitly stacking work on a branch other than main.

When should agents invoke isolate?

isolate should run at task start when branch isolation is required before planning or coding. Parallel agent sessions benefit because each worktree stays independent and synced to current remote main.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.