agentleFS
ulpi-ioulpi-io/browse/.claude/skills/branch-review-before-pr/SKILL.md

branch-review-before-pr

Skill15 starsChanged 8 months agoApache-2.0View on GitHub

Pre-landing PR review. Analyzes diff against main for structural issues that tests don't catch: query safety, race conditions, trust boundary violations, conditional side effects, and more. Critical findings block /ship and /create-pr. Invoke via /branch-review-before-pr or when integrated as a gate in ship workflows.

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 12 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run git branch --show-current to get the current branch.

    line 18
  2. Distinctive:

    If on main (or master), output: "Nothing to review — you're on main or have no changes against main." and stop.

    line 19
  3. Very specific:

    Run git fetch origin main --quiet && git diff origin/main --stat to check if there's a diff.

    line 20
  4. Very specific:

    Read the checklist file located alongside this skill at the relative path checklist.md (same directory as this SKILL.md).

    line 26
  5. Distinctive:

    If the file cannot be read, STOP and report the error: Do not proceed without the checklist.

    line 28
  6. Very specific:

    Run git diff origin/main to get the full diff.

    line 40
  7. Distinctive:

    If the diff is very large, also get the file list and read changed files individually:

    line 42
  8. Distinctive:

    Read the FULL diff before commenting: Do not flag issues already addressed in the diff.

    line 48
  9. Distinctive:

    Pass 2 (INFORMATIONAL): All remaining categories from the checklist

    line 57
  10. Distinctive:

    Follow the output format specified in the checklist.

    line 59
  11. Distinctive:

    After all critical questions are answered, output a summary of what the user chose for each issue.

    line 91
  12. Very specific:

    If the user chose (A) on any issue: apply the recommended fixes to those files.

    line 93
  13. Distinctive:

    If only (B) or (C) were chosen: no action needed.

    line 94
  14. Distinctive:

    Read-only by default: Only modify files if the user explicitly chooses "Fix it now" on a critical issue.

    line 103
  15. Distinctive:

    Respect suppressions: If the checklist says don't flag it, don't flag it.

    line 106
  16. Distinctive:

    Scope to the diff: Do not review unchanged code.

    line 107

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Pre-Landing Branch Review

You are running the /branch-review-before-pr workflow. Analyze the current branch's diff against main for structural issues that tests don't catch.


Step 1: Check branch

  1. Run git branch --show-current to get the current branch.
  2. If on main (or master), output: "Nothing to review — you're on main or have no changes against main." and stop.
  3. Run git fetch origin main --quiet && git diff origin/main --stat to check if there's a diff. If no diff, output the same message and stop.

Step 2: Read the checklist

Read the checklist file located alongside this skill at the relative path checklist.md (same directory as this SKILL.md).

If the file cannot be read, STOP and report the error. Do not proceed without the checklist.


Step 3: Get the diff

Fetch the latest main to avoid false positives from a stale local main:

git fetch origin main --quiet

Run git diff origin/main to get the full diff. This includes both committed and uncommitted changes against the latest main.

If the diff is very large, also get the file list and read changed files individually:

git diff origin/main --name-only

Read the FULL diff before commenting. Do not flag issues already addressed in the diff.


Step 4: Two-pass review

Apply the checklist against the diff in two passes:

  1. Pass 1 (CRITICAL): Query & Data Safety, Race Conditions & Concurrency, Auth & Trust Boundaries
  2. Pass 2 (INFORMATIONAL): All remaining categories from the checklist

Follow the output format specified in the checklist. Respect the suppressions — do NOT flag items listed in the suppressions section.


Step 5: Output findings

Always output ALL findings — both critical and informational. The user must see every issue.

Output format:

Branch Review: N issues (X critical, Y informational)

CRITICAL (blocking):
- [file:line] Problem description
  Fix: suggested fix

Issues (non-blocking):
- [file:line] Problem description
  Fix: suggested fix

If no issues found: Branch Review: No issues found.

If CRITICAL issues found: Output all findings, then for EACH critical issue use a separate AskUserQuestion with:

  • The problem (file:line + description)
  • Your recommended fix
  • Options:
    • (A) Fix it now — apply the recommended fix
    • (B) Acknowledge — ship anyway, you understand the risk
    • (C) False positive — skip, this isn't actually a problem

After all critical questions are answered, output a summary of what the user chose for each issue.

  • If the user chose (A) on any issue: apply the recommended fixes to those files. Do NOT commit — the user or /ship will handle that.
  • If only (B) or (C) were chosen: no action needed.

If only informational issues found: Output findings. No further action needed. These go into the PR body when used with /create-pr.


Important Rules

  • Read the FULL diff before commenting. Do not flag issues already addressed in the diff.
  • Read-only by default. Only modify files if the user explicitly chooses "Fix it now" on a critical issue. Never commit, push, or create PRs.
  • Be terse. One line problem, one line fix. No preamble, no summaries, no "looks good overall."
  • Only flag real problems. Skip anything that's fine. A clean review is a valid outcome.
  • Respect suppressions. If the checklist says don't flag it, don't flag it.
  • Scope to the diff. Do not review unchanged code. Only the branch diff is in scope.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.