AgentSkillsCN

gh-pr-changes

获取 GitHub 拉取请求中的文件变更,并标注可评论的位置。适用于代码审查时,需要明确评论位置时使用。

SKILL.md
--- frontmatter
name: gh-pr-changes
description: "Get file changes from a GitHub pull request with commentable positions. Use when reviewing code and need to know where to place review comments."
allowed-tools: Bash(python3 *)

gh-pr-changes

Get file changes from a GitHub pull request with calculated commentable positions. Parses the diff patches to determine valid position numbers for placing review comments.

Command

bash
python3 .claude/skills/gh-pr-changes/scripts/get_changes.py --owner OWNER --repo REPO --pr-number PR_NUMBER

Arguments

ArgumentRequiredDescription
--ownerYesRepository owner (username or organization)
--repoYesRepository name
--pr-numberYesPull request number

Examples

Get changes for a pull request:

bash
python3 .claude/skills/gh-pr-changes/scripts/get_changes.py --owner octocat --repo hello-world --pr-number 42

Output Format

For each changed file, the output includes:

  • File: the file path
  • Status: added, modified, removed, renamed, etc.
  • Changes: additions/deletions/total line counts
  • Comment Positions: valid diff positions where review comments can be placed (added lines only)
  • Patch: the full diff patch content