How this command is triggered — by the user, by Claude, or both
Slash command
/dots-dev:worktree-deleteThis command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
# Delete Git Worktrees
Deletes specified worktrees, closes associated iTerm tabs, and cleans up branches.
**Usage:** `/dots-dev:worktree-delete <name1> [name2] [...]`
## Context
- Existing worktrees: !`git worktree list`
- Registry: !`cat ~/.claude/worktree-registry.json 2>/dev/null || echo "{}"`
## Your task
Delete the worktree(s) specified in the user's command arguments.
**If no names provided**, show available worktrees and usage info instead.
**For each worktree name provided:**
1. **Find the worktree path**: Look for it in `git worktree list` output.
2. **Get the branch name...Deletes specified worktrees, closes associated iTerm tabs, and cleans up branches.
Usage: /dots-dev:worktree-delete <name1> [name2] [...]
git worktree listcat ~/.claude/worktree-registry.json 2>/dev/null || echo "{}"Delete the worktree(s) specified in the user's command arguments.
If no names provided, show available worktrees and usage info instead.
For each worktree name provided:
Find the worktree path: Look for it in git worktree list output.
Get the branch name: Extract from the worktree list or use git -C <path> branch --show-current.
Close iTerm tab if registered: Check registry for a tab_id, then close it (may fail if already closed):
osascript -e 'tell application "Terminal" to close (first tab of first window whose id is <tab_id>)' 2>/dev/null
Remove the git worktree: git worktree remove <path> --force
Delete the branch: git branch -D <branch-name>
Remove from registry:
jq --arg path "<worktree-path>" 'del(.[$path])' ~/.claude/worktree-registry.json > ~/.claude/worktree-registry.json.tmp && mv ~/.claude/worktree-registry.json.tmp ~/.claude/worktree-registry.json
Show remaining worktrees: Display git worktree list.
npx claudepluginhub objectiveous/dots-claude-plugins --plugin dots-dev/clean-worktreesSafely removes specified git worktrees using `git worktree remove` without --force, relying on git's safety checks for clean state and pushed commits.
/worktree-cleanCleans finished git worktrees by removing directories for safe (merged, no uncommitted changes) ones, pruning references, and reporting removed/kept items.
/deleteSafely deletes a Git worktree by name, checks for uncommitted changes with user confirmation, removes it, and optionally deletes the branch.
/cleanupKills tmux session for a completed worktree task and optionally removes the git worktree directory. Lists remaining worktrees and shows next steps like merging or PR creation.
/remove-worktreeInteractively lists issue git worktrees, lets user select one, checks uncommitted changes and GitHub issue status, then removes it.
/cleanup-worktreesRemoves safe git worktrees for merged branches only (checked via git branch --merged and gh PRs), cleans orphans, categorizes kept ones, and generates a cleanup report.