Logo van Clean Branches

Clean Branches

Community
gupsammy
clean-branches

Gebruik deze skill wanneer de gebruiker zegt "branches opschonen", "gemergde branches verwijderen" of "verouderde branches opruimen". Gebruik de skill zodra de gebruiker branchopschoning, branches opruimen of verouderde branches verwijderen noemt, ook als die niet expliciet "clean-branches" zegt.

Add to TypingMind

Overzicht

Uitgevergupsammy
RepositoryClaudest
Skillnaamclean-branches
Sterren
275
Forks
16
Meegeleverde bestanden
1
Links
  • Instructies in Markdown

    Het model laadt het bestand SKILL.md alleen als dat nodig is. Dat kost dus alleen tokens als een verzoek daadwerkelijk bij de skill past.

  • Werkt met elk LLM

    AI-skills bestaan uit instructies in gewone Markdown, niet uit aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Meegeleverde bestanden: 1

    Scripts, sjablonen en referentiemateriaal die het model tijdens het werken kan lezen. De bestanden kunnen alleen worden gelezen en worden nooit uitgevoerd.

  • Open source

    Gepubliceerd door gupsammy op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Clean Branches in TypingMind om deze met elk LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map. De app leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/gupsammy/Claudest/tree/main/plugins/claude-coding/skills/clean-branches
  4. Schakel de skill in voor elke chat waarin je de skill wilt kunnen gebruiken.
Plug-ins → Skills → Skill toevoegen → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/gupsammy/Claudest.git /tmp/Claudest
mkdir -p .claude/skills
cp -r /tmp/Claudest/plugins/claude-coding/skills/clean-branches .claude/skills/clean-branches
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Clean Branches in voor een chat naar keuze in TypingMind en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek bij de skill past, laadt het model zelf de volledige instructies. Je hoeft de skill nooit handmatig aan te roepen. Pas als het model de skill daadwerkelijk gebruikt, kost dat tokens.

Het model laadt Clean Branches automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Clean Branches niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

Clean Git Branches

Safely remove merged and stale git branches with confirmation.

Process

If $ARGUMENTS is provided, treat it as a glob pattern to filter branch candidates (e.g., feature/*) and pass it to the candidate script in Step 1.

1. Fetch latest state

bash
git fetch --all --prune

If fetch fails (no remotes configured), note remote data is unavailable and continue with local analysis only.

2. Identify candidates

Run the candidate detection script, passing the optional pattern filter:

bash
bash ${CLAUDE_PLUGIN_ROOT}/skills/clean-branches/scripts/find-candidates.sh "$PATTERN"

The script outputs two labeled sections (=== MERGED === and === STALE ===), one branch per line. Branches carry two optional annotations:

  • [worktree:/path/to/wt] — branch is checked out in a worktree
  • [squash-merged] — branch was merged via squash or rebase PR; git does not recognize it as merged locally (requires force-delete in Step 5)

Parse each section into its own list, preserving both annotations.

After parsing, apply these worktree rules before building the candidate lists. Process the MERGED list first, then the STALE list — a branch that appears in both (merged AND older than 30 days) is governed by the MERGED rule only; skip it when processing STALE.

  • Stale branch + active worktree → move immediately to the blocked list, regardless of worktree state. A stale branch with a live worktree may still have in-progress work — never offer it for cleanup. Skip branches already classified as merged.
  • Merged branch + active worktree → check whether the worktree is clean:
    bash
    git -C /path/to/wt status --porcelain
    If the command returns any output (uncommitted changes), move to the blocked list. If clean, keep in the merged candidate list with the worktree annotation.

3. Present results

Display branches in four groups:

  • Merged (safe to delete) — branches fully merged into base; those with a clean worktree show "(+ worktree at /path)"
  • Stale (no recent commits, no active worktree) — only branches without a worktree appear here
  • Protected (never touch) — main, master, develop, release/*
  • Blocked — branches skipped because they have an active worktree with uncommitted work, or are stale with any active worktree; list each with its worktree path so the user knows what to resolve manually

Do NOT say "will be removed" for worktrees — removal is gated on confirmation in Step 4. If both the merged and stale candidate lists are empty, report "No branches to clean" and stop.

4. Confirm before deletion

Use AskUserQuestion. For merged branches that carry a worktree annotation, the confirmation option must name both the branch and its worktree path — the user is authorizing removal of both in one selection.

Structure:

  • Header: "Branch cleanup"
  • For merged branches: one option per branch. If the branch has a worktree: label = "branch-name + worktree", description = "Removes branch and worktree at /path". If the branch is squash/rebase-merged: append "(squash/rebase PR — force delete)" to the description so the user knows -D will be used. If no worktree and not squash-merged: label = branch name, description = "Removes local branch". Include a "Keep all merged branches" fallback. If there are multiple candidates with no worktrees, a "Delete all N" batch option is acceptable.
  • For stale branches: use multiSelect:true. Each option: label = branch name, description = age. (No stale branch with a worktree will appear here — they were moved to blocked in Step 2.)
  • Always include a "Skip — keep all" option

The user selecting a branch-with-worktree option is explicit authorization to remove both. Never remove a worktree that was not explicitly included in a confirmed selection.

5. Execute deletion

Delete only what the user confirmed. For each confirmed branch:

  1. If the branch has a [worktree:/path] annotation, remove the worktree first:

    bash
    git worktree remove /path/to/wt

    If the command fails (the worktree acquired changes in the window between Step 2 and now), report the error and skip that branch — do not force-remove.

  2. Then delete the branch:

    • Regular merged (no [squash-merged] annotation): git branch -d <branch-name>
    • Squash/rebase-merged ([squash-merged] annotation): git branch -D <branch-name>

    -D is required for squash/rebase-merged branches because git does not recognise their commits as merged into base — using -d will fail. The [squash-merged] annotation on a confirmed selection is explicit user authorisation to force-delete.

  3. After local deletions are complete, offer remote cleanup:

    Use AskUserQuestion with multiSelect:true listing every branch that was successfully deleted locally and has a known remote (git ls-remote --heads origin <branch-name> to verify). Let the user select which remotes to also delete. If none have a remote, skip this step.

    For each selected remote:

    bash
    git push origin --delete <branch-name>

Output

Summary of actions taken:

  • Branches deleted (local)
  • Branches deleted (remote, if requested)
  • Branches kept
  • Any errors encountered

Meegeleverde bestanden

Zolang de skill geladen is, leest het model deze bestanden als dat nodig is. Het model kan ze alleen lezen; ze worden nooit uitgevoerd.

Veelgestelde vragen

Wat doet de AI-skill Clean Branches?

Gebruik deze skill wanneer de gebruiker zegt "branches opschonen", "gemergde branches verwijderen" of "verouderde branches opruimen". Gebruik de skill zodra de gebruiker branchopschoning, branches opruimen of verouderde branches verwijderen noemt, ook als die niet expliciet "clean-branches" zegt.

Waarom Clean Branches gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Clean Branches bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model. Ook als je midden in een chat van model wisselt, blijft de skill werken. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek af te sluiten. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Clean Branches in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/gupsammy/Claudest/tree/main/plugins/claude-coding/skills/clean-branches. TypingMind leest het bestand SKILL.md, bundelt de bijbehorende bestanden en installeert het geheel als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Clean Branches gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Clean Branches gebruiken?

Zoveel als je wilt. Je kunt Clean Branches gebruiken met elk model dat skills ondersteunt, zoals GPT, Claude, Gemini, Grok, DeepSeek, Mistral of Llama. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Clean Branches gratis?

Deze skill is door gupsammy op GitHub gepubliceerd. Bekijk de repository voor de licentievoorwaarden. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. De skill volgt het open Agent Skills-formaat: het bestand SKILL.md bevat de naam en beschrijving van de skill. Daarnaast kan de skill scripts, sjablonen of referentiebestanden bevatten die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇