Code review github
PHP and Laravel Cursor rules — coding standards, testing, and conventions for the Cursor editor. Install via Composer.
npx -y skills add pekral/cursor-rules --skill code-review-githubAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 5 stars5 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use when perform code review for GitHub pull requests and post findings as PR comments plus a non-technical summary to every linked issue
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
26.6 KB, as published. Nobody here has run it
Code Review (GitHub)
Purpose
Run a full code review for GitHub pull requests and publish findings directly to the PR.
Constraints
- Apply @rules/git/general.mdc
- Apply @rules/reports/general.mdc. The technical CR PR comment this skill posts on the GitHub PR (Status / Counts / Findings / Refactoring / Coverage / Summary) stays in canonical English per the rule's Exception — technical CR findings on the GitHub PR. The non-technical mirror delegated to
@skills/pr-summary/SKILL.mdfor everyclosingIssues[]linked GitHub issue follows the language of the source assignment. Never mix languages inside the same comment; never use bilingual Kritické (Critical) style parentheses. - Read-only skill — never modify code, never stage / commit / push changes, and never run any git write operation (
git add,git commit,git push,git reset,git checkout -- …, etc.). Checking out the relevant branch andgit pullto 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 viagh. - Output findings only (no praise)
Execution
1. Load Context
- Load PR context by running
skills/code-review-github/scripts/load-issue.sh <NUMBER|URL>— the single deterministic entry point. Never callgh issue view,gh pr view, orgh api /repos/.../issues/...directly. Read PR header, description, comments, commits, files, reviews, status checks, andclosingIssuesoff the resulting JSON document. - For a single ready-to-read context brief — the issue/PR plus its body, comments, changed files, commits, reviews, CI checks, recursively-loaded linked issues/PRs, and an inventory of external URLs, rendered as Markdown — run
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, useskills/code-review-github/scripts/parse-comments.sh <NUMBER|URL>. Both build onload-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. - Load each linked issue (from
closingIssues[]) the same way — pass its number or URL to the same script. - If the script is unavailable (missing tool, exit code 2/3) fall back to the GitHub MCP server. Always prefer the MCP fallback for data the script cannot cover: review-thread / line-anchored comments, per-commit check runs, and binary attachment contents.
- If multiple PRs exist for one issue, review each independently
- Branch checkout gate (mandatory, always). Before running any review step, check out the PR branch (
headRefNamefrom 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 theghremote diff in isolation. Confirm localHEADequals the PR head SHA from the loaded context. If the checkout fails (missing ref, detachedHEAD, 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.
Issue Context Analysis
Before reviewing code, load and analyze the full linked issue:
- Fetch the complete GitHub issue via
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. - Extract from the issue:
- Requirements and acceptance criteria — what the code must do
- Expected behavior — how the feature or fix should work
- Edge cases and constraints — mentioned by the reporter or in comments
- Test data — any sample inputs, payloads, or scenarios provided in the issue
- Use this context to evaluate whether the implementation fully satisfies the issue — not just whether the code is technically correct.
- If the issue contains test data or test scenarios, verify they are covered by existing or new tests. Flag missing test coverage as a finding.
Reviewer Comment Fulfillment Gate (mandatory)
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.
- Load every reviewer comment. Read the PR's general comments and review summaries off the JSON loaded in step 1, and fetch the line-anchored review threads (resolved and unresolved) with the GraphQL
reviewThreadsconnection documented in@skills/process-code-review/SKILL.md(Load unresolved reviewer threads). Page untilreviewThreads.pageInfo.hasNextPage == falseand page each thread'scommentsthe 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). - Keep only actionable instructions. Discard greetings, plain approvals (
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. - Verify each instruction against the checked-out diff. For every instruction, read the code path it targets on the checked-out branch and classify it:
- Fulfilled — the current diff implements exactly what the reviewer asked; the corresponding review thread is resolved or ready to be resolved.
- Not fulfilled — no change implements the instruction, or the change does not match what was asked (partial fix, wrong target, or a different change that does not satisfy the reviewer's intent).
- Rejected / deferred with a recorded reason — the PR author replied on the thread (or the PR description states) why the instruction is not applied; treat as resolved for this gate and carry the reason into the summary, do not raise a finding.
- Raise one finding per not-fulfilled instruction. Severity Critical (the PR carries unaddressed review feedback). Cite the reviewer comment URL, the
file:linethe 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 usen/a — <reason>for the snippet, mirroring the reproducer exemption in@skills/process-code-review/SKILL.md. - Record the fulfillment verdict on the summary line:
reviewer comments: M/N fulfilled(M = fulfilled or rejected-with-reason, out of N actionable). WhenM == Nthe gate is clean; whenM < Nit has raisedN − MCritical findings, so the run cannot converge until the nextprocess-code-reviewround addresses them.
2. Pre-checks
- CI coverage of checks. From the
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.mdcValidation & Coverage Gate) so only missing or non-green checks are run locally. - If PR has merge conflicts → cancel review
3. Run Reviews
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):
- @skills/assignment-compliance-check/SKILL.md — builds the Functional review (
@rules/code-review/general.mdcTwo-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 Compliancemarkdown block, rendered on every run that has a linked tracker (including the affirmativeGoal met: Yeschecklist on a clean run), or the statusno linked issue — assignment compliance skipped(whenclosingIssues[]is empty). The CR wrapper passes the returned block as an embedded block to@skills/pr-summary/SKILL.mdonly 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
- @skills/analyze-problem/SKILL.md — always run, scoped to assignment conformance, invoked inline and read-only (analysis-only — no plan artifact, no code / git writes). Compares the loaded issue requirements / acceptance criteria / expected behavior against what the PR diff actually implements and raises every unmet requirement as a Critical finding with reproducer fields. Canonical definition lives in
@skills/code-review/SKILL.mdSpecialized Reviews → Always run; it is distinct from the per-Critical-finding verification (issue #537) and must not duplicate gaps already raised byassignment-compliance-check. - @skills/security-review/SKILL.md
- @skills/class-refactoring/SKILL.md with
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.mdcRefactoring & Tech Debt (DRY) Analysis — diff-scoped detail. Canonical definition of the lens invocation lives in@skills/code-review/SKILL.mdSpecialized Reviews → Always run.MODE=crguarantees no code changes, commits, fixers, or review chaining. Do not propose changes outside the diff.
- @skills/assignment-compliance-check/SKILL.md — builds the Functional review (
-
Run conditionally:
- Diff is a refactoring (behavior-preserving structural change per
@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.mdwithMODE=crto surface the entry-point → Action proposals. Both refactoring skills run read-only — no code changes, no commits, no fixers, no review chaining —MODE=crenforces 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. - Database operations detected in the diff →
@skills/mysql-problem-solver/SKILL.mdis mandatory. Trigger pattern list is owned by@skills/code-review/SKILL.mdSpecialized 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 Analysissection (see Output Rules) — never silently fold them into the Critical / Moderate / Minor buckets. - Shared state → @skills/race-condition-review/SKILL.md
- Third-party API or service changes → ensure the Third-Party API & Service Analysis step from
@skills/code-review/SKILL.mdis executed for the diff
- Diff is a refactoring (behavior-preserving structural change per
Refactoring & Tech Debt (DRY) Analysis (PR diff only)
- Restrict the analysis to lines added or modified in the PR — never review untouched code.
- For each changed block, apply
@skills/class-refactoring/SKILL.md(run withMODE=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.mdcRefactoring & 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.mdcReuse 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. - Each finding must include the file path, the affected line range, a concrete refactoring that reduces tech debt, and the guideline it matched.
- In-scope refactorings go into the Refactoring (DRY / Tech Debt Reduction) section of the PR comment template. Out-of-scope structural problems still belong in Refactoring Proposals; an item whose underlying rule declares a severity goes to that Critical / Moderate / Minor bucket instead, with the four reproducer fields.
4. Post Results
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.
Always-new comment (per CR run)
- Every CR run posts a fresh PR comment. The helper never edits a prior comment in place — each run produces its own self-contained entry so reviewers see one comment per run, in chronological order. The hidden marker
<!-- 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. - Publish via
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. - If the helper exits with code 2 (missing tool) or 3 (API failure), fall back to the GitHub MCP server's
addIssueComment— also as a fresh post. Never quote / reply to an earlier CR comment and never callupdateIssueCommentto edit one in place; the always-new-comment convention replaces the previous in-place edit flow.
Format
-
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:
- post the header block (Status / Counts / Last updated / Issue tracker summary) and the final
Summaryline only. TheCoverage:header line, the## Coveragesection, and thecoverage …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 lineCritical 0 · Moderate 0 · Minor 0 · Refactoring 0already signals the clean state and the omitted sections confirm there is nothing to fix.
- post the header block (Status / Counts / Last updated / Issue tracker summary) and the final
Linked-issue consolidated summary (mandatory — single comment per linked issue)
- After posting the PR comment, delegate the single consolidated summary on every linked issue listed in
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. - Consolidation contract (issue #498): invoke
pr-summaryexactly once per linked issue.@skills/assignment-compliance-check/SKILL.mdreturns the Functional review block — the full acceptance-criteria checklist with aGoal met: Yes/Noverdict — on every run that has a linked tracker, including the affirmative report when every criterion is Met; pass that block as an embedded block sopr-summaryappends it verbatim afterHow to testand publishes one consolidated comment per CR run containing both the change summary and the Functional review verdict. Only whenassignment-compliance-checkreturns theno linked issue — assignment compliance skippedstatus (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 separategh issue commentfor 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. - When invoking
pr-summary, pass through the PRauthor.login+commits[].author.loginset 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-summaryresolves and prints those identities in itsAuthorsline — confirm the line is present in the published comment. - When invoking
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 theAvailable behindline and folds the toggle-enabling step intoHow to teststep 1. When the diff contains no such gate, confirm withpr-summarythat the line is omitted intentionally rather than forgotten. - Invoke
@skills/pr-summary/SKILL.mdwith the GitHub tracker target so it renders@skills/pr-summary/templates/pr-summary-github.mdin GitHub Markdown and posts the comment viaskills/code-review-github/scripts/upsert-comment.shon every entry inclosingIssues[](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-summarymirrors the same format that@skills/code-review-jira/SKILL.mdposts to JIRA, so reviewers reading either tracker see the same consolidated comment. pr-summaryenforces 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 embeddedAssignment Complianceblock follows the same constraint — it carries plain-language acceptance-criteria descriptions only.- If
closingIssues[]is empty, skip this step and note "no linked issue — issue summary skipped" in the PR comment summary line.assignment-compliance-checkreturns theno linked issue — assignment compliance skippedstatus in that case so the wrapper does not even build an embedded block. WhenclosingIssues[]is non-empty,assignment-compliance-checkalways returns the Functional review block — the affirmativeGoal met: Yeschecklist on a clean run, the gap checklist otherwise — so the wrapper always publishes the consolidatedpr-summarycomment with an embedded compliance block on every linked issue. - If the upsert helper or the GitHub MCP fallback returns a permission error (cross-repo issue, lacking write access), log the failure in the PR comment summary line and continue — do not abort the review.
- For follow-up reviews, the helper posts a new linked-issue comment instead of editing the prior one. The "one consolidated comment per CR run" rule applies per run — each run adds a fresh comment so the linked-issue thread carries the full chronological history of CR outputs. Old comments authored before this convention was introduced are left in place untouched.
Output Rules
- Findings only
- No praise
- No “what was checked”
- Omit empty sections entirely. Only the header block (Status / Counts / Last updated / Issue tracker summary) and the final
Summaryline are always rendered in the PR comment. TheCoverage:header line, the## Coveragesection, and thecoverage …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, andDatabase Analysis— appears only when it has at least one item. Never emitNone./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 aPrevious CR Statussection in the body. ## Architecturesection (issue #530). On Laravel projects (laravel/frameworkis incomposer.jsonrequire), the architecture walk-through defined in@skills/code-review/SKILL.mdCore Analysis runs on every CR run, but the## Architectureheading 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 awalked, 0 findingsstatus line, acleanplaceholder, or any other confirmation that the check ran. On non-Laravel projects, omit the## Architecturesection entirely.- Use exactly three severity levels: Critical, Moderate, Minor
- Add a Refactoring (DRY / Tech Debt Reduction) section after the Minor findings whenever the diff contains in-scope tech-debt-reducing changes (DRY duplication, oversized methods, mixed responsibilities). Each item must include
file:lineand a concrete refactoring step. - Each Critical and Moderate finding must include:
- Faulty Example — minimal code snippet or input payload reproducing the issue (redact secrets/PII)
- Expected Behavior — single assertable statement (return value, exception, persisted state, emitted event)
- Test Hint — one sentence pointing at the test layer (unit, integration, feature) and entry point
- Suggested Fix — minimal corrected code snippet that resolves the finding. Must comply with
@rules/php/core-standards.mdcand, for Laravel projects,@rules/laravel/architecture.mdc. Usen/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).
- These four fields exist so
@skills/process-code-review/SKILL.mdcan convert each finding into a reproducer test and apply the fix directly from the PR comment. - Minor findings may omit these fields when no behavior change is implied.
- If reviewed code violates project rules or architecture but is out of scope for the current PR, add a Refactoring Proposals section with issue drafts (justified by defined rules only)
- When the diff touches database operations (per the trigger list in
@skills/code-review/SKILL.mdSpecialized Reviews), the posted PR comment must include a dedicated## Database Analysissection before## Coverage. The section reports only themysql-problem-solverfindings (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. - The posted PR comment includes a
## Coveragesection 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## Coveragesection, theCoverage:header line, and thecoverage …slot from the summary line per@skills/code-review/SKILL.mdOutput 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. - The PR comment summary line must report the issue-tracker summary status —
posted summary to issue #N(or comma-separated list when multiple),no linked issue — issue summary skipped, orfailed to post on issue #N: <reason>when a permission / network error occurs. Never post a CR comment without it. - The PR comment summary line must also carry the Reviewer Comment Fulfillment Gate verdict —
reviewer comments: M/N fulfilled(orreviewer comments: nonewhen the PR carries no actionable reviewer instruction). Each not-fulfilled instruction appears as its own Critical finding in theFindingssection, so the Counts line and this verdict stay consistent. - End with summary line
Output Format
Use the template defined in templates/pr-comment-output.md.