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
6/2/2026
Claude Code
#git#worktree#cleanup

Recommended for

Automated summary

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

How this analysis is made

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).

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/git-worktree-cleanup-mmbizjc0/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/git-worktree-cleanup-mmbizjc0' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/git-worktree-cleanup-mmbizjc0/download' --output '.skill-downloads/git-worktree-cleanup-mmbizjc0/SKILL.md.part' && mv '.skill-downloads/git-worktree-cleanup-mmbizjc0/SKILL.md.part' '.skill-downloads/git-worktree-cleanup-mmbizjc0/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): mcp__worktree-maestro__cleanup_worktree

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/git-worktree-cleanup-mmbizjc0/SKILL.md' && test -s '.skill-downloads/git-worktree-cleanup-mmbizjc0/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/wt-clean' && cp -R '.skill-downloads/git-worktree-cleanup-mmbizjc0' '.claude/skills/wt-clean'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/git-worktree-cleanup-mmbizjc0'

openskills read 'git-worktree-cleanup-mmbizjc0'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/git-worktree-cleanup-mmbizjc0/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills