Finishing a Development Branch
obra/superpowers
Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.
Delete all merged local branches and fast-forward development to origin.
$ npx skills add hmislk/hmis --skill cleanup-branches -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install hmislk/hmis cleanup-branches --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/hmislk/hmis.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/cleanup-branches .claude/skills/cleanup-branches && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "cleanup-branches" agent skill from https://github.com/hmislk/hmis/tree/development/.claude/skills/cleanup-branches into .claude/skills/cleanup-branches/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cleanup-branches", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/hmislk/hmis/tree/development/.claude/skills/cleanup-branchesType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add hmislk/hmis --skill cleanup-branches -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install hmislk/hmis cleanup-branches --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/hmislk/hmis.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.claude/skills/cleanup-branches .agents/skills/cleanup-branches && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "cleanup-branches" agent skill from https://github.com/hmislk/hmis/tree/development/.claude/skills/cleanup-branches into .agents/skills/cleanup-branches/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cleanup-branches", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add hmislk/hmis --skill cleanup-branches -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install hmislk/hmis cleanup-branches --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/hmislk/hmis.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.claude/skills/cleanup-branches .cursor/skills/cleanup-branches && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "cleanup-branches" agent skill from https://github.com/hmislk/hmis/tree/development/.claude/skills/cleanup-branches into .cursor/skills/cleanup-branches/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cleanup-branches", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/hmislk/hmis.git --path .claude/skills/cleanup-branches--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add hmislk/hmis --skill cleanup-branches -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install hmislk/hmis cleanup-branches --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/hmislk/hmis.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.claude/skills/cleanup-branches .gemini/skills/cleanup-branches && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "cleanup-branches" agent skill from https://github.com/hmislk/hmis/tree/development/.claude/skills/cleanup-branches into .gemini/skills/cleanup-branches/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cleanup-branches", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install hmislk/hmis cleanup-branchesInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add hmislk/hmis --skill cleanup-branches -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/hmislk/hmis.git skills-src && mkdir -p .github/skills && cp -r skills-src/.claude/skills/cleanup-branches .github/skills/cleanup-branches && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "cleanup-branches" agent skill from https://github.com/hmislk/hmis/tree/development/.claude/skills/cleanup-branches into .github/skills/cleanup-branches/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cleanup-branches", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add hmislk/hmis --skill cleanup-branches -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install hmislk/hmis cleanup-branches --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/hmislk/hmis.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.claude/skills/cleanup-branches .opencode/skills/cleanup-branches && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "cleanup-branches" agent skill from https://github.com/hmislk/hmis/tree/development/.claude/skills/cleanup-branches into .opencode/skills/cleanup-branches/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "cleanup-branches", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
cleanup-branchesDelete all merged local branches and fast-forward development to origin.
Cleanup Branches is an agent skill from hmislk/hmis. Delete all merged local branches and fast-forward development to origin. Handles both feature branches (merged to development) and hotfix branches (ending in -hotfix, merged to any production branch). Stashes and restores persistence.xml local JNDI settings automatically. Use after PRs are merged to clean up local git state in one command.
Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Development. It works with Git. The repository describes itself as: This is an Open Source Java EE based Hospital Information Management System. The licence is GPL-3.0.
8 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit d261e32. It shows what the files ask for, not the result of running them.
Pre-approves these tools, so the agent can use them without asking each time:
BashFrom allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
gitghFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use git and gh, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Cleanup Branches loads about 2.5k tokens when it runs. Until then it costs about 90 tokens; SKILL.md has 1,157 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check noted patterns worth knowing about, such as sudo or a known installer.
allowed-tools: BashAutomated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from hmislk/hmis at commit d261e32, republished under its GPL-3.0 licence (© hmislk). 1,157 words, ~2,525 tokens.
.claude/skills/cleanup-branches/SKILL.md (or your agent's skills folder).Delete every local branch whose PR has already been merged — plus any branch
with no PR of its own whose changes are all already represented on
origin/development (e.g. a gh pr checkout <N> review checkout) — then bring
development up to date. Leave persistence.xml with local JNDI names restored
(unstaged) at the end.
Only stash persistence.xml — not all uncommitted work. This prevents
unrelated WIP from being moved onto development when the stash is popped.
git stash push -- src/main/resources/META-INF/persistence.xmlIf this reports "No local changes to save", that is fine — continue. Note whether a stash was created so you know whether to pop it in Step 7.
git fetch origin --prune--prune removes remote-tracking refs for branches deleted on GitHub.
List every local branch except development:
git branch --format='%(refname:short)' | grep -v '^development$'For each branch, determine whether it is safe to delete.
Before the feature/hotfix split, skip any branch that is master or ends with
-prod (the local mirrors of admin-managed / production branches — see Notes
for the full list). They diverge from development by design, so a naïve
patch-equivalence check could still misfire on them; the explicit skip is the
guarantee. List them in the report under their own "Protected — not touched"
heading (they are expected, not a problem to flag).
-hotfix)The comparison base is origin/development. Look for a merged PR from this head:
gh pr list --head <branch> --base development --state merged --repo hmislk/hmis --json number,title,mergedAt --jq '.[0]'
# if that is empty, retry without --base — the PR's base may have been changed:
gh pr list --head <branch> --state merged --repo hmislk/hmis --json number,title,baseRefName,mergedAt --jq '.[0]'Record the PR number/title if found. If the second query returns a PR with a
baseRefName other than development, the comparison base is
origin/<that baseRefName>, not origin/development. Whether or not a PR is
found, continue to Vet the branch tip — a merged PR does not by itself
prove the local branch is safe to force-delete (it may carry post-merge
commits, or have been reused).
-hotfix)Hotfix PRs target a production branch. Look for a merged PR:
gh pr list --head <branch> --state merged --repo hmislk/hmis --json number,title,baseRefName,mergedAt --jq '.[0]'development; its commits legitimately are not
there.baseRefName, then
Vet the branch tip with the comparison base origin/<baseRefName>.Carry two facts forward for each branch: its PR reference — either
#<n> → <base-branch> (from the gh pr list step) or none (a no-PR review
checkout) — and its comparison base <base>: origin/development for a feature
branch or a no-PR checkout, origin/<baseRefName> for a feature PR whose base
was changed, origin/<prod> for a merged hotfix.
git merge-base --is-ancestor <branch> <base> && echo CONTAINED || echo AHEADCONTAINED — the branch tip is already reachable from <base>; it holds
nothing unmerged and no post-merge commits. Mark for deletion.
AHEAD — the tip is not reachable from <base>. Normal for a squash- or
rebase-merged PR, but also how a branch with genuine post-merge commits (or a
reused branch) looks. Decide with a final-tree guard: are <branch>'s
versions of the files it touched already identical to <base>?
mb=$(git merge-base <base> <branch>)
git diff --quiet <base> <branch> -- $(git diff --name-only "$mb" <branch>)This compares final content, not per-commit patches, so it is correct where
git cherry is not: a clean multi-commit squash-merge (no per-commit
equivalent) passes; a branch whose change was applied to <base> and later
reverted there fails; a merge commit that carried unique content in fails.
0 — every file the branch touched already matches <base>;
deleting the branch loses nothing (a clean squash/rebase merge, or a
fully-absorbed no-PR checkout such as pr-23617). Mark for deletion.1 — some file the branch touched differs from <base>: genuine
post-merge work, a reused branch, conflict-resolution content, or a
squash/rebase that did not land identical content. Skip and warn,
quoting the branch's real <base> and its PR reference (or noting it has
none): "ahead of <base> — if PR #<n> was squash/rebase-merged,
git branch -D <branch> manually; otherwise inspect for unmerged work
first".Empty touched-file list gotcha: if git diff --name-only "$mb" <branch>
is empty, the command above degrades to a full-tree git diff --quiet <base> <branch> (no pathspec) and will almost always exit 1 — not because
<branch> differs from <base>, but because <base> has since changed
unrelated files <branch> never touched. Don't trust that exit code in this
case. Instead compare tree hashes directly:
[ "$(git rev-parse <branch>^{tree})" = "$(git rev-parse "$mb"^{tree})" ] && echo IDENTICAL || echo DIVERGED<branch>'s tree is byte-identical to the merge-base (its
"ahead" commits are no-ops, e.g. an empty merge), and the merge-base is by
definition an ancestor of <base>. The branch holds zero unique content.
Mark for deletion.git checkout developmentStep 3's Vet the branch tip fully decided every marked branch — each is
either CONTAINED in its comparison base, or AHEAD but proven fully absorbed (the
final-tree guard found every file it touched already identical to <base>).
Branches with post-merge or unmerged work were skipped there. Step 5 only
deletes; it does not re-decide safety.
git branch -d <branch> || git branch -D <branch>git branch -d refuses when the tip is not reachable from local development
— normal here, because a squash/rebase merge leaves the tip off development
and local development is not fast-forwarded until Step 6. The || git branch -D completes the delete; Step 3 already established the branch is safe to drop.
git branch -D prints the deleted SHA (Deleted branch X (was 906d5ebbb4)) and
the reflog keeps it ~30 days, so a mistaken delete is still recoverable.
Do not re-check with git log origin/<branch>..<branch>: Step 2's
git fetch --prune has already removed the origin/<branch> upstream, so that
command errors with unknown revision or path not in the working tree instead
of returning empty.
Use --ff-only so git stops with an error if the local development has
diverged (e.g. local commits not yet pushed), rather than silently discarding
them:
git merge --ff-only origin/developmentIf this fails with "Not possible to fast-forward", the local development
has commits that are not on origin/development. Report this to the user and
stop — do not force-reset. The user must resolve the divergence manually.
If a stash was created in Step 1 (only persistence.xml was stashed):
git stash popIf the stash pop reveals conflicts (unlikely but possible), report them to the user and stop — do not resolve conflicts automatically.
If no stash was created, leave persistence.xml as-is.
Print a summary:
✓ Deleted branches:
- <branch> (PR #NNN merged → <base-branch>)
- <branch> (no PR; all changes already represented on <base-branch>)
...
⚠ Skipped branches:
- <branch> (PR #NNN merged → <base-branch>, but tip is ahead of it —
squash/rebase merge? `git branch -D` manually; else inspect for unmerged work)
- <branch> (no PR; tip has commit(s) not on <base-branch>)
- <branch> (hotfix, no merged PR found)
...
• Protected — not touched:
- master, <name>-prod
✓ development is now at <short-sha> (<commit subject>)
✓ persistence.xml restored to local JNDI settings (unstaged)Each vetted deleted / skipped line carries the branch's real PR reference (or
"no PR") and its real comparison base — never assume a PR exists or that the
base is development. The unvetted "hotfix, no merged PR found" line is the one
exception: it is skipped before any base is chosen, so it carries neither. Omit
any section with no entries. If nothing was stashed, replace the last line with:
✓ persistence.xml unchanged (no local changes were present)
development, master, or any *-prod branch.coop-prod, ruhunu-prod, southernlanka-prod, rmh-prod,
digasiri-prod, mp-prod, roseth-prod, horizon-prod,
asiripharmacy-prod, engagewellness-proddevelopment, up to date,
with only unmerged feature branches remaining locally.© hmislk, GPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .claude/skills/cleanup-branches of hmislk/hmis.
Open the folder on GitHubat commit d261e32
Cleanup Branches next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Cleanup Branches this skillhmislk/hmis | 236 | — | ~2.5k | Automated safety check: Notes | GPL-3.0 | |
| Finishing a Development Branchobra/superpowers | 297k | 5 repos | ~1.9k | Automated safety check: Pass | MIT | |
| Code Review ChecklistshareAI-lab/learn-claude-code | 78k | 5 repos | ~1.1k | Automated safety check: Pass | MIT | |
| Code Design Rationale Investigatorcursor/plugins | 10k | 9 repos | ~2.6k | Automated safety check: Pass | None | |
| Contributor-First PR MergeHKUDS/OpenHarness | 16k | 1 repos | ~847 | Automated safety check: Pass | MIT | |
| Finishing A Development Branchfarm-fe/farm | 5.6k | 34 repos | ~1.8k | Automated safety check: Pass | MIT |
obra/superpowers
Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.
shareAI-lab/learn-claude-code
Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.
cursor/plugins
Digs into why code is shaped the way it is by checking git history, pull requests and connected tools in parallel, then reporting a cited read on the tradeoffs.
HKUDS/OpenHarness
Merges external GitHub pull requests while keeping the original author credited, and fixes conflicts after the merge instead of rewriting the contribution.
farm-fe/farm
A skill your agent uses when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for…
TryGhost/Ghost
Moves a package from another TryGhost repository into Ghost as an internal workspace package while keeping its Git history, with checkpoints for the steps that need an administrator.
hmislk/hmis
Reference for calling existing HMIS REST APIs. An agent skill from hmislk/hmis.
hmislk/hmis
Application configuration options reference for the HMIS project.
hmislk/hmis
Ultra-compressed communication mode. An agent skill from hmislk/hmis.
hmislk/hmis
MySQL database development guide for the HMIS project. An agent skill from hmislk/hmis.
hmislk/hmis
A skill your agent uses when asked to make a demo, training, how-to or tutorial video with sound or voice-over showing an HMIS function or configuration (e.g.
hmislk/hmis
Sync development into QA/testing environment branches (QA1-QA4, local RH staging) via PR + merge on GitHub.
Works with
Categories
Delete all merged local branches and fast-forward development to origin. Cleanup Branches is an agent skill from hmislk/hmis. Delete all merged local branches and fast-forward development to origin.
Cleanup Branches fits situations like: development work in your project.
Run `npx skills add hmislk/hmis --skill cleanup-branches -a claude-code`. Or copy the skill folder (.claude/skills/cleanup-branches in hmislk/hmis) into .claude/skills/cleanup-branches in your project. Claude Code loads it when a task matches its description.
Run `npx skills add hmislk/hmis --skill cleanup-branches -a codex`. Or copy the skill folder (.claude/skills/cleanup-branches in hmislk/hmis) into .agents/skills/cleanup-branches in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add hmislk/hmis --skill cleanup-branches -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cleanup-branches, .gemini/skills/cleanup-branches, .github/skills/cleanup-branches and .opencode/skills/cleanup-branches in your project.
Going by SKILL.md and its folder, Cleanup Branches needs the command-line tools its instructions call (git and gh). Its frontmatter pre-approves these tools: Bash.
SKILL.md contains no URLs. Its commands use git and gh, which can reach the network depending on how they are called. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.
Cleanup Branches is published under the GPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.5k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Cleanup Branches: Finishing a Development Branch (obra/superpowers, 297k stars), Code Review Checklist (shareAI-lab/learn-claude-code, 78k stars), Code Design Rationale Investigator (cursor/plugins, 10k stars) and Contributor-First PR Merge (HKUDS/OpenHarness, 16k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
hmislk (a GitHub organization) maintains it in hmislk/hmis, which has 236 GitHub stars. The repository holds 33 skills in this directory. The repository was last updated on October 9, 2026.
Source: hmislk/hmis on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.