- Home
- Skills
- Productivity
- worktree-tidy
Worktree Tidy
Find finished git worktrees by checking their PR state, then remove them safely: dry run first, never --force.
$3
Works with the AI Agents you already use
worktree-tidy
Example session with this skill installed
Clean up my worktrees.
- Read your context and instructions
- Compiled the worktree-tidy
Dry run for my-app: 7 would go (3 GB freed), 1 missing folder to prune, 2 kept. Kept: feature-x has 4 uncommitted files; spike-y has no PR and 2 commits on no remote, last touched 3 months ago. Say go to remove the 7 and prune the missing one.
Connects securely to your tools. The creator never sees your data.
About this skill
Agents and parallel work leave piles of git worktrees behind. This skill works out which ones are finished and removes only those.
How it decides
A worktree is safe to remove when it has no uncommitted or untracked files and its HEAD is saved elsewhere:
- in its PR, in any state. This works with squash merges and deleted remote branches, because it compares against the PR's own head commit.
- or, with no PR, on a remote branch.
Anything else is kept: uncommitted files, commits that exist nowhere else, or a detached HEAD.
How it runs
- A dry run lists every worktree with its action (
remove,keepormissing), PR state, uncommitted file count, extra commits, branch and path. - You get a short summary: how many would go, the space freed, and
keeprows that look stale. - Only after you say go does it run
--apply.
It never uses --force, rm -rf or git branch -D. Local branches are left alone, so nothing committed is lost. It also cleans up Claude Code agent worktrees under .claude/worktrees/, which aren't removed automatically when the agent changed something.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Productivity.
Removes worktrees only, never branches. Needs GitHub for PR state. A branch reused for several PRs is judged against its latest PR.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed today
- Software
GitGitHub CLI (gh), signed inBash
The repo's origin must be on GitHub, because PR state comes from gh. Without a PR, a worktree is only removed when its HEAD is on a remote branch.
Permissions
Allowed Hosts
File Scopes
Runs git fetch --prune on origin. Never force-removes and never deletes branches.