CommunityCoding & Developmentgithub.com

pr-self-review

Review your own branch before opening or updating a pull request - automated diff risk scan plus a senior-reviewer checklist, then a ready-to-paste PR description. Use when the user says "review my changes", "is this ready for PR", "self-review", "before I push", "write the PR description", or asks you to check a branch/diff for problems.

What is pr-self-review?

pr-self-review is a Claude Code agent skill that review your own branch before opening or updating a pull request - automated diff risk scan plus a senior-reviewer checklist, then a ready-to-paste PR description. Use when the user says "review my changes", "is this ready for PR", "self-review", "before I push", "write the PR description", or asks you to check a branch/diff for problems.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/terusangki/agent-skills/tree/HEAD/skills/pr-self-review

Installed? Explore more Coding & Development skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

PR self-review

Goal: catch what a reviewer would catch, before they spend time on it, and hand them a PR that is easy to approve. Be a strict reviewer of the user's diff — report problems with file:line, not vague advice.

1. Scope the diff

git status --short                       # uncommitted work? ask whether to include it
git fetch origin --quiet
git log --oneline origin/main..HEAD      # commits that will be in the PR (adjust base)
git diff --stat origin/main...HEAD

Use the repo's real default branch (gh repo view --json defaultBranchRef -q .defaultBranchRef.name). If the branch is behind base by many commits, recommend rebasing/merging first — reviewing a stale diff wastes time.

2. Run the automated scan

python <skill-dir>/scripts/diff_risk.py                 # auto-detects base (origin/HEAD, main, master)
python <skill-dir>/scripts/diff_risk.py --base origin/develop --worktree   # include uncommitted edits
python <skill-dir>/scripts/diff_risk.py --staged --strict                  # pre-commit style, exit 1 on blockers

It flags: conflict markers, focused tests (.only, fit), secrets/private keys, committed .env, debugger/console.log/debug prints, skipped tests, swallowed exceptions, disabled TLS verification, TODOs, commented-out code, binary files, migrations, lockfile drift, CI/auth/payment paths, PR size, and "source changed but no tests changed".

Every BLOCKER must be fixed before the PR. Triage each WARN: fix, or justify in the PR description.

3. Manual review (read the full diff: git diff origin/main...HEAD)

Go file by file, hotspots first. For each, check:

Correctness

  • Edge cases: empty/null/zero, max sizes, unicode, timezones/DST, concurrent calls, retries (idempotent?).
  • Error paths: errors propagated with context, not swallowed; resources closed (files, connections, locks) on every path.
  • Behaviour change for existing callers? Search usages: git grep -n "<changed function>".
  • Off-by-one, inverted conditions, wrong variable copied from a similar block.

Tests

  • New behaviour has a test that would fail without the change. Bug fix has a regression test.
  • Tests assert outcomes, not implementation details; no sleeps/time-dependence (see flaky-test-triage).
  • Run the targeted tests now and report the result.

Security & data

  • User input reaches SQL/shell/HTML/paths only through parameterization/escaping.
  • Authorization checked on new endpoints/actions (not just authentication).
  • No secrets, tokens, PII in code, logs, error messages, or fixtures.

Operability

  • Migrations are backward compatible with the currently deployed code (see sql-migration-safety).
  • New config/env vars documented, with safe defaults; feature flag if risky.
  • Logging/metrics sufficient to debug this in production; no log spam in hot loops.
  • Performance: no N+1 queries, unbounded loops/collections, or sync I/O on hot paths.

Hygiene

  • No unrelated changes (formatting churn, drive-by refactors) — split them out.
  • Names say what things are; public APIs/docs/README updated; CHANGELOG entry if the project keeps one.
  • Commit history is reviewable (squash "fix typo" commits if the project prefers clean history).

4. Report to the user

## Self-review: <branch> → <base>
**Verdict:** Ready / Ready after fixes / Not ready
**Blockers (must fix)**
1. `src/api/users.ts:88` — `.only` on describe block disables the rest of the suite.
**Should fix**
1. `src/db/repo.py:142` — exception swallowed; callers can't distinguish "not found" from DB outage.
**Nits (optional)**
- …
**Tests run:** `pytest tests/test_users.py` → 14 passed

Offer to apply the fixes; do not silently change code beyond what the user asked.

5. PR description template

## What
<1–3 sentences: the change, in user/system terms>

## Why
<problem, link to issue: Closes #123>

## How
<key design decisions, alternatives rejected, anything surprising>

## Risk & rollout
- Risk: low/medium/high — <why>
- Migration/flags/config: <none | details>
- Rollback: <revert-safe? data changes?>

## Testing
- [x] Unit: `<command>`
- [x] Manual: <steps + result>

## Screenshots / output
<if UI or CLI output changed>

Create it with gh pr create --draft --title "..." --body-file pr.md only if the user asks.

Individual skills in this repo

This repo contains 2 individual skills — each has its own dedicated page.

Related Skills