Token导航 LogoToken导航

Agent Skill · 开发

git:attach-review-to-pr(git 将评论附加到 pr)

git:attach-review-to-pr 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

git:attach-review-to-pr 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为调用外部服务;许可证信息还不明确,暂无第三方扫描结果,按安装量在开发类的 21,746 个 Skill 里排第 3,753。

总安装 10,325周安装 439GitHub Stars 891下载 3,617核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:git:attach-review-to-pr(git 将评论附加到 pr)
来源仓库:https://github.com/neolabhq/context-engineering-kit
仓库路径:skills/git:attach-review-to-pr
安装命令:
npx skills add https://github.com/neolabhq/context-engineering-kit --skill git:attach-review-to-pr
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/neolabhq/context-engineering-kit --skill git:attach-review-to-pr

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

git:attach-review-to-pr 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,辅助整理项目状态与变更。适用于需要围绕仓库状态或协作事项进行整理的场景。通过 npx skills add 命令从 GitHub 仓库安装,需确认权限与维护状态。

使用前建议核实是否会触发联网、命令执行或文件读写操作。可结合原始 README 进一步验证具体用法和功能边界。

来源仓库内路径:skills/git:attach-review-to-pr

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/neolabhq/context-engineering-kit --skill git:a…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要调用外部服务,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

git:attach-review-to-pr 怎么安装?

在终端执行 npx skills add https://github.com/neolabhq/context-engineering-kit --skill git:attach-revi…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

git:attach-review-to-pr 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

git:attach-review-to-pr 需要什么权限?

权限级别是调用外部服务。该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

git:attach-review-to-pr 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

git:attach-review-to-pr 用的人多吗?

公开数据是累计安装 10,325 次,近一周安装 439 次,下载 3,617 次,GitHub 891 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

git:attach-review-to-pr 安全吗?

没有查到第三方扫描结果,安全性无法从公开资料判断,安装前请自行审查源码、依赖和命令行为。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 没有第三方扫描结果,安全性只能靠自己读源码判断。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 要求有安全扫描结论才肯安装的团队。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
git:attach-review-to-pr

git 将评论附加到 pr · 本页

10,325891调用外部服务未明确未收录

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

How to Attach Line-Specific Review Comments to Pull Requests

This guide explains how to add line-specific review comments to pull requests using the GitHub CLI (gh) API or mcp__github_inline_comment__create_inline_comment if it not available, similar to how the GitHub UI allows commenting on specific lines of code.

Preferred Approach: Using MCP GitHub Tools

If available, use the mcp__github_inline_comment__create_inline_comment MCP tool for posting line-specific inline comments on pull requests. This approach provides better integration with GitHub's UI and is the recommended method.

Fallback: If the MCP tool is not available, use the GitHub CLI (gh) API methods described below:

Overview

While gh pr review provides basic review functionality (approve, request changes, general comments), it does not support line-specific comments directly. To add comments on specific lines of code, you must use the lower-level gh api command to call GitHub's REST API directly.

Prerequisites

  1. GitHub CLI installed and authenticated: gh auth status
  2. Access to the repository and pull request you want to review

Understanding GitHub's Review Comment System

GitHub has two types of PR comments:

  1. Issue Comments - General comments on the PR conversation
  2. Review Comments - Line-specific comments on code changes

Review comments can be added in two ways:

  • Single comment - Using the /pulls/{pr}/comments endpoint
  • Review with multiple comments - Using the /pulls/{pr}/reviews endpoint

Adding a Single Line-Specific Comment

Basic Syntax

gh api repos/{owner}/{repo}/pulls/{pr_number}/comments \
  -f body='Your comment text here' \
  -f commit_id='<commit-sha>' \
  -f path='path/to/file.js' \
  -F line=42 \
  -f side='RIGHT'

Parameters Explained

ParameterTypeRequiredDescription
bodystringYesThe text of the review comment (supports Markdown)
commit_idstringYesThe SHA of the commit to comment on
pathstringYesRelative path to the file being commented on
lineintegerYesThe line number in the diff (use -F for integers)
sidestringYesRIGHT for new/modified lines, LEFT for deleted lines
start_lineintegerNoFor multi-line comments, the starting line
start_sidestringNoFor multi-line comments, the starting side

Parameter Flags

  • -f (--field) - For string values
  • -F (--field) - For integer values (note the capital F)

Complete Example

# First, get the latest commit SHA for the PR
gh api repos/NeoLabHQ/learning-platform-app/pulls/4 --jq '.head.sha'

# Then add your comment
gh api repos/NeoLabHQ/learning-platform-app/pulls/4/comments \
  -f body='Consider adding error handling here. Should we confirm the lesson was successfully marked as completed before navigating away?' \
  -f commit_id='e152d0dd6cf498467eadbeb638bf05abe11c64d4' \
  -f path='src/components/LessonNavigationButtons.tsx' \
  -F line=26 \
  -f side='RIGHT'

Understanding Line Numbers

The line parameter refers to the position in the diff, not the absolute line number in the file:

  • For new files: Line numbers match the file's line numbers
  • For modified files: Use the line number as it appears in the "Files changed" tab
  • For multi-line comments: Use start_line and line to specify the range

Response

On success, returns a JSON object with comment details:

{
  "id": 2532291222,
  "pull_request_review_id": 3470545909,
  "path": "src/components/LessonNavigationButtons.tsx",
  "line": 26,
  "body": "Consider adding error handling here...",
  "html_url": "https://github.com/NeoLabHQ/learning-platform-app/pull/4#discussion_r2532291222",
  "created_at": "2025-11-16T22:40:46Z"
}

Adding Multiple Line-Specific Comments Together

To add multiple comments across different files in a single review, use the /reviews endpoint with JSON input.

Why Use Reviews for Multiple Comments?

  • Atomic operation - All comments are added together
  • Single notification - Doesn't spam with multiple notifications
  • Better UX - Appears as one cohesive review
  • Same mechanism as GitHub UI - "Start a review" → "Finish review"

Basic Syntax

cat <<'EOF' | gh api repos/{owner}/{repo}/pulls/{pr_number}/reviews --input -
{
  "event": "COMMENT",
  "body": "Overall review summary (optional)",
  "comments": [
    {
      "path": "file1.tsx",
      "body": "Comment on file 1",
      "side": "RIGHT",
      "line": 15
    },
    {
      "path": "file2.tsx",
      "body": "Comment on file 2",
      "side": "RIGHT",
      "line": 30
    }
  ]
}
EOF

Review Event Types

EventDescriptionWhen to Use
COMMENTGeneral review commentJust leaving feedback without approval
APPROVEApprove the PRChanges look good, ready to merge
REQUEST_CHANGESRequest changesIssues that must be fixed before merge

Complete Example

cat <<'EOF' | gh api repos/NeoLabHQ/learning-platform-app/pulls/4/reviews --input -
{
  "event": "COMMENT",
  "body": "Testing multiple line-specific comments via gh api",
  "comments": [
    {
      "path": "src/components/CourseCard.tsx",
      "body": "Test comment generated by Claude",
      "side": "RIGHT",
      "line": 15
    },
    {
      "path": "src/components/CourseProgressWidget.tsx",
      "body": "Test comment generated by Claude",
      "side": "RIGHT",
      "line": 30
    },
    {
      "path": "src/components/LessonProgressTracker.tsx",
      "body": "Test comment generated by Claude",
      "side": "RIGHT",
      "line": 20
    }
  ]
}
EOF

Response

{
  "id": 3470546747,
  "state": "COMMENTED",
  "html_url": "https://github.com/NeoLabHQ/learning-platform-app/pull/4#pullrequestreview-3470546747",
  "submitted_at": "2025-11-16T22:42:43Z",
  "commit_id": "e152d0dd6cf498467eadbeb638bf05abe11c64d4"
}

Common Issues and Solutions

Issue 1: "user_id can only have one pending review per pull request"

Error Message:

gh: Validation Failed (HTTP 422)
{"message":"Validation Failed","errors":[{"resource":"PullRequestReview","code":"custom","field":"user_id","message":"user_id can only have one pending review per pull request"}]}

Cause: GitHub only allows one pending (unsubmitted) review per user per PR. If you previously started a review through the UI or API and didn't submit it, it blocks new review creation.

Solution 1: Submit the pending review

# Check for pending reviews
gh api repos/{owner}/{repo}/pulls/{pr_number}/reviews | jq '.[] | select(.state=="PENDING")'

# Submit it through the UI or ask the user to submit it

Solution 2: Use the single comment endpoint instead

# Add individual comments without creating a review
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments \
  -f body='Comment text' \
  -f commit_id='<sha>' \
  -f path='file.tsx' \
  -F line=26 \
  -f side='RIGHT'

Issue 2: Array syntax not working with --raw-field

Failed Attempt:

# This does NOT work - GitHub API receives an object, not an array
gh api repos/{owner}/{repo}/pulls/{pr}/reviews \
  --raw-field 'comments[0][path]=file1.tsx' \
  --raw-field 'comments[0][line]=15' \
  --raw-field 'comments[1][path]=file2.tsx' \
  --raw-field 'comments[1][line]=30'

Error:

Invalid request. For 'properties/comments', {"0" => {...}, "1" => {...}} is not an array.

Solution: Use JSON input via heredoc:

cat <<'EOF' | gh api repos/{owner}/{repo}/pulls/{pr}/reviews --input -
{
  "comments": [...]
}
EOF

Issue 3: Invalid line number

Error Message:

Pull request review thread line must be part of the diff

Cause: The line number doesn't exist in the diff for this file.

Solutions:

  • Verify the file was actually changed in this PR
  • Check the "Files changed" tab to see actual line numbers in the diff
  • Ensure you're using the correct commit_id (the latest commit in the PR)

Issue 4: Wrong commit_id

Error Message:

commit_sha is not part of the pull request

Solution: Get the latest commit SHA:

gh api repos/{owner}/{repo}/pulls/{pr_number} --jq '.head.sha'

Best Practices

1. Get PR Information First

Before adding comments, gather necessary information:

# Get PR details
gh pr view {pr_number} --json headRefOid,files

# Or use the API
gh api repos/{owner}/{repo}/pulls/{pr_number} --jq '{commit: .head.sha, files: [.changed_files]}'

# List files changed
gh api repos/{owner}/{repo}/pulls/{pr_number}/files --jq '.[] | {filename: .filename, additions: .additions, deletions: .deletions}'

2. Check for Pending Reviews

# Check if you have a pending review
gh api repos/{owner}/{repo}/pulls/{pr_number}/reviews \
  --jq '.[] | select(.state=="PENDING" and .user.login=="YOUR_USERNAME")'

3. Use Meaningful Comment Text

  • Be specific and constructive
  • Reference documentation or best practices
  • Suggest alternatives when requesting changes
  • Use code blocks for code suggestions:
Consider using async/await:

\`\`\`typescript
async function getData() {
  const result = await fetch(url);
  return result.json();
}
\`\`\`

4. Batch Related Comments

Use the review endpoint to group related comments:

  • All comments for a single file/area
  • All comments for a specific concern (security, performance, etc.)
  • Complete review session

5. Choose the Right Event Type

# For feedback during development
"event": "COMMENT"

# When approving
"event": "APPROVE"

# When blocking merge
"event": "REQUEST_CHANGES"

Workflow Examples

Example 1: Quick Single Comment

#!/bin/bash
OWNER="NeoLabHQ"
REPO="learning-platform-app"
PR=4

# Get latest commit
COMMIT=$(gh api repos/$OWNER/$REPO/pulls/$PR --jq '.head.sha')

# Add comment
gh api repos/$OWNER/$REPO/pulls/$PR/comments \
  -f body='Consider extracting this into a separate function for better testability' \
  -f commit_id="$COMMIT" \
  -f path='src/utils/validation.ts' \
  -F line=45 \
  -f side='RIGHT'

Example 2: Comprehensive Review

#!/bin/bash
OWNER="NeoLabHQ"
REPO="learning-platform-app"
PR=4

# Create review with multiple comments
cat <<EOF | gh api repos/$OWNER/$REPO/pulls/$PR/reviews --input -
{
  "event": "COMMENT",
  "body": "Thanks for the PR! I've reviewed the changes and have a few suggestions.",
  "comments": [
    {
      "path": "src/components/CourseCard.tsx",
      "body": "Consider memoizing this component to prevent unnecessary re-renders",
      "side": "RIGHT",
      "line": 25
    },
    {
      "path": "src/utils/courseProgress.ts",
      "body": "This function could benefit from error handling for invalid course IDs",
      "side": "RIGHT",
      "line": 12
    },
    {
      "path": "src/state/CourseProgressState.ts",
      "body": "Consider adding JSDoc comments to document the expected behavior",
      "side": "RIGHT",
      "line": 8
    }
  ]
}
EOF

Example 3: Multi-line Comment

# Comment on a range of lines (e.g., lines 10-15)
gh api repos/$OWNER/$REPO/pulls/$PR/comments \
  -f body='This entire block could be simplified using array destructuring' \
  -f commit_id="$COMMIT" \
  -f path='src/utils/parser.ts' \
  -F start_line=10 \
  -f start_side='RIGHT' \
  -F line=15 \
  -f side='RIGHT'

Helpful Helper Scripts

Get PR Files and Lines

#!/bin/bash
# pr-files.sh - List all files changed in a PR with line counts

OWNER="$1"
REPO="$2"
PR="$3"

gh api repos/$OWNER/$REPO/pulls/$PR/files --jq '.[] | "\(.filename): +\(.additions)/-\(.deletions)"'

Check Review Status

#!/bin/bash
# check-reviews.sh - Check review status for a PR

OWNER="$1"
REPO="$2"
PR="$3"

echo "=== Reviews ==="
gh api repos/$OWNER/$REPO/pulls/$PR/reviews --jq '.[] | "\(.user.login): \(.state) at \(.submitted_at)"'

echo -e "\n=== Pending Reviews ==="
gh api repos/$OWNER/$REPO/pulls/$PR/reviews --jq '.[] | select(.state=="PENDING") | "\(.user.login): \(.state)"'

Related Documentation

API Reference

POST /repos/{owner}/{repo}/pulls/{pull_number}/comments

Creates a review comment on a specific line.

Endpoint: https://api.github.com/repos/{owner}/{repo}/pulls/{pull_number}/comments

Parameters:

  • body (string, required): Comment text
  • commit_id (string, required): SHA of commit
  • path (string, required): Relative file path
  • line (integer, required): Line number in diff
  • side (string, required): "LEFT" or "RIGHT"
  • start_line (integer, optional): Start line for multi-line
  • start_side (string, optional): Start side for multi-line

POST /repos/{owner}/{repo}/pulls/{pull_number}/reviews

Creates a review with optional line-specific comments.

Endpoint: https://api.github.com/repos/{owner}/{repo}/pulls/{pull_number}/reviews

Parameters:

  • event (string, required): "APPROVE", "REQUEST_CHANGES", or "COMMENT"
  • body (string, optional): Overall review comment
  • comments (array, optional): Array of comment objects
  • commit_id (string, optional): SHA of commit to review

Comment Object:

  • path (string, required): Relative file path
  • body (string, required): Comment text
  • line (integer, required): Line number in diff
  • side (string, required): "LEFT" or "RIGHT"
  • start_line (integer, optional): Start line for multi-line
  • start_side (string, optional): Start side for multi-line

平台分布

Codex

40.85%
按下载量换算1,478

Claude

27.97%
按下载量换算1,012

Cursor

17.45%
按下载量换算631

Gemini CLI

9.04%
按下载量换算327

安全审计

暂无安全审计结果可展示。

权限和风险

调用外部服务

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills