Skip to content
Back to skills

Maintainer Local Clean

ASecurity

Clean stale local git state in the Benchmark Radar checkout after pulling main. Use when the maintainer asks to pull and clear stale branches, worktrees, or remote-tracking refs.

  • 421 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 9, 2026
ai-agentsgogit

Security analysis

A100/100

Scanned November 9, 2026

npx -y skills add ktwu01/benchmark-radar --skill maintainer-local-clean --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Maintainer Local Clean?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Maintainer Local Clean
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ktwu01-maintainer-local-clean/badge)](https://www.skillsdirectory.com/skills/ktwu01-maintainer-local-clean)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: maintainer-local-clean
description: Clean stale local git state in the Benchmark Radar checkout after pulling main. Use when the maintainer asks to pull and clear stale branches, worktrees, or remote-tracking refs.
---

# Maintainer local clean

This repo squash-merges, so a merged branch is not an ancestor of `main`. Prove
merges through GitHub, not through `git branch --merged`.

## Steps

1. Pull `main`: `git pull --ff-only` on `main`, then `git fetch --all --prune`.
2. List candidates: `git worktree list`, `git branch -vv`, and
   `git for-each-ref refs/remotes`.
3. For each branch, worktree, or remote-tracking ref, find its PR number
   (branch name, or `gh pr list --state all --head <branch>`). Read its state
   with `gh pr view <n> --json state,headRefOid`.
4. Classify:
   - `MERGED`: remove the local branch, worktree, and tracking ref.
   - `CLOSED` without merge: when you remove the ref, tag its tip first with
     `git tag legacy/<branch> <ref>` (local only, never pushed). Do this
     automatically and do not list it as a finding. If the ref stays, add no tag.
   - `OPEN`: keep.
   - `star-history` (any remote): automation branch. Always keep, never report.
   - Any other branch with no PR: keep, and report it.
5. Before removing a worktree, check `git -C <path> status --short` is empty.
   A worktree whose directory is gone is removed by `git worktree prune`.
6. Present the plan and wait for approval. Remove in this order: worktrees,
   local branches, remote-tracking refs.

## Constraints

- Delete only local state. Never run `git push origin --delete` unless the
  maintainer names the remote branch.
- Keep all tags, including `legacy/*`.
- Keep ignored build artifacts (`site/*`, `data/catalog/*`, `.venv`, `out/`).
  They regenerate from the build, but a rebuild is slow.
- Do not touch `main`, the current branch, or a branch checked out in a
  worktree you are keeping.
- If a hook blocks `git branch -d` or `-dr`, give the maintainer the exact
  command to run. Do not bypass the hook with `update-ref`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.