wt-switch-create

Creates a worktrunk worktree and re-roots the session's working directory into it.

6.8k|240|Updated Oct 17, 2025
One-click install
npx skills add https://github.com/max-sixty/worktrunk --skill wt-switch-create
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wt-switch-create
Source: https://github.com/max-sixty/worktrunk/tree/main/plugins/worktrunk/skills/wt-switch-create
Command: npx skills add https://github.com/max-sixty/worktrunk --skill wt-switch-create

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Starting a task in an isolated git worktree normally requires manual branch naming, worktree creation, and directory switching, and doing it from an AI session involves harness-specific confirmation prompts and failure modes. This Skill automates the full create-and-enter flow for worktrunk worktrees, including cross-repo targets and recovery from common errors.

Core Features & Use Cases

  • One-call worktree creation and entry: Creates a new worktree via the wt CLI and re-roots the session into it, using EnterWorktree by name when possible to skip confirmation prompts.
  • Cross-repo support: Accepts an optional repo path argument to create the worktree in a different repository, with reachability checks and escalation guidance when the target is outside allowed directories.
  • Error-driven recovery: Handles existing-branch conflicts, already-in-worktree sessions, and denied confirmations with concrete fallback steps, and carries uncommitted work across via git stash.
  • Use Case: A developer asks the assistant to fix a parser bug in its own worktree; the Skill picks a branch name, runs wt switch --create, enters the worktree, and performs the task there, leaving cleanup to wt merge or wt remove.

Quick Start

Ask the assistant to create a new worktree for a branch and switch into it, for example by invoking /wt-switch-create my-feature -- fix the parser bug.

Frequently Asked Questions about wt-switch-create

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a git worktree and switch into it with worktrunk?

Run wt switch --create <branch> to create the worktree, or invoke this Skill with a branch name and optional task. The Skill calls EnterWorktree so the session's working directory is re-rooted into the new worktree automatically.

How do I create a worktree in a different repository?

Pass a repo path as the second argument, for example /wt-switch-create my-feature ~/workspace/other-repo. The Skill runs wt -C <repo> switch --create and enters the resulting path, provided the repo is inside an allowed directory.

What happens if the branch already exists when creating a worktree?

wt switch --create fails with 'Branch <branch> already exists'. If you named the branch, the Skill reruns without --create, which enters the existing branch and creates its worktree if missing; otherwise it picks a new name.

Why does entering a worktree fail with 'Shell cwd was reset'?

The target path is outside the session's configured working directories. Add the repo or a parent directory like ~/workspace to permissions.additionalDirectories, or run /add-dir <path>, then retry.

Does this Skill remove worktrees after the task finishes?

No. Worktrees persist and are managed with wt merge or wt remove like any other worktrunk worktree. An untouched worktree created via the name route is cleaned up automatically when the session ends.