audit-gh-branches
Audit local and remote Git branches, classify each as safe to delete, deletion candidate, needs rebase, ice, or keep active, and extract unique work as dated…
Skill by ahandsel
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/ahandsel-audit-gh-branches
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: documents, data, security, productivity
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Node.js package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/audit-gh-branches
What's inside
- Skill name
audit-gh-branches- Description
- Audit local and remote Git branches, classify each as safe to delete, deletion candidate, needs rebase, ice, or keep active, and extract unique work as dated notes. Read-only and local Git data only. Use when the user asks to audit, classify, clean up, triage, or report on Git branches in this repository.
- License
- MIT
- Instructions
- 145 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (3)
- SKILL.md
- collect-branches.mjs · scripts/
- extract-branch-notes.mjs · scripts/
SKILL.md (first lines)
# Audit GitHub branches skill
## Role
A senior release engineer auditing the Git branches of this repository. Precise, conservative about anything destructive, never deletes or modifies a branch directly. Only investigates, recommends, and writes notes.
## Objective
Audit every branch (local and remote) and classify each into a clear disposition: safe to delete, deletion candidate, needs rebase onto `main`, paused ("iced"), or kept active. For any branch carrying work that exists nowhere else, extract that unique content as review notes so nothing is lost before a branch is retired.
## Inputs and assumptions
* Treat `main` as the integration branch. If the repository clearly has no `main`, stop and ask which branch to use rather than guessing.
* Use a staleness cutoff of 60 days by default. A branch is "stale" if its most recent commit is older than 60 days. Adjust only when the user specifies a different cutoff.
* Use local Git data only. Do not make any network call other than `git fetch`. Do not use `gh` or any GitHub API; pull request status is out of scope.
* Run only read-only Git commands (for example, `git fetch`, `git branch`, `git log`, `git diff`, `git cherry`, and `git merge-base`). Do not delete, rebase, push, or otherwise modify any branch.
## Prerequisites
* Run from the root of a git repository.
* `git` on the `PATH` with read access to the target remote.
* Node.js 24+ for running the helpers.
## Quick start
```bash
# 1) Collect branch data with classifications (fetches first, JSON to stdout).
node skills/audit-gh-branches/scripts/collect-branches.mjs > /tmp/audit.json
# Or get a human-readable Markdown summary table directly.
node skills/audit-gh-branches/scripts/collect-branches.mjs --format markdown
# 2) For each branch flagged Ice or Deletion candidate, extract its unique work.
node skills/audit-gh-branches/scripts/extract-branch-notes.mjs BRANCH_NAME \
--output-dir "notes/$(date +%F)-branch-audit"
```
Common flags:
```bash
# Override the base branch or remote.
node skills/audit-gh-branches/scripts/collect-branches.mjs --base-branch develop --remote upstream
# Use a different staleness cutoff (pass the same value to both helpers).
node skills/audit-gh-branches/scripts/collect-branches.mjs --stale-days 90
node skills/audit-gh-branches/scripts/extract-branch-notes.mjs BRANCH_NAME --output-dir "notes/$(date +%F)-branch-audit" --stale-days 90
# Skip git fetch (use the current local snapshot).
node skills/audit-gh-branches/scripts/collect-branches.mjs --no-fetch
```
## Default workflow
1. **Confirm the integration branch.** Default to `main`. If `main` is missing, ask the user which branch to use before continuing.
2. **Collect branch data.** Run `collect-branches.mjs`. The helper runs `git fetch --all --prune` first, then returns the per-branch metadata (location, last commit, ahead/behind, merged status, cherry duplication, and a proposed classification).
3. **Decide and refine classifications.** The helper's `disposition` is a deterministic first pass from the criteria below. Adjust only when context (renames, content matches that defeat `git cherry`, automation branches) warrants it. Note any judgment calls in the report.
4. **Extract unique work.** For each branch classified `ice` or `deletion-candidate` (and any `safe-to-delete` branch whose unique commits are at risk), run `extract-branch-notes.mjs`. The helper writes `summary.md` (populated scaffold) and `unique-commits.patch` into the audit folder.
5. **Write the report.** Compose `branch-audit.md` in the audit folder, following the report structure below. Source the table directly from the helper output to avoid transcription errors.
## Classification criteria
The helper applies these in order and writes the result to each branch's `disposition` field. Override only with a documented reason.
* **`safe-to-delete`** - Fully merged into the base branch with no unique unmerged commits. Suggest deletion (conservative; never delete automatically).
* **`deletion-candidate`** - Not merged by a normal merge, but every commit is patch-equivalent in the base (squash-merge or cherry-pick, detected with `git cherry`). Flag for review; do not suggest automatic deletion. Sub-case of "Safe to delete" in the report breakdown.
* **`needs-rebase`** - Has unique unmerged commits and is behind the base, so it must be updated before it can merge cleanly.
* **`ice`** - Has unique work but is stale (most recent commit older than the staleness cutoff); recommend pausing rather than deleting.
* **`keep-active`** - Up to date or recently active work (within the cutoff) that needs no action right now.
## Notes output
Write all notes to the filesystem using this structure, where `<YYYY-MM-DD>` is the date the audit is run:
* Audit folder: `notes/<YYYY-MM-DD>-branch-audit/`.
* Main report: `notes/<YYYY-MM-DD>-branch-audit/branch-audit.md`.
* Per-branch extracted content: `notes/<YYYY-MM-DD>-branch-audit/<sanitized-branch>/`, with at least:
* `summary.md` - what the unique work does, key commit hashes, files of interest, link to the patch.
* `unique-commits.patch` - `git log -p` of the unique commits in chronological order.
`extract-branch-notes.mjs` sanitizes branch names by replacing `/` with `-`.
## Report contents (`branch-audit.md`)
1. **Summary table** with columns: `Branch | Local/Remote | Last commit | Ahead/Behind main | Merged? | Duplicated elsewhere? | Disposition | One-line reason`. Run `collect-branches.mjs --format markdown` to generate this directly.
2. **Disposition breakdown** - group branches under: Safe to delete, Deletion candidate (flag only), Needs rebase, Ice, Keep active.
3. **Notes for future review** - for each iced or to-be-deleted branch with unique work: branch name, what the work does, key commit hashes, files of interest, and a relative link to its subfolder.
4. **Suggested next commands** - exact Git commands the user could run to act on each recommendation, labeled as suggestions to review, not commands to run automatically.
## Bundled resources
### scripts/collect-branches.mjs
Read-only branch inventory.
Behavior:
* Runs `git fetch --all --prune` first (skippable with `--no-fetch`).
* Enumerates local refs and remote refs on the chosen remote (default `origin`).
* For each branch computes: `lastDate`, `lastAuthor`, `ahead`, `behind`, `merged`, `cherryUnique`, `cherryDuplicated`, `location` (`local`, `remote`, `local-and-remote`, or `local-only-remote-gone`), and a proposed `disposition` plus `reason`. The governing `ref` is named in the record.
* For a branch that exists both locally and on the remote, also records `localAhead`, `localBehind`, `localMerged`, `remoteAhead`, `remoteBehind`, `remoteMerged`, `localAheadOfRemote`, and `remoteAheadOfLocal`. The local ref governs the classification whenever `localAheadOfRemote` is above zero (unpushed work), so unpushed commits are never reported as merged or safe to delete; otherwise the remote ref governs. The Markdown table shows this as `Local + Remote (N unpushed)`.
* Emits JSON (default) or a Markdown summary table (`--format markdown`).
* Exits `0` on success, `1` on git failure, `2` on invalid arguments.
### scripts/extract-branch-notes.mjs
For one branch, extracts the unique commits as a patch and writes a populated `summary.md` scaffold.From ahandsel/tokyo-geek, MIT.
More from ahandsel/tokyo-geek
- 0.603score
gh-sync-with-main
ahandsel
Bring the current git branch up to date with commits from the main branch, or check whether it needs syncing without changing it.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
gh-pr-generator
ahandsel
Draft a structured pull request body from the branch diff and open the pull request with the gh CLI.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
pr-auditor
ahandsel
Blunt merge audit of a code branch or pull request written by an AI coding agent, treating its description, comments, and green checks as claims to verify…
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
blog-content-auditor
ahandsel
Audit a blog post for content quality - verify facts are correct and up-to-date, check style-guide compliance, and confirm the content is logically sound and…
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
blog-md-linter
ahandsel
Lint and polish Markdown files in this repo - run the repo auto-fixers, refresh any table of contents, convert inline and autolink links to reference-style…
SkillAFreshness: A★ 2Claude Code +9 - 0.558score
script-auditor
ahandsel
Audit and enforce the AGENTS.md "Scripts" guidelines for helper scripts in this repo - banning Python, preferring Node.js `.mjs` modules or zsh, requiring…
SkillBFreshness: B★ 2Claude Code +9 - 0.557score
audit-pr-comments
ahandsel
Audit a user-specified PR review file with extreme scrutiny, then annotate that same file in place with a verdict for every comment (keep, rewrite, remove…
SkillBFreshness: B★ 2Claude Code +9 - 0.521score
handoff
ahandsel
Compact the current conversation into a handoff document for another agent to pick up.
SkillBFreshness: B★ 2Claude Code +9 - 0.518score
grill-me
ahandsel
A relentless interview to sharpen a plan or design.
SkillBFreshness: B★ 2Claude Code +9 - 0.512score
gh-pr-reporter
ahandsel
Fetch all comments on a GitHub pull request (reviews, inline review comments, and general issue comments) and emit a single consolidated Markdown report.
SkillCFreshness: C★ 2Claude Code +9 - 0.512score
file-folder-name-linter
ahandsel
Lint repository file and folder names for format compliance.
SkillCFreshness: C★ 2Claude Code +9 - 0.507score
general-en-polisher
ahandsel
Polish one or more Markdown files so the repo core writing rules are enforced - straight quotes (not curly), no contractions, the Oxford comma, sentence case…
SkillCFreshness: C★ 2Claude Code +9
Signals
- Stars
- 2
- Forks
- 0
- Open issues
- 1
- Last commit (this folder)
- Sep 29, 2026 (1 month ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/ahandsel/tokyo-geek
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from ahandsel
- 0.603score
gh-sync-with-main
ahandsel
Bring the current git branch up to date with commits from the main branch, or check whether it needs syncing without changing it.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
gh-pr-generator
ahandsel
Draft a structured pull request body from the branch diff and open the pull request with the gh CLI.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
blog-content-auditor
ahandsel
Audit a blog post for content quality - verify facts are correct and up-to-date, check style-guide compliance, and confirm the content is logically sound and…
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
blog-md-linter
ahandsel
Lint and polish Markdown files in this repo - run the repo auto-fixers, refresh any table of contents, convert inline and autolink links to reference-style…
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
pr-auditor
ahandsel
Blunt merge audit of a code branch or pull request written by an AI coding agent, treating its description, comments, and green checks as claims to verify…
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
gh-pr-generator
ahandsel
Draft a structured pull request body from the branch diff and open the pull request with the gh CLI.
SkillAFreshness: A★ 2Claude Code +9
Cite this page
audit-gh-branches skill. Agent Mart. https://agentmart.dev/skills/ahandsel-audit-gh-branches (last updated 2026-10-24)