agentleFS
luisgui1757luisgui1757/sentinel/skills/cleanup/SKILL.md

cleanup

Skill0 starsChanged 9 days agoMITView on GitHub

Finds the worktrees, local branches, remote branches and pull requests that past work left in a repository, removes the ones that are safe to remove, and reports the others. Use when the user asks to clean up, tidy or prune branches, worktrees or PRs, or says that a repository has too many of them.

  • Commits and pushes

71 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use chips, react-query-best-practices and 10 more.

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.
  • udecodeSkill

    chips

    Run the project's suggested-task ledger, the chips. /chips alone brings this session's open tasks up to date: it applies what the ledger helper says, settles stale and split tasks, cards what can start and reports the board, and /chips all also takes the ship-list tasks and the ones no live session owns, and merges duplicate tasks across the board. Use for /chips, /chips offer, start or drop, \"what chips are open\", \"suggest a task for X\", \"update the chips\", \"clean up the chips\", \"which chips are stale\", \"is this chip still worth doing\", \"merge duplicate chips\", at the last hand-back of a run that offered a task, and whenever pstack would file a tracked issue, a follow-up, a reflect Backlog item or an out-of-band PR.

    Also in 3 projects that use this

  • bibektimilsina00Skill

    react-query-best-practices

    Audit and fix React Query usage in apps/web — enforce query key factories, signal forwarding, staleTime, and proper mutation patterns. Use when reviewing or fixing server-state code.

    Also in 3 projects that use this

  • bibektimilsina00Skill

    you-might-not-need-a-callback

    Analyze and fix useCallback anti-patterns in your code

    Also in 3 projects that use this

  • Scylla23Skill

    redo

    Re-run the last routed task one model tier up (haiku → sonnet → opus → fable). User-invoked escalation when the previous result missed. Pass --dry-run to preview without running.

    Also in 3 projects that use this

  • Aetheria-Labs1Skill

    plan-page

    Plan one storefront page from strategy through final copy, section order, proof, offers, template direction, responsive layout, and production asset requirements. Stops at an approved execution-ready specification.

    Also in 3 projects that use this

  • SocialKit-APISkill

    video-transcripts

    Extract transcripts from social videos through SocialKit across YouTube, TikTok, Instagram, Facebook, X/Twitter, LinkedIn, and direct video file URLs. Use when the user asks to transcribe, get captions or subtitles, pull the spoken text, or read what a video says, including one video or many at once. Returns full text plus timestamped segments. Not for posting, private accounts, or unrelated website scraping.

    Also in 3 projects that use this

  • +3 more from bibektimilsina00

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 61 edited versions we read keep these.

  • 3

    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. Distinctive:

    Remove what past work left in a repository.

    line 8
  2. Distinctive:

    Never remove the default branch, the current branch, the main worktree or the worktree that you run in.

    line 40
  3. Very specific:

    If delete_branch_on_merge is false, tell the user.

    line 54
  4. Distinctive:

    Run it only when the user asks, because it changes a repository setting.

    line 56

“Common” is measured: kept by at least 6 in 10 of the 61 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

Cleanup

Remove what past work left in a repository. Remove only the items that are safe to remove. Report each other item with the reason that you kept it. This skill is the permission to delete the safe items.

1. Collect

Change nothing in this step. Run:

  • git worktree list --porcelain
  • git branch --format='%(refname:short) %(objectname:short) %(upstream:short) %(upstream:track)'
  • git ls-remote --heads origin
  • gh pr list --state all --limit 300 --json number,state,author,headRefName,updatedAt,url
  • gh api repos/{owner}/{repo} --jq .delete_branch_on_merge
  • git stash list

The two gh commands are for GitHub. On another forge, use its CLI or API for the same step. Find the forge from the PR URL, the remote URL, the CI files and the signed-in CLIs. Collect the same fields.

A squash merge does not make the branch an ancestor of the default branch. So use the state of the PR to find merged work, not only git branch --merged.

2. Classify

ItemSafe to remove whenKeep and report when
WorktreeIts branch has a merged or closed PR, or the default branch contains it, and git status --porcelain in it prints nothing.git status --porcelain in it prints a line, which includes untracked files, or it has an open PR, or a session uses it now.
Local branchIts PR merged or closed, or the default branch contains it, and each of its commits is on the remote.It has commits that are on no remote.
Remote branchIts PR merged, or its PR closed and you are the author.It has an open PR or no PR, or another person closed it.
Pull requestNever in this skill.It had no update for 30 days, or a newer PR replaces it.
StashNever in this skill.Always. Other worktrees share the stash list.

Never remove the default branch, the current branch, the main worktree or the worktree that you run in. Take each path from git worktree list. Do not type a path by hand.

3. Remove the safe items

  • Worktree: git worktree remove <path>, then git worktree prune. Do not use --force.
  • Local branch: record its SHA, then run git branch -D <name>.
  • Remote branch: git push origin --delete <name>.
  • Stale tracking refs: git fetch --prune origin.

4. Find the cause

If delete_branch_on_merge is false, tell the user. Give this command to turn it on: gh api -X PATCH repos/{owner}/{repo} -f delete_branch_on_merge=true. Run it only when the user asks, because it changes a repository setting. On another forge, find the same setting. If the forge has no such setting, skip this step.

Report

  • Each item that you removed. For each local branch, give its SHA, so that git branch <name> <sha> can restore it.
  • Each item that you kept, with its reason.
  • Each stash, with its message.
  • Each open PR that is stale or replaced, with its link and your recommendation.
  • On GitHub, a remote branch of a merged or closed PR can come back from the PR page.

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.