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

Worktree Toolkit

  • Updated April 22, 2026
  • thomast8/claude-worktree-toolkit

worktree-toolkit creates git worktrees from PR numbers or branch names via a live picker, reclaims worktree branches back into main, and auto-copies gitignored dev files. It uses native EnterWorktree/ExitWorktree tools so the session's project directory follows the worktree. Developers use it to juggle parallel branches and PRs in isolated working trees.

Key points

  • Worktrees from PR/branch
  • Live picker
  • Reclaim branches into main
  • Auto-copy gitignored dev files

Worktree Toolkit by the numbers

  • Data as of Jul 7, 2026 (Skillselion catalog sync)
/plugin marketplace add thomast8/claude-worktree-toolkit
/plugin install worktree-toolkit@claude-worktree-toolkit

Add your badge

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

Listed on Skillselion
Last updatedApril 22, 2026
Repositorythomast8/claude-worktree-toolkit

What it does

Creates git worktrees from PR numbers or branch names with a live picker, reclaims worktree branches into main, and copies gitignored dev files.

README.md

worktree-toolkit

/worktree and /unworktree for Claude Code, with the hooks that make EnterWorktree actually move the session.

New here? Start with the user guide — it walks through six realistic scenarios with the exact commands you'd type.

Commands

/worktree [arg]

  • /worktree — interactive picker built from your open PRs + PRs needing your review (oldest review requests first, then your own branches stack-first).
  • /worktree 123 — resolve PR #123's head branch.
  • /worktree feature/my-branch — use that branch directly.

Asks once whether to open as a worktree (isolated path under <repo>/.claude/worktrees/) or switch checkout in the current tree. Worktree mode is the default when reviewing teammate PRs.

/unworktree [arg]

  • /unworktree — when run from inside a worktree, defaults to that one; otherwise offers a picker.
  • /unworktree 123 — pick by PR number.
  • /unworktree feature/foo — pick by branch.
  • /unworktree /absolute/path — pick by worktree path.

Stashes any work in the worktree, removes the worktree, checks out the branch in main, pops the stash. The backing branch always survives — this skill never runs git branch -D.

How it works

Each skill is a coordinator around bundled shell scripts in scripts/. The scripts own all the git / gh / gt logic and return JSON; the skill body parses the JSON and decides what to do next.

  • scripts/gather.sh — fetch, detect Graphite, resolve arg, build picker data
  • scripts/execute.sh — create worktree or switch checkout (fallback path)
  • scripts/post-enter.sh — run inside new worktree: pull, copy gitignored dev files
  • scripts/list.sh — enumerate worktrees with dirty/merged state
  • scripts/reclaim.sh — stash + remove worktree + checkout branch in main + pop stash

Hooks

Registered via hooks/hooks.json, loaded automatically when the plugin is enabled:

  • WorktreeCreatehooks/worktree-create.sh — enforces branch naming, reuses existing branches, cuts new branches from origin/<default>
  • WorktreeRemovehooks/worktree-remove.sh — info-only logger

Configuring copied dev files

execute.sh copies gitignored files matching a whitelist into the new worktree. Default globs: .env .env.local .env.*.local .envrc.

Per-repo override: create <repo>/.claude/worktree.conf with a single line:

WORKTREE_COPY_GLOBS=".env .env.local .env.test .envrc direnv/envrc"

Don't add node_modules, .venv, or similar — those break because they bake in absolute paths at install time.

Logs

~/.claude/logs/worktree-create.log — every hook invocation gets a timestamped line.

Related skills

This week in AI coding

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

unsubscribe anytime.