madDegen's picture
add pr-review skill
bf2623a verified
|
Raw
History Blame Contribute Delete
4.24 kB
metadata
name: github-pr-review
description: >
  This skill should be used when the user asks to "review this PR", "review
  before I merge", "is this safe to merge", "check this pull request", "code
  review", pastes a GitHub PR URL, or asks for a merge gate / pre-merge check.
  Also triggers on "review the diff", "audit this change", "any bugs in this
  PR", and requests to post review comments on GitHub.
metadata:
  version: 0.1.0

PR Review + Merge Gate

Produce a review that catches real defects and posts them as line comments on GitHub β€” not a summary of what the diff does.

Gather before judging

  1. pull_request_read for metadata: base branch, head SHA, author, mergeable state, requested reviewers.
  2. Pull the diff. For anything over ~15 files, clone the repo into the session workspace and diff locally instead of paging the API.
  3. Check CI first. A red build makes most of the review moot β€” report the failure and stop unless the user wants the review anyway.
  4. Read the PR body against the repo's template. A missing test plan is itself a finding.

Review dimensions

Run every dimension. Do not stop at the first finding.

Correctness β€” off-by-one, null/undefined paths, unhandled promise rejections, wrong operator precedence, timezone and float arithmetic, missing early returns, state mutated during iteration.

Security β€” injection (SQL, command, prompt), missing authz on a new endpoint, secrets committed in plaintext, overly permissive CORS, unvalidated user input reaching a query or file path, dependency added with a known CVE, dangerouslySetInnerHTML.

Data layer (Supabase/Postgres) β€” N+1 query patterns, missing index on a new filter column, RLS policy absent on a new table, migration without a rollback path, select * in a hot path, missing transaction around multi-write.

Solidity (pair with solidity-foundry) β€” reentrancy, unchecked external call return, missing access modifier, integer truncation on casts, oracle staleness not validated, unbounded loop over storage, tx.origin used for auth, missing event on state change, upgrade-unsafe storage layout change.

Frontend (React/TS) β€” missing dependency in a hook array, state derived in render without memo on an expensive path, any escaping a public type boundary, uncontrolled re-renders from an inline object prop, missing error boundary on a new route.

Tests β€” new behavior with no test, test that asserts the mock instead of the behavior, deleted test with no replacement, flake risk from timing or ordering assumptions.

Severity, and what earns each level

Level Bar Merge
Blocking Reproducible incorrect behavior, security hole, or data loss. State the concrete input β†’ wrong output. No
Should fix Real defect with narrow blast radius, or a missing test on new logic. Author's call
Note Style, naming, minor simplification. Yes

If a finding cannot be expressed as "input X produces wrong result Y", it is a Note at most. Do not inflate.

Posting to GitHub

Use the pending-review flow so all comments land as one review, not fifteen notifications:

  1. pull_request_review_write with method create β€” opens a pending review.
  2. add_comment_to_pending_review per finding, anchored to file and line, each stating the defect and the fix.
  3. pull_request_review_write with method submit_pending β€” event REQUEST_CHANGES if anything is Blocking, otherwise COMMENT.

Never APPROVE on the user's behalf unless they explicitly ask for an approval.

Verify before posting

For each Blocking finding, try to refute it before it goes on the record. Re-read the surrounding code for a guard you may have missed, check whether a caller already validates the input, and confirm the line numbers match the current head SHA. Drop anything that survives on vibes alone. A confidently wrong blocking comment costs more credibility than a missed nit.

Output to the user

Lead with the verdict β€” Merge / Merge after fixes / Do not merge β€” then findings, most severe first, each with file:line and the concrete failure. Close with the review URL. No recap of what the PR does; the author wrote it.