agentsclimarketplace

Branch sweeper

Skill vetterj73/branch-sweeper

The Sweeper cleans up local git branches across all repos under a root directory. Use when the user asks to run the sweeper, sweep branches, clean up local repos, delete merged branches, prune local branches, tidy up git branches, check for open Azure DevOps pull requests across repos, check which repos have uncommitted changes or in-progress merges and rebases, or audit which repos have a non-main default branch. Runs Clean-LocalGitBranches.ps1 and summarizes its JSON report.From its SKILL.md

Install
npx -y skills add vetterj73/branch-sweeper

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

4.4 KB, 927 tokens by cl100k_base, as published. Nobody here has run it

The Sweeper

This skill wraps Clean-LocalGitBranches.ps1, which lives in the same directory as this file. All branch logic is in the script. Do not reimplement it inline with ad hoc git commands; run the script and interpret its output.

What the script does

For every git repo found under the root directory (default C:\src, depth 2):

  1. Fetches with prune and detects the default branch.
  2. Reports working tree state (changed and untracked file counts) and any in-progress operation (rebase, merge, cherry-pick, revert, bisect).
  3. Deletes local branches confirmed merged to the default branch. Detects squash merges two ways: an offline patch-equivalence check, and a completed-PR lookup in Azure DevOps. A branch whose tip differs from its completed PR's merge commit is never deleted (protects reused branches with new work). In repos with an operation in progress, deletions are deferred and reported instead.
  4. Reports unmerged local branches, open ADO PRs per repo, and repos whose default branch is not main.

Protected branches (main, master, develop, dev) and the currently checked-out branch are never deleted. Deleted branches are recoverable via git reflog for about 30 days.

How to run

powershell -NoProfile -ExecutionPolicy Bypass -File "<skill-dir>\Clean-LocalGitBranches.ps1" -Root C:\src

Where <skill-dir> is the directory containing this SKILL.md. Useful parameters:

  • -Root <path>: scan a different directory (if the user names one, use it)
  • -DryRun: report what would be deleted without deleting. Use this when the user says preview, dry run, or check first. Otherwise run for real; that is the point of the skill.
  • -Depth <n>: recursion depth for finding repos (default 2)
  • -SkipFetch: offline mode; warn the user that results may be stale
  • -Protect <branches>: additional branch names to never delete

The script always writes last-report.json next to itself (override with -ReportPath).

How to present results

Read the JSON report (last-report.json in the skill directory) rather than parsing console text. Summarize in this order, omitting empty sections:

  1. Repo state warnings: ReposMidOperation and ReposWithDirtyTree from the summary. For mid-operation repos, explain that branch deletions were deferred there, and offer to talk through finishing or aborting the operation. For dirty trees, mention the changed/untracked counts and, if the user seems to have forgotten about them, offer options (commit, stash, discard). NEVER run stash, commit, checkout, rebase --abort, or similar state-changing commands yourself unless the user explicitly asks; a repo mid-operation is in a delicate state and the user may have context you lack. Ask first.
  2. Deleted (or Would delete for dry runs): per repo, branch names and detection method. Keep it brief.
  3. Needs attention: unmerged branches: per repo, branch name and commits ahead of default. These are the user's decision; do not offer to force-delete them.
  4. Open PRs in ADO: repo, PR id, title, source -> target, author.
  5. Non-main defaults: the NonMainDefaults array in the summary. Flag these plainly; the user tracks them deliberately.
  6. Skipped and errors: anything in Skipped (especially reused-branch and mid-operation deferrals) and Errors.

Total counts are in the top-level summary fields (TotalDeleted, TotalUnmerged, TotalOpenPRs).

Failure handling

  • If the report shows AdoCliAvailable: false, tell the user ADO checks were skipped and that some squash-merged branches may be listed as unmerged. Fix: az extension add --name azure-devops, then az login.
  • If a repo shows a fetch error, note that its merge status may be stale.
  • If the script itself fails to start, check that git and powershell are on PATH before anything else.

Do not delete branches manually to "finish the job" when the script skips something. Skips are deliberate safety behavior; report them and let the user decide.

What ships with it: 6 files

23.7 KB alongside SKILL.md, 2 of them executable

Gives 0 of the 12 instructions most pr commit review skills give in 927 tokens

Counted across 888 of the 1,342 authors here whose files we hold, read 2026-08-07

  • Use conventional commits formatin 127 of 888, across 115 files
  • Keep subject line under 72 charactersin 62 of 888, across 48 files
  • Delete branches after mergein 51 of 888, across 38 files
  • Use imperative mood in subject linein 51 of 888, across 42 files
  • Use imperative mood in commit messagesin 44 of 888
  • Verify directory is ignored before creating worktreein 43 of 888, across 12 files
  • Generate a conventional commit messagein 43 of 888
  • Add unignored worktree directories to gitignorein 42 of 888, across 10 files
  • Make atomic commitsin 39 of 888, across 27 files
  • Run tests before committingin 36 of 888, across 25 files
  • Verify clean test baselinein 35 of 888, across 9 files
  • Split unrelated changes into separate commitsin 35 of 888, across 30 files

Said here and by no other author read

  • run the provided powershell script
  • do not reimplement the script logic inline
  • pass a user specified directory to the root parameter
  • warn the user when skipping fetch
  • summarize repo state warnings first
  • check path for git and powershell if start fails

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 326,452. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.