/worktree-ops:create-worktree [task description | #issue | #PR | branch-name] [--base <ref>]from worktree-ops
Create an isolated git worktree for a new task and switch this session straight into it — no restart, no manual cd. Branches fresh from the latest origin base, copies gitignored env files (.worktreeinclude), runs an optional per-project setup script, and can seed from a GitHub issue or PR. Use when the user wants to "create/start/spin up a worktree", "work on this in a separate branch/checkout", kick off isolated/parallel work for a feature or bugfix, or start a task from an issue or PR without disturbing the current checkout.
Ships in worktree-ops. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Create a worktree and flip this session into it in one step, using Claude Code's native worktree support so you also get .worktreeinclude copying, worktree.baseRef, and native cleanup for free.
At any step, if a required input is missing or the safe path is ambiguous, stop and use AskUserQuestion before acting — don't assume a default that changes what gets created. Confirm when unclear:
Derive a short, meaningful kebab-case slug from what the user is building (e.g. fix-login-redirect, add-csv-export). Never use generic names like worktree-1. Resolve the source:
#123 / issue URL) → gh issue view <n> --json number,title, then slug = issue-<n>-<short-title-slug>. Remember the issue to reference in the PR later.#123 / PR URL) → this is the existing-worktree path (see 2b).--base <ref> → only meaningful via the fallback in 2c; native creation uses the worktree.baseRef setting.If it's ambiguous (new vs. existing branch, which base), ask with AskUserQuestion first.
Call the EnterWorktree tool with name: <slug>. Native Claude Code then, in one atomic step: creates the worktree under .claude/worktrees/<slug>/, branches per the worktree.baseRef setting (default: fresh from origin/<default>), copies .worktreeinclude files, fires any WorktreeCreate hook, and switches this session's working directory into the worktree. The branch is typically named worktree-<slug>.
EnterWorktreewithnameis rejected if the session is already inside a worktree. If so, eitherExitWorktree(actionkeep) back to the main checkout first, or create the new branch withgit worktree addand enter it viapath(2b).
git fetch origin
git worktree add ".claude/worktrees/pr-<n>" -b "<headRefName>" --track "origin/<headRefName>"
Then call EnterWorktree with path: .claude/worktrees/pr-<n> to flip in. (Cross-fork PRs may need the fork added as a remote first — say so if the fetch fails.)
EnterWorktree is unavailable (e.g. -p/non-interactive)bash "${CLAUDE_PLUGIN_ROOT}/scripts/wt-create.sh" "<slug>" [base-ref]
It prints the worktree path on its last stdout line. The session can't auto-flip here — tell the user to cd <path> or run claude --worktree <slug>.
Native creation does not touch .gitignore, so the new .claude/worktrees/ tree would otherwise surface as untracked files in the main checkout. Once the worktree exists (2a/2b), run the idempotent helper:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/wt-ensure-gitignore.sh"
It targets the main checkout's .gitignore even when run from inside the worktree, creates it if the repo has none, and is a no-op if the rule is already present. (The 2c fallback already does this internally — re-running is harmless.)
Once inside the worktree, run the setup helper. It deterministically runs .claude/worktree-setup.sh if the project has one (install deps, init a local DB, etc.) and is a safe no-op otherwise — so this step always behaves the same:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/wt-run-optin.sh" setup
Don't hand-run an install instead. (Setup is scoped to user-initiated creation on purpose — it deliberately does not run for every subagent-isolation worktree.)
Confirm: you're now working in the worktree, the branch, the base it was cut from, env files copied, and whether setup ran. When done, /worktree-ops:merge-worktree ships it and cleans up.
What SKILL.md sets; muted values are Claude Code's defaults
sonnethighnpx claudepluginhub zakattack9/agentic-coding --plugin worktree-ops4 skills in this plugin
/list-worktreesShow a dashboard of every git worktree in this repo — branch, commits ahead/behind the base branch, uncommitted (dirty) file count, and open-PR status — with the current session's worktree marked, so all parallel sessions are visible at a glance. Use when the user asks to "list worktrees", "worktree status", "what worktrees do I have", "show my parallel sessions", "which branches am I working on", or wants an overview of in-flight worktree work before pulling, switching, or merging./merge-worktreeFinish a worktree — commit any remaining work, push, open or update its pull request, optionally merge into a target branch once checks are green, run an optional teardown script, then remove the worktree and switch this session back to the main checkout. Use when the user says a task is "done", wants to "finish", "wrap up", "ship", "merge", "merge and clean up", or "tear down" a worktree, or to close out parallel work and reclaim the checkout. The merge target is configurable; pairs with create-worktree./pull-worktreePull the latest changes from a base branch into the current worktree — fetch, then rebase (or merge) this worktree's branch onto the newest origin/main (or any branch you name), guiding conflict resolution. Use when the user says a worktree/branch is "behind", wants to "pull in the latest", "catch up", "update", "sync", or "rebase onto main/develop" a worktree before continuing or opening a PR. The base to pull from is configurable, unlike anything native.