Git Worktree Cleanup

VerifiedSafe

Clean up a Git worktree by name, ticket ID, or partial match. Automatically closes associated iTerm tab, releases port assignments, removes the worktree directory, and deletes the branch. Use when you need to remove a worktree, optionally force-cleaning even with uncommitted changes.

Sby Skills Guide Bot
DevelopmentIntermediate
506/2/2026
Claude Code
#git#worktree#cleanup

Recommended for

Our review

Remove a Git worktree and clean up associated resources.

Strengths

  • Clean removal of worktree directory and branch
  • Closes associated iTerm tab and releases port assignment
  • Can force removal even with uncommitted changes

Limitations

  • Requires the specific MCP tool (cleanup_worktree)
  • Uncommitted changes are lost when forcing deletion
  • Only works with worktrees created via the same system
When to use it

Use this skill when you need to remove a Git worktree and automatically clean up associated resources.

When not to use it

Do not use this skill if you want to keep the branch or the worktree directory.

Security analysis

Safe
Quality score85/100

The skill calls a dedicated MCP tool for worktree cleanup, with no external shell execution, data exfiltration, or obfuscation. The force flag may discard uncommitted changes, but that is the intended functionality and the tool reports warnings.

No concerns found

Examples

Clean up worktree by ticket ID
Clean up worktree PROJ-123
Clean up worktree by name
Remove the worktree named auth
Force clean worktree
Force clean worktree PROJ-123 to discard uncommitted changes

name: wt-clean description: Remove a worktree and clean up resources. Use when asked to clean, remove, or delete a worktree. argument-hint: "<name> [force]" allowed-tools: mcp__worktree-maestro__cleanup_worktree

Use the cleanup_worktree MCP tool to remove a worktree.

Parse $ARGUMENTS to extract:

  • name (required) - Worktree name, ticket ID, or partial match
  • force (optional) - Set to true if "force", "true", "yes", "1", or "-f" is present

Examples

  • /wt-clean PROJ-123 → clean up worktree matching PROJ-123
  • /wt-clean auth → clean up worktree matching "auth"
  • /wt-clean PROJ-123 force → force clean even with uncommitted changes

Actions

The tool will:

  • Close associated iTerm tab
  • Release port assignment
  • Remove worktree directory
  • Delete the branch

Report

Report all actions taken and any warnings (e.g., uncommitted changes discarded).

Related skills