From scm-tools
Use when work is complete and PR is merged to clean up the worktree - fetches main, detaches HEAD, and deletes the working branch
How this skill is triggered — by the user, by Claude, or both
Slash command
/scm-tools:cleanup-worktreeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
After a PR is merged, clean up the worktree by fetching the latest main,
After a PR is merged, clean up the worktree by fetching the latest main, detaching HEAD at that commit, and deleting the local working branch.
git branch --show-current
Store the branch name. If already detached or on main, warn and stop.
git fetch origin main
git checkout --detach origin/main
git branch -d <branch-name>
If the branch has unmerged changes, git will refuse with -d. Ask user
if they want to force delete with -D.
Report: "Worktree cleaned up. HEAD detached at origin/main, branch <name> deleted."
If you catch yourself doing these, STOP:
-d first, ask before -D| Phase | Command | Purpose |
|---|---|---|
| 1. Identify | git branch --show-current | Get branch to delete |
| 2. Fetch | git fetch origin main | Get latest main |
| 3. Detach | git checkout --detach origin/main | Detach at main |
| 4. Delete | git branch -d <branch> | Remove working branch |
| 5. Confirm | Report status | Done |
npx claudepluginhub mjbellantoni/cc-marketplace --plugin scm-toolsGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.