Agent skill

Org Branch Cleanup

by vincentkoc in vincentkoc/dotskills

Audit and safely prune stale branches across a GitHub organization with immutable snapshots, conservative merged-PR classification, live SHA/protection/open-PR revalidation, resumable deletion…

MITAuto-check passedDevelopment

Install Org Branch Cleanup

skills CLI
$ npx skills add vincentkoc/dotskills --skill org-branch-cleanup -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install vincentkoc/dotskills org-branch-cleanup --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/vincentkoc/dotskills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/org-branch-cleanup .claude/skills/org-branch-cleanup && rm -rf skills-src

Use ~/.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/

Facts

Skill name
org-branch-cleanup
GitHub stars
108
Token cost
~1.5k tokens
SKILL.md length
510 words
Files
5 (incl. scripts, assets)
Skills in repo
19
Repo updated
First seen
Licence
MIT

At a glance

Audit and safely prune stale branches across a GitHub organization with immutable snapshots, conservative merged-PR classification, live SHA/protection/open-PR revalidation, resumable deletion…

  • Works in 8 steps: Read the target repository or… → Confirm GitHub authentication and… → Run a read-only audit → …
  • A maintainer asks to clean up old
  • SKILL.md covers Purpose, When to use, Workflow and Safety rules, plus 3 more sections
  • Runs Python scripts from its folder; calls python3, gh and git

What it does

Org Branch Cleanup is an agent skill from vincentkoc/dotskills. Audit and safely prune stale branches across a GitHub organization with immutable snapshots, conservative merged-PR classification, live SHA/protection/open-PR revalidation, resumable deletion ledgers, and post-delete verification. Use when a maintainer asks to clean up old, dead, merged, bot-created, or abandoned organization branches without risking default, protected, release, security-advisory, state, or active pull-request refs.

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including scripts and assets (for example `agents/openai.yaml`, `scripts/org_branch_cleanup.py` and `scripts/test_org_branch_cleanup.py`).

It sits in Development, covering Pull requests. It works with GitHub. The repository describes itself as: 🐙 A curated set of Codex and OpenClaw skills for workflow automation, technical debugging, and agent-assisted development patterns. The licence is MIT.

When your agent uses it

  • A maintainer asks to clean up old
  • Abandoned organization branches without risking default
  • Security-advisory
  • Active pull-request refs

Example prompts

  • “/org-branch-cleanup”

Requirements

  • Python 3

Workflow steps

8 steps, taken from the first numbered list in SKILL.md.

  1. Read the target repository or organization instructions before mutation.
  2. Confirm GitHub authentication and rate-limit headroom
  3. Run a read-only audit
  4. Inspect audit-summary.json, audit-errors.tsv, and delete-candidates.jsonl.
  5. Apply only after the candidate set is reviewed
  6. Treat each preflight skip as a safety result, not a failure.
  7. Verify every deletion
  8. Report exact deleted, skipped, retained, excluded-repository, and verification counts. Preserve the ledger until the cleanup is accepted.

What it can do on your machine

Read from SKILL.md and the folder at commit 8f972aa. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3
    • gh
    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use gh and git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Org Branch Cleanup loads about 1.5k tokens when it runs. Until then it costs about 114 tokens; SKILL.md has 510 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~114
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

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.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated 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); the scripts in this folder are not scanned.

SKILL.md

The full file from vincentkoc/dotskills at commit 8f972aa, republished under its MIT licence (© vincentkoc). 510 words, ~1,486 tokens.

Download SKILL.mdSave it as .claude/skills/org-branch-cleanup/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
org-branch-cleanup
description
Audit and safely prune stale branches across a GitHub organization with immutable snapshots, conservative merged-PR classification, live SHA/protection/open-PR revalidation, resumable deletion ledgers, and post-delete verification. Use when a maintainer asks to clean up old, dead, merged, bot-created, or abandoned organization branches without risking default, protected, release, security-advisory, state, or active pull-request refs.
license
MIT
metadata.source
https://github.com/vincentkoc/dotskills

Org Branch Cleanup

Purpose

Remove organization branch clutter without guessing which refs are safe to delete.

The bundled scripts/org_branch_cleanup.py separates the work into read-only audit, explicit apply, and full verification phases. Dry-run evidence is the default; deletion requires an exact organization confirmation.

When to use

  • A GitHub organization has accumulated old or merged development branches.
  • Bot, agent, migration, or dependency branches remain after pull requests merge.
  • A maintainer wants an evidence-backed cleanup ledger rather than broad git push --delete.
  • Branch-heavy security, state, archive, or generated-data repositories need to be separated from ordinary development repos.
  • A previous cleanup stopped midway and must resume without repeating completed deletions.

Workflow

  1. Read the target repository or organization instructions before mutation.
  2. Confirm GitHub authentication and rate-limit headroom:
    • gh auth status
    • gh api rate_limit --jq '.resources | {core,graphql}'
  3. Run a read-only audit:
    bash
    python3 scripts/org_branch_cleanup.py audit \
      --org example-org \
      --output /tmp/example-org-branch-audit
    Start with --include-repo-regex '^one-repo$' when proving access or policy. Audit output is immutable by default; use a new directory rather than --overwrite.
  4. Inspect audit-summary.json, audit-errors.tsv, and delete-candidates.jsonl.
    • Do not apply a partial audit. Fix failed repository queries or explicitly justify --allow-partial.
    • Default candidates are same-repository PR heads merged at least 14 days ago.
    • Closed-unmerged branches and unassociated stale branches are report-only.
    • Default, fork, archived, protected, and release-like refs are excluded.
    • Repositories matching GHSA, state, or archive patterns are excluded by default. Audit them separately under an explicit retention policy.
  5. Apply only after the candidate set is reviewed:
    bash
    python3 scripts/org_branch_cleanup.py apply \
      --candidates /tmp/example-org-branch-audit/delete-candidates.jsonl \
      --confirm-org example-org \
      --output /tmp/example-org-branch-apply
    apply requires the clean sibling audit-summary.json. Do not bypass this with --allow-unverified-candidates or --allow-partial-audit without an explicit operator decision.
  6. Treat each preflight skip as a safety result, not a failure.
    • moved: branch SHA changed after the snapshot.
    • protected: REST or ruleset protection blocked deletion.
    • open-pr: a live pull request now uses the branch.
    • missing: GitHub or another operator already removed it.
  7. Verify every deletion:
    bash
    python3 scripts/org_branch_cleanup.py verify \
      --ledger /tmp/example-org-branch-apply/deleted.tsv \
      --output /tmp/example-org-branch-apply/verification-rerun.tsv
  8. Report exact deleted, skipped, retained, excluded-repository, and verification counts. Preserve the ledger until the cleanup is accepted.
Show full SKILL.md (189 more words)Show less

Safety rules

  • Never delete default, protected, release, pages, stable, or active-PR branches.
  • Never infer safety from branch age or naming alone.
  • Require a same-repository PR whose head name matches the current branch tip.
  • Re-read the live SHA, protection status, and open PRs immediately before deletion.
  • Refuse organization mismatch between the candidate ledger and --confirm-org.
  • Keep closed-unmerged deletion disabled unless the operator explicitly passes --allow-closed-unmerged.
  • Stop broad scans when generated or security repos contain thousands of refs; define retention policy first.
  • If a proxy or wrapper stalls, preserve ledgers and resume with the real GitHub CLI. Do not restart shared daemons owned by other sessions.

Inputs

  • GitHub organization login.
  • Authenticated gh CLI with repository administration permission.
  • Output directory for snapshots and ledgers.
  • Optional retention windows and repository or branch exclusion regexes.
  • Optional --gh-bin override for a compatible GitHub CLI wrapper.

Outputs

  • snapshot.jsonl: immutable branch and PR-tip evidence.
  • delete-candidates.jsonl: old merged branches eligible for live preflight.
  • closed-unmerged-review.jsonl: abandoned PR heads requiring explicit approval.
  • stale-unassociated.tsv: old branches with insufficient deletion proof.
  • deleted.tsv and skipped.tsv: resumable mutation ledger.
  • verification.tsv: post-delete ref state.
  • JSON audit and apply summaries with exact counts and timestamps.

Flow

mermaid
stateDiagram-v2
    [*] --> AuditRequestedScope
    AuditRequestedScope --> ReportAudit: audit only
    AuditRequestedScope --> ReviewCandidates: apply requested
    ReviewCandidates --> ReportBlocked: incomplete audit without explicit exception
    ReviewCandidates --> RevalidateLiveRef: exact organization and candidates approved
    RevalidateLiveRef --> RecordSkip: moved, protected, open PR, or missing
    RevalidateLiveRef --> DeleteExactRef: eligible unchanged ref
    DeleteExactRef --> VerifyDeletion
    VerifyDeletion --> RecordDeleted: absent
    VerifyDeletion --> ReportBlocked: failure or ambiguous result
    RecordSkip --> ReportCounts
    RecordDeleted --> ReportCounts
    ReportAudit --> [*]
    ReportCounts --> [*]
    ReportBlocked --> [*]

© vincentkoc, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (scripts, assets) in skills/org-branch-cleanup of vincentkoc/dotskills.

  • SKILL.md
  • agents/openai.yaml
  • assets/icon.jpg
  • scripts/org_branch_cleanup.py
  • scripts/test_org_branch_cleanup.py

Open the folder on GitHubat commit 8f972aa

Compare with similar skills

Org Branch Cleanup 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.

Org Branch Cleanup compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Org Branch Cleanup this skillvincentkoc/dotskills108—~1.5kAutomated safety check: PassMIT
PR Babysitteropeninterpreter/openinterpreter69k3 repos~4.2kAutomated safety check: PassApache-2.0
Check PRonyx-dot-app/onyx32k2 repos~2.3kAutomated safety check: PassMIT
Contributor-First PR MergeHKUDS/OpenHarness16k1 repos~847Automated safety check: PassMIT
Create Pull Requestcline/cline70k1 repos~1.6kAutomated safety check: PassApache-2.0
Pull Request Title and Body Writeropeninterpreter/openinterpreter69k2 repos~1.1kAutomated safety check: PassApache-2.0

Similar skills

  • PR Babysitter

    openinterpreter/openinterpreter

    Watches an open GitHub pull request until it merges, handling review comments, diagnosing CI failures and retrying flaky checks along the way.

    69k GitHub starsUsed in 3 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Check PR

    onyx-dot-app/onyx

    Checks a GitHub, GitLab, or Perforce (p4) pull request (or merge request, or shelved changelist) for unresolved review comments, failing status checks, and incomplete PR descriptions.

    32k GitHub starsUsed in 2 repos~2.3k tokens
    DevelopmentAuto-check passed
  • Merges external GitHub pull requests while keeping the original author credited, and fixes conflicts after the merge instead of rewriting the contribution.

    16k GitHub starsUsed in 1 repo~847 tokens
    DevelopmentAuto-check passed
  • Opens a GitHub pull request from your current branch with the gh CLI, after reviewing the commits and diff and gathering the details the PR needs.

    70k GitHub starsUsed in 1 repo~1.6k tokens
    DevelopmentAuto-check passed
  • Pull Request Title and Body Writer

    openinterpreter/openinterpreter

    Rewrites the title and body of one or more pull requests with gh, leading with why the change was made, then what changed, and describing only the net result.

    69k GitHub starsUsed in 2 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Official

    Runs a loop on a GitHub pull request: fetch review state, triage comments into actions, implement them and resolve threads, repeating until nothing actionable is left.

    48k GitHub stars~2.2k tokensUpdated yesterday
    DevelopmentAuto-check passed

More from vincentkoc/dotskills

All 19 skills in this repo
  • Openclaw PR Batch Sweep

    vincentkoc/dotskills

    Select, review, repair, validate, and land batches of up to 20 low-risk OpenClaw contributor pull requests using Vincent's maintainer preferences and bounded sub-agent lanes.

    108 GitHub stars~4.1k tokensUpdated 2 days ago
    Auto-check passed
  • Tmux Agent Lane Orchestrator

    vincentkoc/dotskills

    Monitor and coordinate one tmux agent lane, reconstruct worker state from panes and recent Codex logs, classify progress and blockers, and produce concise manager summaries.

    108 GitHub stars~967 tokensUpdated 2 days ago
    Auto-check passed
  • Codebase Memory MCP

    vincentkoc/dotskills

    Resolve canonical Git checkouts, index and verify codebase-memory-mcp graphs through the guarded CLI, open its browser viewer on request, and safely audit duplicate worktree caches.

    108 GitHub stars~3.3k tokensUpdated 2 days ago
    Auto-check passed
  • Session Done

    vincentkoc/dotskills

    Prepare a concise session handoff when the user asks to wrap up, capture continuation context, or use /done.

    108 GitHub stars~833 tokensUpdated 2 days ago
    Auto-check passed
  • Codex Goal Mining

    vincentkoc/dotskills

    Mine structured Codex /goal history locally or across a configured machine fleet, measure active goal time and resumed thread spans, identify unfinished and recurring semantic runs, and turn them…

    108 GitHub stars~1.2k tokensUpdated 2 days ago
    Auto-check passed
  • Semantic Slicing

    vincentkoc/dotskills

    Build local semantic review slices by combining clawpatch feature maps, deepsec threat candidates, visual review maps, and optional gitcrawl/discrawl evidence for repos such as openclaw/openclaw.

    108 GitHub stars~2k tokensUpdated 2 days ago
    Auto-check passed

Works with

Categories

Questions about Org Branch Cleanup

What does Org Branch Cleanup do?

Audit and safely prune stale branches across a GitHub organization with immutable snapshots, conservative merged-PR classification, live SHA/protection/open-PR revalidation, resumable deletion…. Org Branch Cleanup is an agent skill from vincentkoc/dotskills. Audit and safely prune stale branches across a GitHub organization with immutable snapshots, conservative merged-PR classification, live SHA/protection/open-PR revalidation, resumable deletion ledgers, and post-delete verification.

When should I use Org Branch Cleanup?

Org Branch Cleanup fits situations like: A maintainer asks to clean up old; abandoned organization branches without risking default; security-advisory; active pull-request refs.

How do I install Org Branch Cleanup in Claude Code?

Run `npx skills add vincentkoc/dotskills --skill org-branch-cleanup -a claude-code`. Or copy the skill folder (skills/org-branch-cleanup in vincentkoc/dotskills) into .claude/skills/org-branch-cleanup in your project. Claude Code loads it when a task matches its description.

How do I install Org Branch Cleanup in Codex?

Run `npx skills add vincentkoc/dotskills --skill org-branch-cleanup -a codex`. Or copy the skill folder (skills/org-branch-cleanup in vincentkoc/dotskills) into .agents/skills/org-branch-cleanup in your project. Codex loads it when a task matches its description.

Can I use Org Branch Cleanup in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add vincentkoc/dotskills --skill org-branch-cleanup -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/org-branch-cleanup, .gemini/skills/org-branch-cleanup, .github/skills/org-branch-cleanup and .opencode/skills/org-branch-cleanup in your project.

What does Org Branch Cleanup need to run?

Going by SKILL.md and its folder, Org Branch Cleanup needs Python for the scripts in its folder and the command-line tools its instructions call (python3, gh and git). Our summary lists: Python 3.

Does Org Branch Cleanup access the network?

SKILL.md contains no URLs. Its commands use gh and git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Org Branch Cleanup safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Org Branch Cleanup use?

Org Branch Cleanup is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Org Branch Cleanup use?

About 1.5k tokens (SKILL.md is roughly 5.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Org Branch Cleanup?

Skills that share tags, products or a category with Org Branch Cleanup: PR Babysitter (openinterpreter/openinterpreter, 69k stars), Check PR (onyx-dot-app/onyx, 32k stars), Contributor-First PR Merge (HKUDS/OpenHarness, 16k stars) and Create Pull Request (cline/cline, 70k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Org Branch Cleanup?

vincentkoc (a GitHub user) maintains it in vincentkoc/dotskills, which has 108 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on October 8, 2026.

Source: vincentkoc/dotskills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.