agentleFS
insapption-projectsinsapption-projects/claude-agent-team-starter/.claude/skills/delete-branch/SKILL.md

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

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

    If not on main:

    line 34
  2. Very specific:

    Use -d (safe delete — only works if fully merged).

    line 59
  3. Distinctive:

    If remote branch still exists (should have been deleted in Step 12):

    line 77

≈ “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.

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

Skill: /delete-branch

Usage

/delete-branch

Prerequisites

  • Branch must be merged into main (Step 12 complete)
  • Reference files must be updated (Step 13 complete)
  • Currently on main branch

Steps

1. Verify Current State

git branch --show-current   # must be "main"
git log --oneline -3        # confirm merge commit is present

If not on main:

git checkout main
git pull origin main

2. 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 history

6. 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 ✅
──────────────────────────────────────────────────────────────

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.