cleanup-branches
Skill2 starsChanged 19 days agoApache-2.0View on GitHub
Delete merged and stale feature branches. Use when cleaning up after closed issues/MRs, or when you have many old local branches. Fetches, lists branches, identifies candidates, deletes with confirmation.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- amit-nayar/skillstheir own version, first seen Oct 11, 2026
- chrisselig/claude-code-toolkittheir own version, first seen Oct 9, 2026
- hmislk/hmistheir own version, first seen Oct 8, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- hmislk/hmis★ 244same name
- chrisselig/claude-code-toolkit★ 1same name
- amit-nayar/skills★ 0same 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 repository124 other files it gives its agents.
- add-projectSkill
- ansible-configure-vmSkill
- api-smoke-testSkill
- appinterface-checkSkill
- attach-session-to-jiraSkill
- aws-rds-debugSkill
- beerSkill
- bootstrap-all-knowledgeSkill
- bootstrap-knowledgeSkill
- build-persona-styleSkill
- cancel-pipelineSkill
- cert-checkSkill
- check-ci-healthSkill
- check-integration-testsSkill
- check-mr-feedbackSkill
- check-my-prsSkill
- check-secretsSkill
- ci-retrySkill
- cleanup-stale-executionsSkill
- clone-jira-issueSkill
- close-issueSkill
- close-mrSkill
- cloud-inventorySkill
- coffeeSkill
- compare-optionsSkill
- create-jira-issueSkill
- create-mrSkill
- create-slide-deckSkill
- data-migration-verifySkill
- debug-local-dbSkill
- debug-prodSkill
- deploy-to-ephemeralSkill
- dev-workflow-orchestratorSkill
- discovered-work-summarySkill
- edit-slide-deckSkill
- email-digestSkill
- environment-overviewSkill
- explain-codeSkill
- export-presentationSkill
- extend-ephemeralSkill
- find-similar-codeSkill
- gather-contextSkill
- gdrive-researchSkill
- gke-cluster-opsSkill
- hello-worldSkill
- hotfixSkill
- inscope-researchSkill
- investigate-alertSkill
- investigate-service-issuesSkill
- investigate-slack-alertSkill
- jira-hygiene-allSkill
- jira-hygieneSkill
- knowledge-refreshSkill
- konflux-statusSkill
- learn-architectureSkill
- learn-patternSkill
- list-presentationsSkill
- local-build-testSkill
- local-dev-environmentSkill
- manage-local-servicesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Delete merged/stale feature branches.
- Very specific: line 28
Use repo or cwd; verify .git exists
- Very specific: line 71
If dry run: skill_run("cleanup_branches", '{"dry_run": false}') to delete
- Distinctive: line 79
Only first 3 branches deleted per run
“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
Cleanup Branches
Delete merged/stale feature branches. Default: dry run (show only).
Inputs
| Input | Type | Default | Purpose |
repo | string | cwd | Repository path |
dry_run | bool | true | Show what would be deleted (safety) |
include_remote | bool | false | Also delete remote branches |
older_than_days | int | 30 | Stale threshold |
protected_branches | string | main,master,develop,release | Never delete |
Workflow
1. Load Persona
persona_load("developer")
2. Resolve Repository
- Use
repoor cwd; verify.gitexists - Parse protected list from
protected_branches
3. Fetch and List
git_fetch(repo, all=true, prune=true)git_branch_list(repo, all=false)— localgit_branch_list(repo, all=true)— all (for remote refs)
4. Identify Candidates
- Parse local branches, exclude current (
*) - Exclude protected (main, master, develop, release)
- Remote:
remotes/origin/*excluding protected - Result:
{candidates, candidate_count, remote_branches, current_branch}
5. Delete (if not dry_run)
git_branch_delete(repo, branch="{name}", force=false)— up to 3 per run for safety- Parse results: success vs error
6. Memory
- If deleted > 0:
memory_session_log("Cleaned up branches", "Deleted {count} in {repo}") - Learn pattern for branch_cleanups
7. Learn from Failures
- Permission denied:
learn_tool_fix("git_fetch", "permission denied", "SSH/creds", "ssh-add or check credentials")
MCP Tools
persona_loadgit_fetchgit_branch_listgit_branch_deletememory_session_loglearn_tool_fix
Output
- Repository, current branch, mode (Dry Run / Delete)
- Candidate branches list
- If dry run:
skill_run("cleanup_branches", '{"dry_run": false}')to delete - Deletion results (count, errors)
- Protected branches list
- Branch naming conventions, known issues
Safety
- dry_run=true by default
- Only first 3 branches deleted per run
- Protected branches never touched
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.

