npx skills add ...
npx skills add warpdotdev/common-skills --skill review-pr
Review a pull request diff and write structured feedback to review.json for the workflow to publish. Use when reviewing a checked-out PR from local artifacts like pr_diff.txt and pr_description.txt and producing machine-readable review output instead of posting directly to GitHub.
npx skills add warpdotdev/common-skills --skill review-pr
Review the current pull request and write the output to review.json.
pr_diff.txt.pr_description.txt.spec_context.md exists, it contains spec context for implementation-vs-spec validation..agents/skills/review-pr/scripts/resolve_spec_context.py, use that script to materialize spec_context.md on demand instead of expecting spec content to be embedded in the prompt.security-review-pr companion skill or the prompt requests a security pass, apply it as supplemental guidance on code PRs and fold any security findings into the same review.json rather than emitting a separate output.spec_context.md exists, use the repository's local check-impl-against-spec skill if available and treat material spec drift as a review concern.body instead of an inline comment.Before reviewing, actively check whether the consuming repository ships a companion review-pr-local skill that specializes this one for its own conventions: if the prompt names one, read it there; otherwise look for one in the repository itself (for example, at .agents/skills/review-pr-local/SKILL.md, though a repository may place or name its specialization differently). If a companion exists, read it and apply its guidance as part of this review. If none turns up either way, rely on the core contract alone.
The companion is expected to specialize this skill's commenting and testing guidance with the repository's own conventions. It may never change the output JSON schema, the severity labels, the safety rules, the evidence rules, the suggestion-block constraints, or the diff-line-annotation contract described elsewhere in this skill.
The diff file uses these prefixes:
[OLD:n] for deleted lines on the old side. Use "LEFT".[NEW:n] for added lines on the new side. Use "RIGHT".[OLD:n,NEW:m] for unchanged context. Use "RIGHT" with line m.Treat these annotations as the only source of truth for inline comment locations. For every inline comment you emit, first identify the exact annotated line in pr_diff.txt (or the inlined PR diff) and copy its path, side, and line number into review.json. Do not infer line numbers from prose, rendered GitHub views, file lengths, surrounding spec text, or unannotated snippets. If you cannot point to a specific [NEW:n], [OLD:n], or [OLD:n,NEW:m] line in the annotated diff, put the feedback in top-level body instead of comments.
Every comment body must start with one of these labels:
๐จ [CRITICAL] for bugs, security issues, crashes, or data loss.โ ๏ธ [IMPORTANT] for logic problems, edge cases, or missing error handling.๐ก [SUGGESTION] for worthwhile improvements or better patterns.๐งน [NIT] for cleanup only when the comment includes a suggestion block.A confirmed violation of the repository's commenting or testing guidelines can warrant โ ๏ธ [IMPORTANT] on its own โ regardless of how clean the rest of the PR is. Do not default these to ๐งน [NIT]/๐ก [SUGGESTION] just because the surrounding code looks good.
Write comments with these constraints:
body instead of comments.path, side, line, and optional start_line/start_side correspond to real annotations in the same file's diff section.When proposing a code change, use:
Rules:
start_lineโline inclusive. Every line inside the block becomes the new file content for that range, and GitHub leaves all other lines untouched.start_line and below line remain in the file; repeating them inside the block causes them to appear twice after the suggestion is committed.start_line, and never close the block with a line that already appears immediately below line. If you need those lines as anchors, widen start_line or line so they are actually part of the replaced range.{, [, (, end, etc.) across the original replaced lines and ensure the replacement ends at the same depth. Do not emit phantom closing tokens, and do not drop required ones.start_line/line to include enough real lines from the diff rather than guessing at surrounding tokens.start_line and start_side to the first line, and line and side to the last line.Create review.json with this shape:
Field rules:
verdict is required and must be exactly the string "APPROVE" or "REJECT" (uppercase). Map your final recommendation as: Approve or Approve with nits โ "APPROVE"; Request changes โ "REJECT". The verdict and the human-readable recommendation in top-level body must agree.body is the GitHub review body and is required. Use body, not summary, for the review overview and final recommendation.comments is required and must be an array. Use an empty array when there are no inline comments.path must be relative to the repository root.line is required and must target the correct side.start_line is optional and only for multi-line ranges. When start_line is present, start_side is required and must be "LEFT" or "RIGHT".side must be "LEFT" or "RIGHT".The top-level body must include:
Found: X critical, Y important, Z suggestions.Approve, Approve with nits, or Request changes. This recommendation must match the top-level verdict field (Approve / Approve with nits โ "APPROVE"; Request changes โ "REJECT").Before drafting the top-level body or choosing verdict, complete this audit โ a holistic read-through of the diff is not sufficient.
Before returning or uploading review.json:
review.json and rerun it. Do not return or upload review.json until this validator passes. If the script path is not present at that exact location, locate validate_review_json.py under the loaded review-pr skill directory and run that copy with the same arguments.gh pr review, gh pr comment, gh api, or any other command that posts to GitHub.Your only output is the final review.json.