From worktree-ops
Take a worktree from "work is done" to "merged, cleaned up, and back on main" — with as few manual steps as possible. Run it from inside the worktree.
How this skill is triggered — by the user, by Claude, or both
Slash command
/worktree-ops:merge-worktreeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Take a worktree from "work is done" to "merged, cleaned up, and back on main" — with as few manual steps as possible. Run it from inside the worktree.
Take a worktree from "work is done" to "merged, cleaned up, and back on main" — with as few manual steps as possible. Run it from inside the worktree.
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 pushes, merges, or deletes. Confirm when unclear:
--no-merge;--into), when not obvious;git rev-parse --abbrev-ref HEAD
git status --porcelain
Confirm this is the worktree/branch to finish, and whether to merge now or only open/update the PR and stop (--no-merge). The merge target is --into <branch> if given, else the PR's base (default main). Ask with AskUserQuestion if anything is unclear.
/commit-commands:commit-push-pr), defer to it for steps 2–3.git push -u origin HEAD.gh pr create --fill --base <into> (or draft a title/body from the commits and any seeding issue).gh pr view --json number,url,state,statusCheckRollup.--no-merge)Check readiness first if needed (gh pr view --json number,url,state,statusCheckRollup; if checks are still running, ask whether to wait). Then use the deterministic merge helper — it refuses to squash, sets the target base, merges (merge commit by default; --rebase for linear history), and confirms the PR actually reached MERGED, exiting non-zero otherwise:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/wt-merge.sh" [--into <branch>] [--rebase] [--keep-branch]
Act on the exit code:
/worktree-ops:pull-worktree --from <into> to integrate + resolve (it asks you about anything ambiguous), push, then retry.(--squash is also blocked by this skill's PreToolUse guard, so it can't slip in by hand either.)
Before removing the worktree, run the archive helper. It deterministically runs .claude/worktree-archive.sh if the project has one (tear down external resources: local DBs, Docker, caches) and is a no-op otherwise:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/wt-run-optin.sh" archive
Only run teardown if §4 confirmed the merge (wt-merge.sh exited 0), or the user is deliberately abandoning the worktree. Never tear down after a failed/blocked merge.
If this session created/entered the worktree via EnterWorktree, finish with the ExitWorktree tool: it removes the worktree + branch and switches the session back to the main checkout in one step.
MERGED from §4), pass action: "remove" with discard_changes: true. The merge happened on the remote, so the local branch can still look "unmerged" until you fetch — the guard would otherwise refuse, but the work is safely on the remote.action: "remove" without discard_changes; if it lists uncommitted/unmerged work, relay that and confirm before retrying with discard_changes: true. Never discard silently.--keep-branch or "I might come back" → action: "keep" (returns to main, leaves the worktree on disk).ExitWorktree only touches worktrees this session entered. Otherwise use the helper (it refuses on dirty/unpushed work unless --force); run it from the main checkout:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/wt-teardown.sh" "<path-or-slug>" --delete-branch # unmerged: guards apply
bash "${CLAUDE_PLUGIN_ROOT}/scripts/wt-teardown.sh" "<path-or-slug>" --force --delete-branch # after a confirmed merge
Summarize: commits pushed, PR URL + state, whether it merged into <into>, whether the teardown script ran, and that the worktree + branch were removed and the session is back on the main checkout (or why anything was kept).
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.