add pr-review skill
Browse files
plugin/skills/github-pr-review/SKILL.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: github-pr-review
|
| 3 |
+
description: >
|
| 4 |
+
This skill should be used when the user asks to "review this PR", "review before I merge",
|
| 5 |
+
"is this safe to merge", "check this pull request", "code review", pastes a GitHub PR URL,
|
| 6 |
+
or asks for a merge gate / pre-merge check. Also triggers on "review the diff", "audit this
|
| 7 |
+
change", "any bugs in this PR", and requests to post review comments on GitHub.
|
| 8 |
+
metadata:
|
| 9 |
+
version: "0.1.0"
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# PR Review + Merge Gate
|
| 13 |
+
|
| 14 |
+
Produce a review that catches real defects and posts them as line comments on GitHub β not a summary of what the diff does.
|
| 15 |
+
|
| 16 |
+
## Gather before judging
|
| 17 |
+
|
| 18 |
+
1. `pull_request_read` for metadata: base branch, head SHA, author, mergeable state, requested reviewers.
|
| 19 |
+
2. Pull the diff. For anything over ~15 files, clone the repo into the session workspace and diff locally instead of paging the API.
|
| 20 |
+
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.
|
| 21 |
+
4. Read the PR body against the repo's template. A missing test plan is itself a finding.
|
| 22 |
+
|
| 23 |
+
## Review dimensions
|
| 24 |
+
|
| 25 |
+
Run every dimension. Do not stop at the first finding.
|
| 26 |
+
|
| 27 |
+
**Correctness** β off-by-one, null/undefined paths, unhandled promise rejections, wrong operator precedence, timezone and float arithmetic, missing early returns, state mutated during iteration.
|
| 28 |
+
|
| 29 |
+
**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`.
|
| 30 |
+
|
| 31 |
+
**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.
|
| 32 |
+
|
| 33 |
+
**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.
|
| 34 |
+
|
| 35 |
+
**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.
|
| 36 |
+
|
| 37 |
+
**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.
|
| 38 |
+
|
| 39 |
+
## Severity, and what earns each level
|
| 40 |
+
|
| 41 |
+
| Level | Bar | Merge |
|
| 42 |
+
|---|---|---|
|
| 43 |
+
| **Blocking** | Reproducible incorrect behavior, security hole, or data loss. State the concrete input β wrong output. | No |
|
| 44 |
+
| **Should fix** | Real defect with narrow blast radius, or a missing test on new logic. | Author's call |
|
| 45 |
+
| **Note** | Style, naming, minor simplification. | Yes |
|
| 46 |
+
|
| 47 |
+
If a finding cannot be expressed as "input X produces wrong result Y", it is a Note at most. Do not inflate.
|
| 48 |
+
|
| 49 |
+
## Posting to GitHub
|
| 50 |
+
|
| 51 |
+
Use the pending-review flow so all comments land as one review, not fifteen notifications:
|
| 52 |
+
|
| 53 |
+
1. `pull_request_review_write` with method `create` β opens a pending review.
|
| 54 |
+
2. `add_comment_to_pending_review` per finding, anchored to file and line, each stating the defect and the fix.
|
| 55 |
+
3. `pull_request_review_write` with method `submit_pending` β event `REQUEST_CHANGES` if anything is Blocking, otherwise `COMMENT`.
|
| 56 |
+
|
| 57 |
+
Never `APPROVE` on the user's behalf unless they explicitly ask for an approval.
|
| 58 |
+
|
| 59 |
+
## Verify before posting
|
| 60 |
+
|
| 61 |
+
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.
|
| 62 |
+
|
| 63 |
+
## Output to the user
|
| 64 |
+
|
| 65 |
+
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.
|