跳到正文
cccskills
免费在 GitHub 公开

review-pr

Structured, risk-aware code review of a GitHub pull request using the gh CLI, with diff triage, unresolved-thread suppression, and severity-grouped findings ending in an approve/request-changes verdict.

中文简介正在准备中。当前显示原文说明。

集成工具GitHub
查看安装方法

包含的文件(1)

  • SKILL.md7.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Review a Pull Request

Perform a structured, risk-aware code review of a GitHub pull request. Works in any coding-agent harness with the gh CLI authenticated.

Inputs

  • A PR reference: URL, owner/repo#123, or bare #123. Normalize before use with gh: URL → as-is; owner/repo#N → gh -R owner/repo pr diff N; bare #N → gh pr diff N (targets the repo whose remote the cwd's origin points at — if the cwd is not a git repo with a GitHub origin, error out rather than guessing). Only the bare #N form depends on the cwd; everything after normalization targets GitHub explicitly via -R.
  • Optional: extra review instructions from the user (e.g. "focus on security").

Review Thread Suppression

The skill fetches unresolved review threads itself — no caller needs to supply them.

  1. Fetch threads. After fetching the diff, list unresolved review threads via GraphQL (handles >100 threads via pagination):
gh api graphql -f query='
query($owner: String!, $name: String!, $number: Int!, $after: String) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100, after: $after) {
        pageInfo { hasNextPage endCursor }
        nodes { isResolved path line originalLine startLine originalStartLine }
      }
    }
  }
}' -F owner=<owner> -F name=<repo> -F number=<number>

(pass -F after=<cursor> for subsequent pages). Keep only unresolved threads (isResolved: false) that have a line number; collect all of line, originalLine, startLine, originalStartLine per thread.

  1. Apply suppression window. Default ±5 lines. GitHub thread line/startLine are positions on the PR head; originalLine/originalStartLine are on the base. Match the finding's new-side line against the thread's current line (line/startLine); use originalLine/originalStartLine only when the current line is null (outdated thread). Skip any finding whose file matches a thread's path (also match the diff's old path if the file was renamed) AND whose line falls within ±5 lines (inclusive) of any thread line. Those locations are already under discussion — re-reporting them is noise.

  2. Fallback. If the GraphQL call fails (missing pullRequest:read scope, token can't see the repo), run without suppression and note that in the report.

  3. Report. After the findings, add one line: Suppressed N findings overlapping existing unresolved threads — flag if any suppressed finding was High severity, and let that weigh on the verdict rather than silently approving.

If the caller explicitly supplies a thread list (JSON array of {"path", "lines"}) or a different window, prefer the caller's values over the built-in fetch.

If a caller passes additional directives, honor them:

  • Base ref: "Review <url> against origin/<base>" — diff against that specific base ref, not the PR's actual base. gh pr diff cannot override the base, so freeze via git instead:
    git fetch origin +pull/<number>/head:refs/remotes/origin/pr/<number> <base>:refs/remotes/origin/<base>
    git diff refs/remotes/origin/<base>...refs/remotes/origin/pr/<number> > "$diff_dir/pr-review.diff"
    
    Requires a local clone; if none is available, clone first or fall back to gh pr diff and note the base override was not applied.
  • Review-only mode: "review-only: do not edit files, commit, push, or post GitHub comments" — strictly read-only: no file edits, no commits, no pushes, no gh pr comment/review submissions. Report findings in-conversation only.
  • Interactivity: "Present the report, then remain interactive for follow-up" — deliver the report, then stay in the session answering follow-up questions without re-running the review.

Caller directives take precedence over defaults in this skill (e.g. review-only overrides any temptation to fix things).

Workflow

  1. Freeze the diff. Fetch the patch once into a per-run temp dir and work from that snapshot:
diff_dir="$(mktemp -d)"
gh -R <owner>/<repo> pr diff <number> > "$diff_dir/pr-review.diff"

Also fetch metadata: gh -R <owner>/<repo> pr view <number> --json title,body,baseRefName,headRefName,additions,deletions,changedFiles. Read the PR description for intent; review the change against that intent. Keep $diff_dir for the whole session; clean it up only when the session ends — follow-up questions may still need the frozen snapshot.

1b. Fetch unresolved threads. Per "Review Thread Suppression" above — fetch the PR's unresolved review threads now so suppression is ready before analysis begins.

  1. Triage the file list. Parse the diff per file. EXCLUDE from review (note them, don't review): lockfiles (*.lock, package-lock.json, yarn.lock, pnpm-lock.yaml, Cargo.lock, etc.), minified (.min.js/css), generated (.generated., .map, .snap), build output (dist/, build/, out/), vendor (node_modules/, vendor/), and binaries (images, fonts, archives). If nothing reviewable remains, report that.

  2. Scale the review.

    • Under ~100 changed lines or ≤2 files → single-pass review.
    • Larger diffs → fan out reviewer subagents in parallel (if your harness supports subagents), grouping by locality: same directory/module together, tests with their implementation files. Suggested agent count: <500 lines → 2, <2000 → 4, <5000 → 8, beyond → up to 16.
    • With many subagents, don't paste the whole diff into each prompt; assign file lists and have each agent slice the frozen patch from $diff_dir/pr-review.diff for its own files. Never re-derive the diff via local git diff — the frozen patch is the source of truth.
  3. Review each file for:

    • Correctness: logic errors, edge cases, broken invariants, error handling.
    • Security: injection, unsafe deserialization, secrets, authz gaps.
    • API/contract changes: breaking changes, stale callers, missing updates to consumers and tests.
    • Maintainability: dead code, needless complexity — but defer style nitpicks unless the repo enforces them.

    Across all four dimensions: read surrounding file context when a hunk alone is ambiguous — the diff is the delta, not the truth.

  4. Report findings grouped by severity:

    • High — bugs, security issues, breaking changes (blockers).
    • Medium — likely bugs, missing test coverage for changed behavior.
    • Low — maintainability, minor issues.

    Each finding (all severities): file, line (old/new), what's wrong, why it matters, and a concrete suggested fix. End with an overall verdict: approve / approve-with-comments / request-changes, one sentence of justification.

Rules

  • Review ONLY the PR's changes — never flag pre-existing issues in unchanged lines as blockers; note them separately as observations.
  • Never re-fetch or re-diff mid-review; work from the frozen snapshot unless a file needs more context. If $diff_dir was cleaned up and a follow-up query needs diff content, a single re-fetch for that query is acceptable.
  • Verify claims against the actual diff; cite file+line for every finding.
  • No cheerleading; if it's clean, say so briefly.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

2ndbrain

免费

Quick-save the last assistant response as a verbatim note in the 2ndBrain Obsidian vault (~/2ndBrain/quick-notes/<year>/). Use when the user asks to quick-save/save the last response to 2ndBrain, or invokes $2ndbrain or /skill:2ndbrain.

中文简介正在准备中。当前显示原文说明。

phatblat/dotfiles122026年10月19日 更新

Write commit messages under the agent-commits convention - a Conventional Commits fork with no chore catch-all, intent-only type tokens, facts in trailers, and legally-grounded AI provenance (Assisted-by, never Co-authored-by). Use when composing a commit in a repo whose commitlint.config.js extends agent-commits, when deciding between feat/fix/refactor/perf, or when recording AI participation.

中文简介正在准备中。当前显示原文说明。

phatblat/dotfiles122026年10月19日 更新

Coordinate multi-agent work through durable artifacts in git instead of chat. Use this whenever a task involves sending a message to another agent, agent mailboxes or handoffs, claiming work from a shared queue, notifying another agent or crew (OpenClaw, Grok Bot, Claude Code, Codex, Gas Town/Gas City workers) that work is ready, or whenever the user mentions the artifact bus, message bus, agent mail, beads mail, doorbells, or pings between agents — even if they don't say "bus" explicitly.

中文简介正在准备中。当前显示原文说明。

phatblat/dotfiles122026年10月19日 更新

aven

免费

Use aven to find tasks, update status, and leave durable handoff context.

中文简介正在准备中。当前显示原文说明。

phatblat/dotfiles122026年10月19日 更新

Plan, order and deliver a batch of backlog items (e.g. every High item) in a Conventional Docs repo, one decision, branch, worktree, draft PR, review and merge per item. Use when asked to work through the backlog, implement all items of a priority, or sequence several backlog items end to end.

中文简介正在准备中。当前显示原文说明。

phatblat/dotfiles122026年10月19日 更新

boris

免费

Codex workflow tips from Boris Cherny (creator of Codex) and the Codex team. Use when: setting up Codex, optimizing workflows, running parallel sessions, configuring AGENTS.md, using skills/commands, subagents, hooks, MCP integrations, or learning best practices. Covers: git worktrees, plan mode, verification, permissions, Slack MCP, BigQuery, prompting tips, plugins, custom agents, sandboxing, keybindings, status lines, output styles, customization, /simplify for code quality, /batch for parallel code migrations, /loop for scheduled tasks, code review agents, /btw for mid-task questions, /effort max reasoning, remote control sessions, voice mode, setup scripts, session naming, /color, PostCompact hook, auto mode, /schedule cloud jobs, iMessage plugin, auto-memory, and auto-dream, mobile app, session teleporting, Cowork Dispatch, Chrome extension, Desktop app, /branch forking, --bare SDK startup, --add-dir multi-repo, --agent custom agents, /voice input.

中文简介正在准备中。当前显示原文说明。

phatblat/dotfiles122026年10月19日 更新

查看 phatblat 的全部技能

报告此技能的问题