Branch review before pr

From ulpi-io/browse · View interactive version

Branch review before pr is an AI agent skill from the GitHub repository ulpi-io/browse. 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

How to use this skill

Skill file

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:

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

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


Important Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.