
Attach Review To PR
Add line-specific review comments to pull requests using GitHub CLI API
Install
npx skills add NeoLabHQ/context-engineering-kit --skill attach-review-to-pr -g -a claude-code -y- Repository
- NeoLabHQ/context-engineering-kit1.8k
- Category
- Git and review
- Updated
- 2mo ago
- License
- GPL-3.0
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- No, instructions only
What it does
Add line-specific review comments to pull requests using GitHub CLI API
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:
- For single comments: Use the
/commentsendpoint (see Adding a Single Line-Specific Comment) - For multiple comments: Use the
/reviewsendpoint (see Adding Multiple Line-Specific Comments Together)
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
-
GitHub CLI installed and authenticated:
gh auth status -
Access to the repository and pull request you want to review
Understanding GitHub's Review Comment System
GitHub has two types of PR comments:
- Issue Comments - General comments on the PR conversation
- Review Comments - Line-specific comments on code changes
Review comments can be added in two ways:
- Single comment - Using the
/pulls/{pr}/commentsendpoint - Review with multiple comments - Using the
/pulls/{pr}/reviewsendpoint

