agentleFS
perberperber/leafwiki/.claude/skills/worktree-cleanup/SKILL.md

worktree-cleanup

Skill1.2k starsChanged 17 days agoMITView on GitHub

List this repository's git worktrees with their branch state (merged, PR open, uncommitted changes, age) and remove the ones that are done — only after the person confirms. Use after a PR is merged, or when the person says "clean up the worktrees".

10 other projects use a version of this.

Trending

Less talk lately.thin dataabout the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 2 mentionsJul 2026: 1 mentionAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 2 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the perber/leafwiki repository that our weekly crawl found: only 5 in all, so this is a hint, not a trend. There is no adoption data for this file yet.

Most recently taken up by

Used with

Projects with it also use handoff.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MicrosoftSkill

    handoff

    Compact the current conversation into a handoff document for another agent to pick up.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never use --force on a worktree with uncommitted changes unless the person explicitly asked for that specific one.

    line 43

“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Worktree cleanup

Agent work creates one worktree per branch; they pile up. Never delete anything without showing the list and getting an explicit OK.

1. Collect

git fetch -q --prune origin
git worktree list --porcelain

For every worktree except the main checkout, determine:

  • branch (or detached HEAD) and last commit date (git -C <path> log -1 --format=%cr),
  • uncommitted changes: git -C <path> status --porcelain (count tracked + untracked),
  • merged: git branch --merged origin/main contains the branch, or gh pr list --state merged --head <branch> finds a merged PR (squash merges don't show up as merged in git),
  • open PR: gh pr list --state open --head <branch>,
  • prunable: marked prunable by git (directory already gone).

2. Propose

Show a table grouped as:

  1. Safe to remove — merged (or PR merged), no uncommitted changes.
  2. Probably done — no open PR, last commit older than 30 days, no uncommitted changes.
  3. Keep — open PR, uncommitted changes, or recent work. List why.

3. Remove (after OK, per group or per entry)

git worktree remove <path>          # refuses if there are uncommitted changes — good
git branch -d <branch>              # only for merged branches; -D only if the person says so
git worktree prune

Never use --force on a worktree with uncommitted changes unless the person explicitly asked for that specific one. Report what was removed and what was kept.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.