跳到正文
Skillpedia
通用编程21k · #10362

review-github-pr

它能做什么

这项技能让 AI 总结拉取请求或分支差异,并指出重要的设计决定。适合希望在阅读每一行代码之前先了解修改内容的审阅者。

适用场景

  • ✓你想清楚地了解某个拉取请求改了什么的时候。
  • ✓你需要在审查或合并之前,了解某个分支的修改的时候。
  • ✓你想弄清楚拉取请求中关键设计决定的时候。

技能链接

https://github.com/NVIDIA/OpenShell/blob/main/.agents/skills/review-github-pr/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/NVIDIA/OpenShell/blob/main/.agents/skills/review-github-pr/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请总结拉取请求 123,并告诉我主要的设计决定。”

每周 5 个新技能,1 分钟读完。

工作原理

AI 会阅读拉取请求的标题、描述和关联的议题,然后阅读代码修改,并写出重要部分的摘要。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Review GitHub Pull Request

Summarize a GitHub pull request diff, highlighting key design decisions and notable code snippets.

Prerequisites

  • The gh CLI must be authenticated (gh auth status)
  • You must be in a git repository with a GitHub remote

Step 1: Resolve the PR

The user will provide either a PR number (e.g., #123 or 123) or a branch name. Determine which input was given and resolve it to a PR.

If a PR number is provided

Strip any leading # and use the numeric ID directly. Proceed to Step 2.

If a branch name is provided

Look up the open PR whose head branch matches:

gh pr list --head "<branch>" --state open
  • If exactly one PR is found, extract its number and proceed to Step 2.
  • If multiple PRs are found, list them and ask the user which one to review.
  • If no PR is found, skip Step 2 (no PR description to fetch) and go directly to Step 3 using the local git diff fallback.

Step 2: Fetch PR Description

Retrieve the PR metadata:

gh pr view <number> --json title,body,state,headRefName,baseRefName,labels,author,closingIssuesReferences

Record the title, body, headRefName, and baseRefName for use in later steps.

Check Issue Acceptance

Inspect every closing issue reference (paginate as needed) and fetch its current repository and labels. Verify the PR author's permission in the target repository:

gh api repos/OWNER/REPO/collaborators/AUTHOR/permission --jq .permission

Call out each linked issue missing state:accepted, with an issue link. Verified write, maintain, or admin access permits the exception; report it as context, not a blocking concern. Other authors need at least one target-repository issue, and every linked issue must be accepted; report violations under Potential Concerns. PR body text such as No issue required does not bypass this gate. Report failed lookups as unverified and continue the code review. For a branch without a PR, note that issue acceptance was not verified.

Step 3: Generate the Diff

Primary: gh pr diff

Fetch the diff via the GitHub CLI:

gh pr diff <number>

If this succeeds, use this diff and proceed to Step 4.

Fallback: local git diff

If no PR exists (branch-only case) or the gh diff command fails, fall back to a local diff:

# Ensure both branches are available locally
git fetch origin <target-branch> <source-branch>

# Generate the diff
git diff origin/<target-branch>...origin/<source-branch>

If the user provided a branch name and no PR was found, diff against main:

git fetch origin main <branch>
git diff origin/main...origin/<branch>

Handling large diffs

If the diff output is very large (thousands of lines), use the Task tool to process it in chunks. Summarize each chunk independently, then merge the summaries. Do not skip or truncate parts of the diff — accuracy depends on reading all of it.

Step 4: Analyze and Summarize

Read through the full diff (and the PR description if available). Produce a summary with the following sections. Keep every section as concise as possible — brevity is a priority.

Summary format

## PR Review: <title>

**PR:** [#<number>](<url>)  <- only if a PR exists
**Author:** <author>
**Branch:** `<source>` -> `<target>`

### Overview
<1-3 sentences describing what this PR does and why>

### Key Design Decisions
- <decision 1 with file:line reference>
- <decision 2 with file:line reference>
- ...

### Notable Code
<short fenced code snippets that illustrate the most important changes -- max 3 snippets>

### Potential Concerns  <- omit if none
- **<concise user-visible behavior>** — Before this PR, <affected persona>
  experienced <previous behavior>. With this PR, <new concerning behavior>, so
  <user-visible impact>. Details: `<file>:<line>`.

Guidelines for the summary:

  • Overview: State what changed and why. Pull context from the PR description if available.
  • Key Design Decisions: Focus on why something was done a particular way, not what changed. Include file_path:line_number references. Examples: choice of algorithm, new abstraction introduced, API contract change, migration strategy.
  • Notable Code: Include only the most instructive or surprising snippets. Keep each snippet under 15 lines. Always include the file path above the code block.
  • Potential Concerns: Only include genuine risks that warrant a change or a delibera
常见问题

使用它需要什么?

gh 命令行工具必须已登录,并且你需要位于与 GitHub 仓库关联的文件夹中。

我能给它一个分支名而不是编号吗?

可以。它会查找该分支未关闭的拉取请求;如果有多个,它会询问你使用哪一个。

它会批准或合并拉取请求吗?

不会。这项技能用于阅读和总结修改,不用于批准或合并。

详情

作者的原始描述

Review a GitHub pull request by summarizing its diff and key design decisions. Use when the user wants to review a PR, understand changes in a branch, or get a code review summary. Trigger keywords - review PR, review pull request, summarize PR, summarize diff, code review, review branch, PR summary, diff summary.

repo: NVIDIA/OpenShell

热度

GitHub 星标
21k
排名
#10362
许可证
Apache-2.0
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能