prune-branches
Skill2 starsChanged 4 months agoMITView on GitHub
Clean up stale git branches — local and remote — that are already merged or long abandoned, safely and with confirmation. Use when the user says "clean up branches", "delete merged branches", "prune stale branches", "remove old branches", "tidy up git branches", or "which branches can I delete".
- Commits and pushes
3 other projects use a version of this.
Adopted by
Most recently taken up by
- TitusKirch/skillstheir own version, first seen Oct 13, 2026
- wardawgmalvicious/agent-configtheir own version, first seen Oct 13, 2026
- ostin-pil/aboardtheir own version, first seen Aug 19, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- ostin-pil/aboard★ 2same name
- TitusKirch/skills★ 2same name
- wardawgmalvicious/agent-config★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository68 other files it gives its agents.
- a11ySkill
- api-docsSkill
- audit-logSkill
- benchmarkSkill
- bisectSkill
- cacheSkill
- changelogSkill
- cherry-pickSkill
- ci-setupSkill
- codeownersSkill
- commit-messageSkill
- connection-poolSkill
- contributingSkill
- coverageSkill
- db-migrateSkill
- dead-codeSkill
- debugSkill
- depsSkill
- diagramSkill
- dockerizeSkill
- docstringSkill
- e2eSkill
- env-exampleSkill
- error-handlingSkill
- explainSkill
- feature-flagSkill
- flaky-testSkill
- gitignoreSkill
- graceful-shutdownSkill
- graphqlSkill
- healthcheckSkill
- i18nSkill
- idempotencySkill
- licenseSkill
- lint-fixSkill
- loggingSkill
- migrateSkill
- mockSkill
- onboardSkill
- optimizeSkill
- paginationSkill
- pr-descriptionSkill
- pre-commitSkill
- profileSkill
- rate-limitSkill
- readmeSkill
- rebaseSkill
- refactorSkill
- regexSkill
- releaseSkill
- resolve-conflictsSkill
- retrySkill
- review-diffSkill
- scaffoldSkill
- secrets-scanSkill
- security-headersSkill
- seedSkill
- soft-deleteSkill
- sqlSkill
- squashSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Delete safely: Use git branch -d (merged-only, refuses unmerged) for the merged set — never -D unless the user explicitly confirms …
- Very specific: line 35
Prefer git branch -d (safe, merged-only).
- Distinctive: line 36
Always exclude the current branch, the default branch, and any release/protected branches from deletion.
- Very specific: line 37
Treat remote deletions (push --delete) as higher-stakes than local — they affect all collaborators.
“Common” is measured: kept by at least 6 in 10 of the 3 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.
Files
Branch landscape
!git branch --show-current 2>/dev/null
!git branch --merged "$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/@@' || echo main)" 2>/dev/null | head -40
!git for-each-ref --sort=committerdate refs/heads --format='%(refname:short) %(committerdate:relative)' 2>/dev/null | head -40
Instructions
Identify stale git branches and clean them up, measuring "merged" against the base in $ARGUMENTS (default the repo's default branch — main/master). This rewrites nobody's history but deletes refs, so report first and delete only with confirmation.
Method
- Run
git fetch --prunefirst so the remote-tracking refs are current — otherwise you'll judge branches against stale data and may flag already-deleted ones. - Categorize branches, never just by name:
- Merged —
git branch --merged <base>: their commits are all in the base, so deleting loses nothing. Safe. - Stale but unmerged — no commits in months and not merged: these may hold unmerged work. List separately and require explicit per-branch confirmation; show
git log <base>..<branch> --onelineso the user sees what's unique. - Gone remote — local branches whose upstream was deleted (
git branch -vvshows: gone]): usually safe once their work merged, but verify they're also merged.
- Merged —
- Never touch protected branches — the current branch, the default branch (
main/master), release/developbranches, or anything the user names as protected. Exclude them from every list. - Delete safely. Use
git branch -d(merged-only, refuses unmerged) for the merged set — never-Dunless the user explicitly confirms discarding unmerged work on a specific branch. For remote deletion,git push origin --delete <branch>only with explicit confirmation, since it affects everyone. - Local vs remote are separate decisions — confirm each. Deleting a local branch doesn't remove its remote, and vice versa.
Rules
- Report the full categorized list and get confirmation before deleting anything — this removes refs and can lose unmerged work.
- Prefer
git branch -d(safe, merged-only); use-Donly on a specific branch the user explicitly okays. The merged check is the safety net — don't bypass it. - Always exclude the current branch, the default branch, and any release/protected branches from deletion.
- Treat remote deletions (
push --delete) as higher-stakes than local — they affect all collaborators; confirm separately and never batch them silently. - Recovery exists but is finite — note that a mistakenly deleted branch's tip is recoverable via
git reflogfor a while, and capture SHAs in the summary. End with what was deleted (local/remote) and what was kept and why.
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
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.

