Skip to content
Skills Library
Programming · Automation

git-cleanup

/git-cleanup

Use when the user explicitly invokes branch or worktree cleanup for a repo with accumulated local branches. Don''t use for remote branch deletion or force-push operations.

Licence
Apache-2.0
Last repository change
10.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 10.11.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Use when the user explicitly invokes branch or worktree cleanup for a repo with accumulated local branches. Don''t use for remote branch deletion or force-push operations.

Original author description

Use when the user explicitly invokes branch or worktree cleanup for a repo with accumulated local branches. Don''t use for remote branch deletion or force-push operations.

How it works

  1. Enumerate everything before judging anything
  2. Confirm each command exactly, then run what was confirmed
  3. Refusals and recovery
  4. What you hand back
Original SKILL.md headings · 36 lines, 553 words
SKILL.md preview
---
name: git-cleanup
description: 'Use when the user explicitly invokes branch or worktree cleanup for a repo with accumulated local branches. Don''t use for remote branch deletion or force-push operations.'
disable-model-invocation: true
---

# Clear out dead local branches and worktrees

This skill inventories every local branch and worktree, sorts them by merge evidence, and deletes only what the human confirms command by command. All writes stay local: confirmed branch and clean-worktree deletions only. Rollback is `git reflog` and remote refs. Remote state is never mutated, and force-push operations are out of scope.

The run is complete when every branch is categorized or surfaced as unanalyzed, every recommended deletion carries its evidence, each exact quoted command has final confirmation, and each command is reported as deleted or failed.

## Enumerate everything before judging anything

Run `git branch -vv` and `git worktree list` to list every local branch and worktree. Record the current branch, the default upstream branch, and every branch the repository own configuration marks protected. Those stay excluded from deletion from the start.

For each branch, determine merge status against its upstream and against the current branch: run `git branch --merged` and `git branch --no-merged`, then `git log <branch> --not <upstream> --oneline` to surface unmerged commits. Categorize each branch as `merged`, `unmerged-with-evidence`, or `unanalyzed` when the upstream is missing or the comparison is ambiguous.

For each worktree, run `git -C <path> status --porcelain` and classify it `clean` or `dirty`. Dirty worktrees are refused for deletion.

Attach the evidence to every recommended deletion: the merge commit SHA, the empty `git log` output proving no unique commits, or the worktree clean status. Branches categorized `unanalyzed` get surfaced with their reason and are never recommended.

## Confirm each command exactly, then run what was confirmed

Present the full categorized list first. For each recommended deletion show the exact quoted command the user must confirm (for example `git branch -d <name>` or `git worktree remove <path>`). Nothing executes at this stage.

Wait for explicit human confirmation of each exact quoted command. Confirmation is never batched, abbreviated, or inferred. Then execute only the confirmed commands, one at a time in the confirmed order. After each command record success (`deleted`) or failure with the exact git error message.

## Refusals and recovery

- Dirty worktree: refuse deletion, report the uncommitted changes, and stop. The user commits, stashes, or discards before retrying.
- Protected branch (the current branch, the default upstream, or any branch the repository marks protected): refuse deletion, name the branch, and stop.
- Unanalyzed branch: surface it with its reason (missing upstream, ambiguous merge comparison) and never delete it. Deletion waits on the user resolving the ambiguity and re-invoking.
- Missing confirmation: stop before execution. Partial results are the categorized analysis only. No branch or worktree is removed without per-command confirmation.
- Command failure: record the exact git error, leave all other confirmed commands pending, and report the failure. Retries are never automatic and scope never widens.
- Accidental deletion recovers through `git reflog` and `git branch <name> <sha>` for branches, or re-adding a worktree with `git worktree add`. State that recovery path when reporting any deletion.

## What you hand back

A categorized report of every local branch (`merged`, `unmerged-with-evidence`, `unanalyzed`, or `protected`) and every worktree (`clean`, `dirty`, or `protected`), each recommended deletion with its evidence and exact quoted command, the set of confirmed commands, and a per-command result of `deleted` or `failed` with the git error message. Branches or worktrees never confirmed stay listed as not deleted.
Files in this package (2)
  • SKILL.md 4 KB
  • agents/openai.yaml 1 KB

Versions

RepositoryScoreLicence
This page · gosuda/dalcom-skills100Apache-2.0
Richicinschi/studio-os100MIT
motlin/claude-code-plugins100Apache-2.0
mostafa-drz/claude-skills100MIT
OutlineDriven/outline-driven-development100Apache-2.0
alibaba/page-agent100MIT
redhatproductsecurity/prodsec-skills100Apache-2.0
viknesh20-20/claude-code-tool-kit100MIT
shafthq/shaft_engine90MIT

Database snapshot: 13.11.2026 · package version 917ae506d038 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100cleanup-branches
    Prune local branches whose work is already merged into the base. TRIGGER when the user says "clean up branches", "delete merged branches", "prune local branches", "remove old branches", "I have too many branches", "what branches can I delete", "/nyann:cleanup-branches". Do NOT…
  • 80dev10x:git-branch-prune
    Classify and prune stale local branches with merge verification, designed for rebase-merge repos where `git branch --merged` misses most merged branches. TRIGGER when: local repo has accumulated stale branches after fanout sessions, worktree cleanup, or manual sweeps. DO NOT…
  • 100branch-cleanup
    Clean up merged and stale branches from local and remote repositories. Use when branch list is cluttered or after merging PRs.
  • 100git-branch-cleanup
    Delete local git branches whose remote tracking branch is gone or whose changes are already merged into the base branch. Use when the user asks to clean up branches, prune branches, delete stale branches, or /git-branch-cleanup. Also trigger on "tidy git branches", "remove old…
  • 100branch-cleanup
    Prune stale git branches after a merge wave: delete closed/merged remote branches, remove local tracking branches that no longer exist on the remote, and optionally clean up local branches already merged to main. Use after running dependabot-triage, after a sprint wind-down, or…
  • 100branch-cleanup
    Prune stale git branches after a merge wave: delete closed/merged remote branches, remove local tracking branches that no longer exist on the remote, and optionally clean up local branches already merged to main. Use after running dependabot-triage, after a sprint wind-down, or…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.