
Attach Review To Pr
Attach line-level review feedback to an open GitHub pull request from your coding agent using gh or MCP inline-comment tools.
Overview
attach-review-to-pr is an agent skill for the Ship phase that adds line-specific GitHub pull request review comments via MCP or the gh API.
Install
npx skills add https://github.com/neolabhq/context-engineering-kit --skill attach-review-to-prWhat is this skill?
- Prefers mcp__github_inline_comment__create_inline_comment when available for UI-aligned inline comments
- Falls back to GitHub CLI gh api: single-line via /comments endpoint
- Batch multiple line comments via the /reviews endpoint when MCP is unavailable
- Accepts optional PR number or URL, or infers from the current branch with gh pr
- Scoped tooling: Bash(gh api), Bash(gh auth), Bash(gh pr), and the inline-comment MCP tool
- Two gh API patterns: single comment via /comments and batched line comments via /reviews
- Preferred path uses mcp__github_inline_comment__create_inline_comment when installed
Adoption & trust: 516 installs on skills.sh; 1.1k GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You want actionable, per-line PR feedback from your agent but gh pr review only supports coarse approve, request-changes, or general comments.
Who is it for?
Indie builders using GitHub PRs who want agent-driven code review with the same granularity as the GitHub diff UI.
Skip if: Repositories on hosts without GitHub-style inline review APIs, or when you only need a single top-level PR summary with no line anchors.
When should I use this skill?
You need to attach line-specific review comments to a GitHub pull request using gh API or the GitHub inline-comment MCP tool.
What do I get? / Deliverables
Your agent posts inline review comments on the correct files and lines so authors can fix issues before merge without re-pasting review text manually.
- Line-anchored inline review comments on the PR diff
- Optional multi-comment review batch via the reviews endpoint
Recommended Skills
Journey fit
The skill runs at merge time when you are reviewing diffs on a pull request, which maps to the Ship phase in Prism. Inline comments are a code-review artifact on specific changed lines, so the canonical shelf is the review subphase under Ship.
How it compares
Use for surgical inline PR comments instead of pasting a monolithic review block in chat or a non-actionable general gh pr review comment.
Common Questions / FAQ
Who is attach-review-to-pr for?
Solo and small-team builders who merge through GitHub pull requests and want their coding agent to leave line-anchored review feedback like a human reviewer.
When should I use attach-review-to-pr?
Use it during Ship review when a PR is open and you need request-changes or nitpick comments on specific hunks; optional PR number or URL works, or the current branch via gh pr.
Is attach-review-to-pr safe to install?
It requires gh API access and optional MCP GitHub tools—review the Security Audits panel on this Prism page and limit tokens to the repos you trust before enabling network and git permissions.
SKILL.md
READMESKILL.md - Attach Review To Pr
# 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 `/comments` endpoint (see [Adding a Single Line-Specific Comment](#adding-a-single-line-specific-comment)) - For multiple comments: Use the `/reviews` endpoint (see [Adding Multiple Line-Specific Comments Together](#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 1. GitHub CLI installed and authenticated: ```bash 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 ```bash 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 | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `body` | string | Yes | The text of the review comment (supports Markdown) | | `commit_id` | string | Yes | The SHA of the commit to comment on | | `path` | string | Yes | Relative path to the file being commented on | | `line` | integer | Yes | The line number in the diff (use `-F` for integers) | | `side` | string | Yes | `RIGHT` for new/modified lines, `LEFT` for deleted lines | | `start_line` | integer | No | For multi-line comments, the starting line | | `start_side` | string | No | For multi-line comments, the starting side | ### Parameter Flags - `-f` (--field) - For string values - `-F` (--field) - For integer values (note the capital F) ### Complete Example ```bash # 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