Automated PR code review skill that collects context, performs AI-powered analysis, and publishes structured reviews with inline comments...
Use this skill as the GitHub adapter for a code review. It collects pull
request context, applies the platform-neutral code-review contract when that
skill is available, and optionally maps validated findings to one GitHub
review. The normal delivery is the user-facing review brief; files are
exported only when the caller explicitly requests them.
gh CLI authentication is required when context must be collected or a
review must be published.code-reviewcode-review is the platform-neutral core. If it is enabled in the skill
catalog, read and follow it for the review inputs, evidence threshold, finding
shape, degradation behavior, and brief. This skill supplies the GitHub adapter
steps below.
If code-review is not available, use the same minimum contract here:
review changed hunks, verify candidates against surrounding code, require
concrete evidence, report coverage and limitations, and do not publish
unlocatable or speculative high-severity findings. Do not fetch or install a
remote skill during a review just to satisfy this optional composition.
Prefer context already supplied by the caller. When a manifest is supplied,
use its artifact entries (id, path, status, and description) rather
than assuming fixed filenames or directories. Preserve the available
repository/path instruction metadata in the review coverage.
If the required context is not supplied, collect it with gh:
gh pr view <pr_number> --repo <owner/repo> --json number,title,body,state,url,baseRefName,headRefName,headRefOid,author,createdAt,updatedAt,mergeable,reviews,changedFiles,additions,deletions
gh pr view <pr_number> --repo <owner/repo> --json files
gh pr diff <pr_number> --repo <owner/repo>
gh api repos/<owner>/<repo>/issues/<pr_number>/comments --paginate
gh api graphql -f query='
query($owner:String!, $repo:String!, $number:Int!) {
repository(owner:$owner, name:$repo) {
pullRequest(number:$number) {
reviewThreads(first:100) {
nodes {
isResolved
comments(first:100) {
nodes { id body path line author { login } }
}
}
}
}
}
}' -F owner=<owner> -F repo=<repo> -F number=<pr_number>
Normalize collected data into the code-review inputs:
change_set: PR metadata, changed files, diff, base ref, and head SHAbaseline: relevant repository code and configurationproject_instructions: caller-provided repository/path instructionsprior_feedback: existing reviews, comments, and review threadsverification_budget: focused checks available in the checkoutDo not discover or match repository instruction files inside this adapter when the caller/runtime supplies instruction context. If that context is absent, state the coverage limitation rather than assuming there are no instructions.
Follow code-review's scope, priority, candidate verification, classification,
and degradation rules. Review every changed file and materially changed hunk
before concluding that there are no findings.
Validate findings independently of whether GitHub can publish them inline. For each actionable finding, require:
severity, confidence, and categoryAfter validation, perform an explicit inline-localization pass for every open finding:
Do not attach findings to an arbitrary line. Do not demote a validated finding
to needs-context, lower its severity or confidence, or omit it solely because
it is not inline-eligible.
Always provide a conclusion-first user-facing brief with:
needs-context findings, and findings skipped by deduplication or a capOnly when the caller explicitly provides an artifact directory and requests exports, write:
review.md: human-readable review reportreview-result.json: the platform-neutral structured resultreview-publish.json: the GitHub publish receipt and the publication counts
above, if a publish was attemptedDo not require or create summary.md, manifest.json, or any other fixed
review output file. Do not require GITHUB_OUTPUT_DIR,
REVIEW_OUTPUT_DIR, or another environment variable; if a caller explicitly
provides an export directory through prompt/context, use that directory.
Publishing is optional and must be explicitly requested by the caller. A review may be delivered without publishing.
headRefOid immediately before publishing.Use a JSON payload file with gh api:
gh api repos/<owner>/<repo>/pulls/<pr_number>/reviews -X POST --input <review-payload.json>
When publishing a review, include validated inline-eligible findings as inline
comments by default. The caller may explicitly request a body-only review or
set MAX_INLINE=0. Put body-only findings in the review body, and when a cap
excludes an otherwise eligible finding, keep it in the body and report that it
was capped rather than unlocatable.
The caller may select:
DRY_RUN=true: prepare and show the proposed review without publishingMAX_INLINE=N: cap the number of inline commentsPOST_EMPTY=true: allow publishing a review with no findingsThese options affect the adapter only; they do not weaken the evidence,
coverage, deduplication, or degradation rules in code-review.