From worktree-ops
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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/worktree-ops:create-worktreeThe summary Claude sees in its skill listing — used to decide when to auto-load this 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.
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.
npx claudepluginhub zakattack9/agentic-coding --plugin worktree-opsCreates bite-sized, testable implementation plans from specs or requirements, with file structure and task decomposition. Activates before coding multi-step tasks.