delete-branch
Skill1 starsChanged 8 months agoMITView on GitHub
Cleans up the local feature branch after a successful merge. Verifies the remote branch is already deleted and confirms the repo is in a clean state on main. Step 14 of the dev-workflow.
- Commits and pushes
In this repository12 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- create-prSkill
- dev-workflowSkill
- fix-planSkill
- implement-fixSkill
- implement-planSkill
- init-referencesSkill
- merge-mainSkill
- plan-featureSkill
- read-referencesSkill
- test-lintSkill
- update-referencesSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
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
- Distinctive: line 34
If not on main:
- Very specific: line 59
Use -d (safe delete — only works if fully merged).
- Distinctive: line 77
If remote branch still exists (should have been deleted in Step 12):
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: /delete-branch
Usage
/delete-branchPrerequisites
- Branch must be merged into main (Step 12 complete)
- Reference files must be updated (Step 13 complete)
- Currently on
mainbranch
Steps
1. Verify Current State
git branch --show-current # must be "main"
git log --oneline -3 # confirm merge commit is presentIf not on main:
git checkout main
git pull origin main2. Identify Branch to Delete
git branch --list "feature/*" "fix/*" "refactor/*" "chore/*"Show the branch(es) from this workflow session. Confirm with lead if more than one stale branch exists.
3. Delete Local Branch
git branch -d {branch_name}Use -d (safe delete — only works if fully merged). If -d fails,
it means the branch is NOT merged — stop and investigate:
🚧 STOP: git branch -d reports the branch is not fully merged.
Branch : {branch_name}
This should not happen. Verify merge was completed in Step 12.
DO NOT force-delete (-D) without lead approval.4. Verify Remote Branch
git ls-remote --heads origin {branch_name}If remote branch still exists (should have been deleted in Step 12):
git push origin --delete {branch_name}Confirm:
✅ Remote branch {branch_name} deleted.5. Final State Check
git status # clean, on main
git branch # only main (and other long-lived branches) remain
git log --oneline -5 # confirm merge commit is in history6. Confirm
──────────────────────────────────────────────────────────────
BRANCH DELETED ✅
──────────────────────────────────────────────────────────────
Local branch : {branch_name} — deleted
Remote branch : {branch_name} — deleted
Current state : main ({commit_hash}) — clean
Next step: Step 15 — Workflow Complete ✅
──────────────────────────────────────────────────────────────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.

