一键导入
code-review-github
Use when perform code review for GitHub pull requests and post findings as PR comments plus a non-technical summary to every linked issue
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when perform code review for GitHub pull requests and post findings as PR comments plus a non-technical summary to every linked issue
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when reviewing HTTP API design in a PR or change set — endpoints, routes, HTTP methods, status codes, idempotency, and input validation. Treats the API as a consumer-facing contract and flags resource-orientation, method-semantics, status-code, and trust-boundary violations. Read-only.
Use when checking that the pull request implementation actually fulfills the business requirements stated in the linked issue or task. Returns a plain-language markdown block that is the Functional review half of the two-part CR output (`@rules/code-review/general.mdc` Two-part CR output — Technical & Functional review): a full checklist of every extracted acceptance criterion with its status (Met / Not met / Partial / Divergent) and an explicit Goal met: Yes/No verdict, rendered on every run that has a linked tracker — including the fully affirmative report when every requirement is satisfied. No local file is created and the block is not embedded in the GitHub PR comment.
Use when run code review for a Bugsnag error and publish results to the linked GitHub PR and the Bugsnag error
Use when run code review for JIRA issues and publish results to GitHub PR and JIRA
Use when senior PHP code review focused on architecture, business logic, and risk detection. Read-only.
Use when summarizing current PR changes for the development and product team. Analyzes all commits in the current branch, explains the purpose of changes, and produces a clear human-readable report that can be posted either as a GitHub PR comment (Markdown) or as a JIRA comment (Wiki Markup).
| name | code-review-github |
| description | Use when perform code review for GitHub pull requests and post findings as PR comments plus a non-technical summary to every linked issue |
| license | MIT |
| metadata | {"author":"Petr Král (pekral.cz)"} |
Run a full code review for GitHub pull requests and publish findings directly to the PR.
@skills/pr-summary/SKILL.md for every closingIssues[] linked GitHub issue follows the language of the source assignment. Never mix languages inside the same comment; never use bilingual Kritické (Critical) style parentheses.git add, git commit, git push, git reset, git checkout -- …, etc.). Checking out the relevant branch and git pull to read the latest code are required (the mandatory Branch checkout gate below); mutating the working tree or pushing to the remote is not. Publishing is limited to PR / linked-issue comments via gh.skills/code-review-github/scripts/load-issue.sh <NUMBER|URL> — the single deterministic entry point. Never call gh issue view, gh pr view, or gh api /repos/.../issues/... directly. Read PR header, description, comments, commits, files, reviews, status checks, and closingIssues off the resulting JSON document.skills/code-review-github/scripts/gather-issue-context.sh <NUMBER|URL> instead of hand-assembling the JSON. To read only the comments as a structured array, use skills/code-review-github/scripts/parse-comments.sh <NUMBER|URL>. Both build on load-issue.sh, so the same exit codes and MCP fallback apply. Attachment content and the inventoried URLs are not fetched by the scripts — read them with your own tools when a finding depends on them.closingIssues[]) the same way — pass its number or URL to the same script.headRefName from the loaded JSON) and pull the latest commits — git fetch origin, git checkout <headRefName>, git pull — so the review always runs against the actual current codebase on disk (the checked-out working tree), never against the gh remote diff in isolation. Confirm local HEAD equals the PR head SHA from the loaded context. If the checkout fails (missing ref, detached HEAD, or local changes that would be overwritten), stop and report it instead of reviewing from the diff. Every sub-review then reads the checked-out files.Before reviewing code, load and analyze the full linked issue:
skills/code-review-github/scripts/load-issue.sh <NUMBER|URL> — description, all comments, and any referenced attachments or links come off the resulting JSON document.Every CR run is also a verification that the reviewer feedback already on the PR was actually carried out. After loading all PR comments, the next CR iteration must confirm that each reviewer's comment is satisfied by the current diff and that the applied change corresponds to what the reviewer asked for — not merely that no new Critical / Moderate findings appeared. This is the gate that closes the loop with @skills/process-code-review/SKILL.md: the previous round applies fixes, this gate verifies they match the instructions before the run can converge.
reviewThreads connection documented in @skills/process-code-review/SKILL.md (Load unresolved reviewer threads). Page until reviewThreads.pageInfo.hasNextPage == false and page each thread's comments the same way — a truncated list breaks the "every reviewer comment" guarantee. Include human reviewers and review bots; exclude this skill's own status posts (the <!-- cr-comment:… --> / <!-- cr-status:… --> marker bodies).LGTM, :+1:), and questions already answered in a later reply on the same thread. The remaining set is the reviewer instructions this PR must satisfy.file:line the instruction targets, the instruction in one sentence, and the four reproducer fields — Faulty Example (the current code that still violates the instruction), Expected Behavior (the state the reviewer asked for), Test Hint, Suggested Fix (the change that satisfies the instruction). A free-form reviewer instruction that implies no behavior change (naming, dead code, readability) carries the Suggested Fix only and may use n/a — <reason> for the snippet, mirroring the reproducer exemption in @skills/process-code-review/SKILL.md.reviewer comments: M/N fulfilled (M = fulfilled or rejected-with-reason, out of N actionable). When M == N the gate is clean; when M < N it has raised N − M Critical findings, so the run cannot converge until the next process-code-review round addresses them.statusCheckRollup[] in the loaded PR JSON, identify which checks ran on the PR head commit (headRefOid) and their result (state / conclusion). Pass this CI check map to the Coverage gate decision in @skills/code-review/SKILL.md (Validation → Coverage gate; the Reuse-CI-results detail now lives in @rules/code-review/general.mdc Validation & Coverage Gate) so only missing or non-green checks are run locally.Inline dispatch. Each sub-review below runs inline in this wrapper's context — invoke each skill directly (
@skills/<name>/SKILL.mdwith anyMODE=crflag), passing the PR URL / number and the branch already checked out, and declare the publishing contract for this CR run (quiet vs publish; see step 4). Each invoked skill must return its findings as the canonical markdown block (## Assignment Complianceblock, Critical / Moderate / Minor lists with reproducer fields, refactoring proposals). The CR wrapper then assembles the outputs into the final PR comment + linked-issue summary. Run the sub-reviews one at a time — do not dispatch them as parallel subagents.The mysql-problem-solver / race-condition-review / refactor-entry-point-to-action conditionals follow the same rule: when their trigger fires, invoke them inline after the always-run set, still one at a time.
Always run (inline, one at a time):
@rules/code-review/general.mdc Two-part CR output): non-technical, full acceptance-criteria checklist against the assignment. The skill does not publish anywhere itself — it returns either the assembled ## Assignment Compliance markdown block, rendered on every run that has a linked tracker (including the affirmative Goal met: Yes checklist on a clean run), or the status no linked issue — assignment compliance skipped (when closingIssues[] is empty). The CR wrapper passes the returned block as an embedded block to @skills/pr-summary/SKILL.md only when a block is returned so the linked-issue audience reads one consolidated comment per CR run (per issue #498) — on the skip status the wrapper embeds nothing and surfaces the status on the PR comment summary line. Do not embed the block into the PR comment — keep the PR comment focused on the Technical review and surface the consolidated-comment status in the summary line.@skills/code-review/SKILL.md Specialized Reviews → Always run; it is distinct from the per-Critical-finding verification (issue #537) and must not duplicate gaps already raised by assignment-compliance-check.MODE=cr — read-only refactoring lens scoped to the PR diff, run on every CR. The lens walks the skill's complete guideline set; every item it returns is rendered in the published PR comment, routed and de-duplicated per @rules/code-review/general.mdc Refactoring & Tech Debt (DRY) Analysis — diff-scoped detail. Canonical definition of the lens invocation lives in @skills/code-review/SKILL.md Specialized Reviews → Always run. MODE=cr guarantees no code changes, commits, fixers, or review chaining. Do not propose changes outside the diff.Run conditionally:
@rules/refactoring/general.mdc) → run the full refactoring skill set read-only. When the PR restructures existing code without adding a feature or changing observable behavior, additionally invoke @skills/refactor-entry-point-to-action/SKILL.md with MODE=cr to surface the entry-point → Action proposals. Both refactoring skills run read-only — no code changes, no commits, no fixers, no review chaining — MODE=cr enforces this. Fold their output into the Refactoring (DRY / Tech Debt Reduction) section (in-scope) and Refactoring Proposals section (out-of-scope) of the PR comment.@skills/mysql-problem-solver/SKILL.md is mandatory. Trigger pattern list is owned by @skills/code-review/SKILL.md Specialized Reviews (raw SQL, Eloquent / query-builder calls, eager loads, model scopes, ModelManager / Repository methods, migrations, seeders, DynamoDB / NoSQL access). Capture its findings and surface them in the published PR comment under the dedicated ## Database Analysis section (see Output Rules) — never silently fold them into the Critical / Moderate / Minor buckets.@skills/code-review/SKILL.md is executed for the diff@skills/class-refactoring/SKILL.md (run with MODE=cr — read-only), walking that skill's complete guideline set. The walked guidelines, the per-item routing, and the de-duplication + no-drop contract are owned by @rules/code-review/general.mdc Refactoring & Tech Debt (DRY) Analysis — diff-scoped detail — apply it as written; do not narrow the walk to a subset and do not restate the guideline list here. The duplicated-logic half of the walk runs through the reuse-first gate in @rules/code-review/general.mdc Reuse Existing Logic — first decide whether the new logic is necessary at all, then whether an existing implementation must be reused instead of a parallel one.Quiet mode (loop iterations from
@skills/process-code-review/SKILL.md): when the caller explicitly requests "do not publish; return findings as in-memory markdown for this loop iteration only", skip the entire Post Results step — do not post the PR comment, do not post the linked-issue summary. Return the assembled review markdown to the caller and stop. Only the very last (publishing) call fromprocess-code-reviewafter convergence runs Post Results in full.
<!-- cr-comment:actor=<gh-login> --> is still appended to the body for traceability (auto-appended by the helper), but it no longer drives an upsert lookup.skills/code-review-github/scripts/upsert-comment.sh <PR-NUMBER|URL> - (body on stdin). The helper detects the current actor (gh api user --jq .login), appends the marker, and POSTs a new comment. The published URL is emitted on stdout; the action (created) on stderr — log it in the PR comment summary line.addIssueComment — also as a fresh post. Never quote / reply to an earlier CR comment and never call updateIssueComment to edit one in place; the always-new-comment convention replaces the previous in-place edit flow.Critical → Moderate → Minor → Refactoring (DRY / Tech Debt Reduction)
Include file + line in the finding body
Include actionable fix
Post all findings inside the single PR comment — never as line-anchored review comments.
If no findings:
Summary line only. The Coverage: header line, the ## Coverage section, and the coverage … slot in the summary line are all dropped when every changed line is at 100% coverage and the tool ran successfully — only render them when the coverage gate produced uncovered changed lines (Critical findings) or unavailable / non-runnable coverage tooling (Critical finding). Omit every other section entirely. Do not append a "No findings identified" line — the Counts line Critical 0 · Moderate 0 · Minor 0 · Refactoring 0 already signals the clean state and the omitted sections confirm there is nothing to fix.closingIssues[] of the JSON loaded in step 1 to @skills/pr-summary/SKILL.md. This CR skill must not author its own non-technical template — the goal is a uniform "Authors / Available behind / Summary of changes / How to test" output across both trackers that non-technical project managers understand and can act on.pr-summary exactly once per linked issue. @skills/assignment-compliance-check/SKILL.md returns the Functional review block — the full acceptance-criteria checklist with a Goal met: Yes/No verdict — on every run that has a linked tracker, including the affirmative report when every criterion is Met; pass that block as an embedded block so pr-summary appends it verbatim after How to test and publishes one consolidated comment per CR run containing both the change summary and the Functional review verdict. Only when assignment-compliance-check returns the no linked issue — assignment compliance skipped status (no tracker to check against) does the wrapper skip passing an embedded block. The CR run posts exactly one comment per linked issue per run — never a separate gh issue comment for assignment compliance on top of it. Follow-up CR runs add new comments rather than editing prior ones, so the linked-issue thread keeps a chronological audit trail.pr-summary, pass through the PR author.login + commits[].author.login set and the git %an <%ae> log so the published summary credits the real change author(s), never the agent or the identity running this CR. pr-summary resolves and prints those identities in its Authors line — confirm the line is present in the published comment.pr-summary, also pass through any test-parameter gating detected in the diff (feature flag, ENV switch, query-string parameter, request header, admin toggle, allow-list) so the published summary carries the Available behind line and folds the toggle-enabling step into How to test step 1. When the diff contains no such gate, confirm with pr-summary that the line is omitted intentionally rather than forgotten.@skills/pr-summary/SKILL.md with the GitHub tracker target so it renders @skills/pr-summary/templates/pr-summary-github.md in GitHub Markdown and posts the comment via skills/code-review-github/scripts/upsert-comment.sh on every entry in closingIssues[] (one fresh comment per linked issue per CR run — marker <!-- cr-comment:actor=<gh-login> --> is appended for traceability but no in-place edit is performed). pr-summary mirrors the same format that @skills/code-review-jira/SKILL.md posts to JIRA, so reviewers reading either tracker see the same consolidated comment.pr-summary enforces the no-file-paths / no-line-numbers / no-code-snippets / no-severity-jargon contract by design; technical content stays exclusively on the PR comment. The embedded Assignment Compliance block follows the same constraint — it carries plain-language acceptance-criteria descriptions only.closingIssues[] is empty, skip this step and note "no linked issue — issue summary skipped" in the PR comment summary line. assignment-compliance-check returns the no linked issue — assignment compliance skipped status in that case so the wrapper does not even build an embedded block. When closingIssues[] is non-empty, assignment-compliance-check always returns the Functional review block — the affirmative Goal met: Yes checklist on a clean run, the gap checklist otherwise — so the wrapper always publishes the consolidated pr-summary comment with an embedded compliance block on every linked issue.Summary line are always rendered in the PR comment. The Coverage: header line, the ## Coverage section, and the coverage … slot in the summary line are all conditional — render them only when the coverage gate produced something to report (uncovered changed lines or unavailable / non-runnable tooling, both Critical findings). When every changed line is at 100% coverage and the tool ran successfully, drop all three coverage surfaces; the Counts line is the clean signal. Every other section — Findings (including each severity sub-heading), Refactoring (DRY / Tech Debt Reduction), Refactoring Proposals, and Database Analysis — appears only when it has at least one item. Never emit None. / Not applicable. / n/a / 100% placeholders for empty sections or omitted coverage surfaces; drop the whole heading and body instead. History across CR runs is preserved by the chronological sequence of always-new PR comments — never re-create a Previous CR Status section in the body.## Architecture section (issue #530). On Laravel projects (laravel/framework is in composer.json require), the architecture walk-through defined in @skills/code-review/SKILL.md Core Analysis runs on every CR run, but the ## Architecture heading is rendered only when the walk produces at least one finding. When findings exist, render the heading and list them. When the walk is clean, omit the heading entirely — never render a walked, 0 findings status line, a clean placeholder, or any other confirmation that the check ran. On non-Laravel projects, omit the ## Architecture section entirely.file:line and a concrete refactoring step.@rules/php/core-standards.mdc and, for Laravel projects, @rules/laravel/architecture.mdc. Use n/a — <reason> only when a snippet adds no value over the one-line Fix description (e.g. naming-only changes, dead-code removal, pointers to an existing helper whose name already says enough).@skills/process-code-review/SKILL.md can convert each finding into a reproducer test and apply the fix directly from the PR comment.@skills/code-review/SKILL.md Specialized Reviews), the posted PR comment must include a dedicated ## Database Analysis section before ## Coverage. The section reports only the mysql-problem-solver findings (with severity mirroring Critical / Moderate / Minor) and the proposed query rewrite / index reuse / batching fix per @rules/sql/optimalize.mdc. Do not include the queries / migrations inspected list or any EXPLAIN / static-analysis summary — those stay inside the internal investigation. When no DB operations are present, omit the section entirely.## Coverage section before the summary line only when the coverage gate has something to report — uncovered changed lines (Critical findings) or unavailable / non-runnable coverage tooling (Critical finding). When every changed line is at 100% coverage and the tool ran successfully, omit the ## Coverage section, the Coverage: header line, and the coverage … slot from the summary line per @skills/code-review/SKILL.md Output Rules. The coverage gate itself (per the Coverage gate in @skills/code-review/SKILL.md) still runs on every review; only the user-visible section is short-circuited.posted summary to issue #N (or comma-separated list when multiple), no linked issue — issue summary skipped, or failed to post on issue #N: <reason> when a permission / network error occurs. Never post a CR comment without it.reviewer comments: M/N fulfilled (or reviewer comments: none when the PR carries no actionable reviewer instruction). Each not-fulfilled instruction appears as its own Critical finding in the Findings section, so the Counts line and this verdict stay consistent.Use the template defined in templates/pr-comment-output.md.