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

Wt Switch Create

  • 877 installs
  • 6.3k repo stars
  • Updated August 5, 2026
  • max-sixty/worktrunk

wt-switch-create is an agent skill that creates a worktrunk git worktree and switches the active coding session into it for developers who need isolated branch directories for parallel fixes and feature builds.

About

wt-switch-create is a Worktrunk agent skill from max-sixty/worktrunk that wraps the wt CLI to create a new git worktree and immediately move the active Claude Code session into that directory. The command accepts an optional branch name, optional cross-repo path, and a -- task delimiter so agents can launch /wt-switch-create my-fix -- patch the parser or switch mid-session without nesting worktrees inside existing ones. Worktrunk computes sibling paths from configurable templates, applies project hooks on create, and keeps exploratory or risky changes out of the main checkout while another build keeps running elsewhere. Developers reach for wt-switch-create when hotfix branches, feature spikes, or parallel agent runs need separate directories with the same repo history. Cleanup stays outside this skill—merge or remove finished worktrees with wt merge and wt remove after the isolated task completes.

  • Create isolated git worktrees for parallel branches
  • Switch active worktree context without stashing
  • Keep long-running builds alive in separate directories
  • Reduce branch context-switching during agent sessions
  • Standardize repo sandbox setup across teammates

Wt Switch Create by the numbers

  • 877 all-time installs (skills.sh)
  • +147 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #79 of 733 Git & Pull Requests skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/max-sixty/worktrunk --skill wt-switch-create

Add your badge

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

Listed on Skillselion
Installs877
repo stars6.3k
Last updatedAugust 5, 2026
Repositorymax-sixty/worktrunk

How do you switch Claude Code into a new git worktree?

Create or switch git worktrees with worktrunk so you can run a hotfix branch in isolation while a feature build keeps compiling in another directory.

Who is it for?

Developers using Worktrunk and Claude Code who run parallel branches or agent tasks that must not share the same working directory as an active compile or feature build.

Skip if: Developers on Codex, OpenCode, or Gemini CLI without Claude Code session switching who should invoke wt switch --create directly from the terminal.

When should I use this skill?

The user wants to create a git worktree, switch an agent session into an isolated branch directory, or run /wt-switch-create with an optional repo path and task after --.

What you get

A new worktrunk worktree on a named branch with the agent session rooted in that directory and hooks applied from Worktrunk config.

  • isolated git worktree directory
  • switched agent session cwd
  • named feature or hotfix branch

By the numbers

  • Accepts up to 3 argument parts: branch name, optional repo path, and -- task text

Files

SKILL.mdMarkdownGitHub ↗

Arguments: $ARGUMENTS. Grammar: [<branch>] [<repo>] [-- <task>].

  • branch — optional; the branch name for the new worktree. When omitted,

pick one (step 1 below).

  • repo — optional path; create the worktree in this repo instead of the

session's current one.

  • task — optional; what to do inside the new worktree. No task means enter

the worktree and wait.

Tokens before the -- are the branch and/or repo: a path-shaped token (starting with /, ~, ./, or ../) is the repo; any other token is the branch (docs is a branch name, never the docs/ directory). More than one branch-shaped token before a -- doesn't fit the grammar — ask. Without a --, judge where the task starts: leading tokens that read as a branch name (fix-auth) or a repo path are consumed as such, and the rest is the task; otherwise the whole input is the task (fix the parser bug has no branch-shaped lead — all task).

/wt-switch-create my-feature -- fix the parser bug
/wt-switch-create -- fix the parser bug
/wt-switch-create my-feature ~/workspace/other-repo -- fix the parser bug
/wt-switch-create my-feature

What to do

Steps 1–3 come before any other work.

<!-- Maintainers: rationale.md (same directory) covers the harness rules and design choices behind this — read it before re-adding guards or routes. -->

1. Pick the branch name if none was given: short, from the task and consistent with existing worktree names, or, mid-session, from the work being moved; with nothing to derive from, ask.

2. Create the worktree with a Bash call (omit -C <repo> for this repo):

   wt -C <repo> switch --create <branch> --no-cd --format=json

Stdout is JSON whose path field is the worktree's absolute path (status lines go to stderr). On Branch <branch> already exists: if the user named the branch, rerun without --create (it enters the branch, creating its worktree if missing); if step 1 picked the name, pick another and rerun. Any other failure (not a git repo, invalid name): report it and stop.

Mid-session, carry uncommitted work across: git stash push -u before creating the worktree, then git -C <path> stash pop after (the stash is shared across worktrees).

3. Enter the worktree, then do the task. Call EnterWorktree({path: "<path from the JSON>"}).

  • Accepted → the session is re-rooted in the worktree. Do the task (or,

with no task text, confirm it's ready and wait).

  • Rejected → graceful, and nothing is created. Two cases land here: the

worktree is in another repo (EnterWorktree re-roots only within the repo your cwd is in), or this session is already rooted in a worktree (or is a pinned agent), which limits entry to that repo's .claude/worktrees/ and refuses even a same-repo wt sibling. Both reduce to the same test: whether you can cd into the worktree, which works when it's inside an allowed directory (a permissions.additionalDirectories entry such as ~/workspace). So cd <path> and read the result:

  • no Shell cwd was reset notice → it stuck; the worktree is reachable.

Work there, but a bare cd is not a tracked re-root, so the cwd can revert to the session's launch worktree across turns (and in spawned subagents); pin commands with git -C <path> / wt -C <path> rather than trusting the cd to persist.

  • Shell cwd was reset → not reachable. Stop and ask the user to make it

reachable: add the repo, or a parent like ~/workspace, to permissions.additionalDirectories (durable, every session), or run /add-dir <path> (this session). Then continue. Don't grind through absolute paths with cd resetting on every command.

Cleanup

The worktree is a normal worktrunk worktree: it persists after the session ends, shows up in wt list, and is merged or removed with wt merge / wt remove <branch> like any other. Don't remove it unprompted. If the user asks to leave mid-session, ExitWorktree({action: "keep"}) returns the session to its original directory; ExitWorktree cannot remove a worktree entered by path, so removal is always wt remove <branch>.

Scope

This command authorizes creating/entering ONE worktree (in the named repo, if one was given) and doing the requested task. Commits, pushes, and merges still each require explicit user permission.

Related skills

How it compares

Use wt-switch-create when the agent session itself must relocate into a fresh worktree; use plain wt switch for manual terminal branch changes without session re-rooting.

FAQ

What does wt-switch-create require installed?

wt-switch-create needs the Worktrunk wt CLI on PATH and the Claude Code WorktreeCreate hook configured so agent-created worktrees route through wt switch --create instead of plain git worktree add.

Can wt-switch-create target another repository?

wt-switch-create accepts an optional repo path as the second argument before a -- task delimiter. The skill creates the worktree in that repository and switches the session working directory according to Worktrunk cross-repo rules.

How is wt-switch-create different from wt merge or wt remove?

wt-switch-create only creates a worktree and enters it for active development. wt merge and wt remove are separate Worktrunk commands used afterward to integrate or delete finished worktrees with uncommitted-change safeguards.

Git & Pull Requestsgitdevopsintegrations

This week in AI coding

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

unsubscribe anytime.