review-gh-pr

Fetches GitHub PR metadata, verifies HEAD, and resolves specification sources for review-pr.

1|1|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/williamthorsen/codeassembly --skill review-gh-pr-williamthorsen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: review-gh-pr
Source: https://github.com/williamthorsen/codeassembly/tree/main/packages/agents/content/skills/review-gh-pr
Command: npx skills add https://github.com/williamthorsen/codeassembly --skill review-gh-pr-williamthorsen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Reviewing a GitHub pull request requires gathering PR metadata, confirming the local checkout matches the PR head commit, and locating the authoritative specification (ticket or PR description). Doing this manually is slow and error-prone, and reviewing against a mismatched HEAD produces invalid findings. ## Core Features & Use Cases - Single-call PR metadata fetch: Retrieves number, title, body, URL, head/base refs, and closing issue references with one gh pr view invocation. - HEAD verification with hard stop: Compares local HEAD against the PR's head commit and exits with a copy-pasteable gh pr checkout fix command on mismatch. - Ticket resolution cascade: Resolves the specification source in a fixed order: explicit override, first closing issue reference, PR body issue-reference parsing, or PR description alone. - Use Case: An agent running the review-pr workflow invokes this delegate to prepare a resolved-input record (merge-base SHA, diff base, spec sources, PR metadata) that is passed directly to review-branch for the actual review. ## Quick Start Ask the agent to prepare the review inputs for pull request 1024 by fetching its metadata and resolving its linked ticket.

Frequently Asked Questions about review-gh-pr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch GitHub PR metadata with the gh CLI?

Run gh pr view with the --json flag listing all needed fields, such as number, title, body, headRefOid, baseRefName, and closingIssuesReferences. Fetching everything in one call avoids the latency and failure modes of repeated gh invocations.

How to verify local HEAD matches a pull request before review?

Compare git rev-parse HEAD against the PR's headRefOid from the metadata. On mismatch, stop immediately and instruct the user to run gh pr checkout with the PR number so the working tree matches the commit under review.

Does this skill run the code review itself?

No. It only prepares resolved inputs such as the merge-base SHA, diff base, and specification sources. The actual review logic, including diff analysis and finding generation, runs in review-branch after review-pr passes it the resolved record.

How is the specification ticket resolved for a pull request?

Resolution follows a fixed cascade: an explicit ticket override, then the first entry in closingIssuesReferences, then issue references parsed from the PR body (closes, fixes, resolves, or bare #n), and finally the PR description alone.

What happens when the PR head commit does not match local HEAD?

The process exits non-zero with an error showing both short SHAs and a literal gh pr checkout suggestion. It never proceeds with mismatched state because compilation and tests require the working tree to match the reviewed commit.