attach-review-to-pr

Add line-specific review comments to GitHub pull requests via the gh CLI API.

1.5k|154|Updated Nov 13, 2025
One-click install
npx skills add https://github.com/NeoLabHQ/context-engineering-kit --skill attach-review-to-pr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: attach-review-to-pr
Source: https://github.com/NeoLabHQ/context-engineering-kit/tree/main/plugins/git/skills/attach-review-to-pr
Command: npx skills add https://github.com/NeoLabHQ/context-engineering-kit --skill attach-review-to-pr

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

GitHub's standard gh pr review command cannot attach comments to specific lines of code, forcing reviewers to leave only general feedback instead of precise, contextual inline comments.

Core Features & Use Cases

  • Single Inline Comments: Post a comment on an exact file and line using the /pulls/{pr}/comments REST endpoint with commit SHA, path, line, and side parameters.
  • Batched Reviews: Submit multiple line-specific comments atomically through the /pulls/{pr}/reviews endpoint with COMMENT, APPROVE, or REQUEST_CHANGES events.
  • Troubleshooting Guidance: Resolve common API errors such as pending review conflicts, invalid diff line numbers, and incorrect commit SHAs.
  • Use Case: After reviewing a teammate's pull request, post targeted feedback on five different lines across three files as one cohesive review, mirroring the GitHub UI's review experience.

Quick Start

Ask the agent to add an inline review comment on a specific file and line of a pull request using the gh api.

Frequently Asked Questions about attach-review-to-pr

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a comment to a specific line in a GitHub pull request?

Use gh api to call the /pulls/{pr}/comments endpoint with the commit SHA, file path, line number, and side parameter. The line number refers to the position in the diff, not the absolute file line.

How to post multiple inline review comments on a pull request at once?

Send a JSON payload to the /pulls/{pr}/reviews endpoint via gh api with an event type and a comments array. This creates one atomic review with a single notification, matching the GitHub UI review flow.

Can gh pr review add line-specific comments?

No, gh pr review only supports general review actions like approve, request changes, and overall comments. Line-specific comments require the lower-level gh api command calling GitHub's REST endpoints directly.

Why does GitHub say user_id can only have one pending review per pull request?

GitHub allows only one unsubmitted pending review per user per pull request. Submit the existing pending review first, or use the single comments endpoint which does not create a review object.

Why does my review comment fail with line must be part of the diff?

The specified line number does not exist in the pull request diff. Verify the file was changed in the PR, check line numbers in the Files changed tab, and confirm you are using the latest head commit SHA.