skills/branch-inspector/SKILL.md
Inspect one git branch vs main: overview of commits, diff, merge/PR status, staleness; user picks delete/archive/PR/keep; emit action plan. Use for 'review this branch', 'branch cleanup'. Skip for repo audits, multi-branch sweeps, PR code review.
npx skillsauth add montimage/skills branch-inspectorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Inspects a single git branch against main to support a cleanup decision. The skill produces a deep overview of what the branch contains, surfaces signals that inform the keep/delete/archive/PR decision, asks the user to choose, then emits a concrete action plan for the chosen path.
feature/foo", "is experiment/x worth keeping?").Do not use this skill for: scanning many branches at once, full repo audits, or reviewing a PR diff line-by-line.
The branch name is passed as an argument. If the user invokes the skill without one, ask which branch to inspect — do not default to the current branch silently.
The branch may be local (feature/foo), remote (origin/feature/foo), or both. Detect which exist and report both states.
Verify before running. Stop and tell the user if any check fails.
git rev-parse --git-dir succeeds).main branch exists locally or on origin (git rev-parse --verify main or origin/main). If the project's primary branch is master or something else, ask the user to confirm the comparison base.origin. If neither, stop and tell the user.gh CLI is optional; used to detect linked PRs. If not available, skip the PR-check step rather than failing.Inspection is read-only on the working tree but needs fresh refs to be accurate. Before inspecting:
git fetch origin --prune
--prune removes stale remote-tracking refs so the skill doesn't report a branch as "exists on remote" when it was deleted upstream. Do not check out the branch and do not modify the working tree during inspection.
Given the branch name, determine:
git rev-parse --verify <branch>)git rev-parse --verify origin/<branch>)Pick the inspection target: prefer the local ref if both exist and are in sync, otherwise inspect each side separately and call out the divergence.
Collect signals across five groups: identity & activity, merge status, diff scope, implementation depth, staleness. Run independent git commands in parallel where possible. See references/overview-fields.md for the exact field list, the git commands per field, and how to use git cherry for squash-merge detection. The implementation-depth group is the one that matters most for the decision — go beyond stats and read the diff to explain what the branch does. If the diff is too large to read in full, spawn an Explore subagent rather than skimming superficially.
Output a structured report. Use this template:
◆ Branch Overview: <branch>
··································································
Refs: local=<yes/no> remote=<yes/no> in-sync=<yes/no>
Tip: <sha-short> <date> by <author>
Diverged at: <sha-short> <date>
Activity: <N> commits ahead, <M> commits behind main
last commit <X> days ago
Authors: <list>
Diff: <files> files, +<added>/-<removed> lines
Top areas: <dir1>, <dir2>, <dir3>
Merge status: <merged | squash-merged | unmerged>
cherry-equivalent: <K>/<N> commits already on main
Linked PR: <url or "none">
Conflict risk: <low | medium | high — files overlap recent main activity>
Staleness: <fresh | stale (>30d) | abandoned (>90d)>
Intent: <feature | refactor | bugfix | experiment | WIP | unclear>
What this branch implements:
<2-6 sentences describing the actual change, drawn from the diff>
Notable findings:
- <signal 1, e.g., "Adds X module under src/foo, no tests">
- <signal 2, e.g., "Last 3 commits are 'WIP', no rebase since main moved 47 commits">
- <signal 3>
Recommendation: <delete | archive | open PR | keep>
Reasoning: <one sentence>
The recommendation is a suggestion, not a decision. Always defer to the user.
Present four options explicitly:
Ask the user which path to take. Do not act until they answer.
If the user picks Archive, follow up with: "Tag-and-delete (archive/<branch> tag, then delete branch) or rename to archive/<branch>?" Do not assume.
Once the user has decided, output a numbered action plan with the exact commands. Do not execute them automatically — this is a cleanup workflow and the user should run the commands themselves or explicitly approve.
See references/action-plans.md for the four plan templates (delete, archive tag-and-delete, archive rename, open PR, keep). Pick the template matching the user's decision, substitute <branch>, and present the numbered steps to the user. For the PR template, fill in the title and body from the implementation summary built in step 2.
The skill emits the plan and stops. Executing destructive commands (branch -D, push --delete) is the user's call, not the skill's. If the user explicitly asks the skill to run the plan, confirm once before each destructive step.
Emit a report after the overview phase and after the plan phase.
◆ Branch Overview (step 1 of 2 — <branch>)
··································································
Refs resolved: √ pass
Merge status: √ pass
Diff analyzed: √ pass
Implementation: √ pass (deep read)
PR check: √ pass (or — gh CLI not available)
____________________________
Result: PASS
◆ Action Plan (step 2 of 2 — decision: <delete|archive|pr|keep>)
··································································
Decision captured: √ pass
Plan emitted: √ pass
Commands listed: √ pass
____________________________
Result: PASS
A complete run produces three artifacts in the chat, in order:
references/action-plans.md matching the user's choice, with <branch> substituted and (for PR) suggested title/body filled in.See references/example-output.md for a worked example showing the overview block, decision prompt, and follow-up plan for an archived branch.
A run is correct when all of these hold:
git fetch origin --prune before reading any refs.<placeholder> left unfilled.git cherry main <branch> (squash-detection), not just git branch --merged.git diff main...<branch>.references/action-plans.md for the chosen decision, with <branch> substituted.branch -D, push --delete, tag) was executed by the skill itself.main branch. Repos using master, develop, or trunk — ask once and use the answer for the rest of the run.origin/<branch> directly; do not check out locally.git branch --merged says no but git cherry shows all - lines — recommend delete and call out the squash detection.gh CLI not installed. Skip the linked-PR check; mark as "n/a — gh not available". Do not fail the run.fix/typo may contain a refactor; always verify intent from the diff, not the name.development
Expand unit test coverage by targeting untested branches and edge cases. Use when users ask to "increase test coverage", "add more tests", "expand unit tests", "cover edge cases", "improve test coverage", "find untested code", "what's not tested", "run coverage report", "write missing tests", or want to identify and fill gaps in existing test suites. Adapts to project's testing framework. Trigger this skill whenever the user mentions test gaps, untested code, coverage percentages, or wants to harden their test suite.
development
Audit npm/pip/Docker/GitHub Actions for supply chain risks; apply cooldown, lockfile, ignore-scripts, SHA pinning, scanning after approval. Use for 'supply chain audit', 'harden dependencies'. Skip for runtime vulns, secret scanning, code review.
development
Analyze agent skills for security risks, malicious patterns, and potential dangers before installation. Use when asked to "audit a skill", "check if a skill is safe", "analyze skill security", "review skill risk", "should I install this skill", "is this skill safe", "scan this skill", or when evaluating any skill directory for trust and safety. Also triggers when the user pastes a skill install command like "npx skills add https://github.com/org/repo --skill name". Produces a comprehensive security report with a clear install/reject verdict. Trigger this skill proactively whenever the user is about to install a third-party skill or mentions concerns about skill safety.
development
Add OSS-standard files (README, CONTRIBUTING, LICENSE, CODE_OF_CONDUCT, SECURITY, GitHub templates) and run an 8-section readiness audit. Use for 'make this open source', 'OSS readiness', 'public release'. Skip for marketing pages or closed code.