← All skills

Engineering

Review to PRs

Audit a subsystem, file one issue per bug, then ship one small tested PR per fix that a reviewer can merge or revert on its own.

Skill
review-to-prs
Version
1.0.0
License
MIT
By
Christensen Equity · Austin Christensen
  • code-review
  • github
  • bugs
  • pull-requests
  • testing

Use this skill

Claude Code: install for your user

curl -fsSL --create-dirs -o ~/.claude/skills/review-to-prs/SKILL.md https://www.austinchristensen.tech/skills/review-to-prs/SKILL.md

Or download SKILL.md and drop it in .claude/skills/review-to-prs/ in a project, upload it in Claude.ai under Settings → Capabilities → Skills, or view the source.

When the agent uses it

Audit a module or subsystem for bugs, then ship the findings as GitHub issues plus one small, independently reviewable PR per fix, each with a regression test and its judgment calls flagged. Use when the user wants findings acted on, not just listed, as in "review the billing module and fix anything sketchy", "open issues for these bugs", "go through X and ship fixes", or "open PRs for all of these", including when they hand over a findings list. Covers detecting the repo's conventions, producing or accepting findings, filing issues with a tracking issue, and shipping scoped, locally verified PRs. Not for a single one-off edit, and not for a read-only review with no follow-up.

Review to PRs

Turn "review X and deal with what you find" into artifacts a human can actually review and merge: a set of issues, then one small PR per fix, each tested, verified locally, and honest about its assumptions.

The point is reviewability. A reviewer should be able to open any one PR, understand what it fixes and why, see that it is tested, and merge or revert it without untangling it from the others.

When to use

  • The user asks for an audit of an area and wants the results fixed or filed.
  • The user hands over a findings list and wants issues, PRs, or both.
  • Not for a quick one-line fix, and not for a review the user only wants to read.

Phases

Phase 0  Orient    learn this repo's conventions before touching anything
Phase 1  Findings  produce a findings list, or accept the user's
Phase 2  Issues    one issue per finding plus a tracking issue
Phase 3  Ship      one branch and PR per fix: scoped change, test, verify, flag

Enter at the right phase. Handed findings? Start at Phase 2. Asked only for issues? Stop after Phase 2. Don't redo work that is already done.

Two decisions to settle first

These shape everything downstream and belong to the user. Ask once, early, unless they already said:

  1. Granularity. One PR per finding (best isolation, recommended) or grouped by theme (fewer reviews, coarser reverts).
  2. Ambiguous fixes. When a fix hinges on a product or policy call (fail open or fail closed?), either implement the safest reading and flag it in the PR body (good default), skip it and leave the issue open, or pause and ask.

Workflow

Phase 0: Orient

Match the repo; never impose a house style. Run these and read the output:

git status --porcelain                         # commit or stash before branching
gh repo view --json nameWithOwner,defaultBranchRef
git branch -r | grep -iE 'origin/(preview|develop|staging|next)$'   # integration branch?
gh label list --limit 80                       # only these labels exist
gh issue list --state all --limit 12           # title prefix style, e.g. [P1]
git log --oneline -12                          # commit message style
gh run list --limit 6                          # is CI actually running and green?
ls CLAUDE.md AGENTS.md CONTRIBUTING.md .github/PULL_REQUEST_TEMPLATE.md 2>/dev/null

Also note the test, typecheck, and build commands (package.json scripts, pyproject.toml, Makefile), and open one recently merged PR to see the body style reviewers expect.

If CI is failing for non-code reasons or missing entirely, local tests and typecheck are the only safety net. Say so in every PR body. If gh is not authenticated, say so now; you can still branch and commit locally and write bodies to files, but don't silently skip the GitHub steps.

Phase 1: Findings

Read the subsystem's entry points, config, and call sites. Hunt the bug classes below. For each finding capture a one-line title, the exact file:line, why it is wrong (the input that breaks it and the bad outcome), the fix direction, and a severity (P0 to P3, or the repo's scheme).

A finding from reading code is a hypothesis. Where it is cheap, confirm it: trace the caller, check the schema, run the function. Mark anything unconfirmed as "needs confirmation".

High-yield bug classes

  1. Substring instead of word match. name.includes("art") also matches "Stuart" and "Martin". Look for .includes, indexOf, LIKE '%x%' on human-entered text.
  2. Fail open on missing data. if (!role) return true inside an authorization check. Deny paths should usually fail closed; warn paths may fail open.
  3. UTC versus local dates. new Date("2026-01-01").getFullYear() returns 2025 west of UTC. Test month and year boundaries.
  4. Divergent duplicates. The same rule (a list of free-email domains, a "business day" helper) implemented in three files with three slightly different answers. Fix by extracting one tested helper, as a follow-up.
  5. Caches that never expire. A module-level Map filled on first read, so settings edits don't apply until restart.
  6. Interpolation injection. User input in raw SQL, query filter strings, new RegExp(input), or shell commands.
  7. Silent fallback data. A catch block returns SAMPLE_PLAN that looks exactly like real data.
  8. Scope or tenant leaks. A list query missing its account_id bound, or ILIKE '%acme%' matching another customer's records.
  9. Guardrail bypass on a second path. Drafts are excluded on the main loader but not on the admin import path that feeds the same engine.
  10. Callers passing different inputs. The create path passes email to a validator; the update path passes null, so the rule only fires on create.
  11. Silent truncation. LIMIT 1000 or a default page size on an export, with no signal that rows were dropped.

Phase 2: Issues

File one issue per finding, then a tracking issue that links them all.

  • Titles mirror the repo's prefix style.
  • Labels only from gh label list. Unknown labels make gh issue create fail.
  • Bodies go to a file and use --body-file. Inline --body mangles backticks and $.

Issue body:

Found in a review of <subsystem> (<date>).

### Problem
<One paragraph.> Key code: `path/to/file.ts:NN`

### Why it's wrong
<The concrete input that breaks it and the bad outcome.>

### Fix
<Direction in 1-3 sentences, plus the regression test to add.>

Tracking issue: group a checklist of - [ ] #N title lines by priority, state what was not covered, and add a "Cross-cutting themes" section. "The same check exists three times; consolidating fixes #A, #B, and #C" is often the most valuable line in the review.

Phase 3: Ship one PR per fix

For each finding, in turn:

  1. Branch fresh off the base, never off the previous fix:
    git fetch origin <base> --quiet
    git checkout -b fix/<issue>-<slug> origin/<base> --no-track
    
    Fixes touching the same file will conflict at merge. That is expected; keep each edit narrow and note the overlap.
  2. Make the smallest change that fixes this finding, in the surrounding code's idiom. Leave adjacent problems for their own issue.
  3. Add a regression test that fails before and passes after, written in the existing test file's style, with its helpers and fixtures.
  4. For a judgment call, implement the safest reading and say so in the PR body. Never bury a policy decision inside a fix.
  5. Verify locally: the targeted tests plus typecheck or build. Never write "verified" without having run it.
  6. Commit, push, and open the PR against the base with Closes #N:
    gh pr create --base <base> --head fix/<issue>-<slug> --title "<title> (#N)" --body-file pr-N.md
    

PR body:

Closes #N.

### Problem
<The user-visible consequence, in 1-2 sentences.>

### Fix
<What changed and why the scope is right. Say if you kept it narrow on purpose.>

### Conservative notes   (judgment calls only)
<The assumption made and the alternative, so the reviewer approves it knowingly.>

### Tests
<The regression test and what it asserts.> `<command>`: N passed; typecheck clean.
<If CI is down: "CI not running (<reason>); verified locally.">

Report each PR as it lands. A maintainer wants the running tally, not silence followed by fourteen links.

Output

Finish with a compact table (issue, PR, one line on what it does), then list separately the judgment calls flagged for review, which PRs touch the same files with a suggested merge order, and anything you could not verify.

Guardrails

  • Branch every fix from origin/<base>. Stacked branches can't be reviewed or merged independently.
  • Use --body-file for every issue and PR body.
  • Apply only labels that already exist.
  • Never claim tests pass without running them, especially when CI is down.
  • Don't fold a big consolidation into a fix PR; file it as a follow-up.
  • Don't push, open issues, or open PRs in a repository the user didn't point you at.
  • If a hook or permission blocks a path (for example workflow files), split that change out and tell the user rather than fighting it.

Handoff

Use pr-description for any PR body that needs more care. When the fixes run in parallel agents, track them with coding-agent-handoff. If a finding already caused a production problem, write it up with incident-postmortem.