github-pr-review-operation

Orchestrate gh CLI commands to extract PR metadata, view diffs, and post comments.

Updated Aug 16, 2018
One-click install
npx skills add https://github.com/Cain96/dotfiles --skill github-pr-review-operation-cain96
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: github-pr-review-operation
Source: https://github.com/Cain96/dotfiles/tree/main/dot_config/claude/skills/github-pr-review-operation
Command: npx skills add https://github.com/Cain96/dotfiles --skill github-pr-review-operation-cain96

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill automates GitHub PR review tasks using the gh CLI. Extract PR info, view diffs with line numbers, retrieve and post comments, create inline comments, and reply to comments, reducing manual PR review time.

Core Features & Use Cases

  • PR information retrieval: Get title, body, author, state, base/head refs, and URL.
  • Diffs with line numbers: View diffs with line numbers to pinpoint changes.
  • Comment management: Retrieve and post comments, including inline code comments.
  • Inline reviews: Create inline comments on specific files/lines and reply to existing comments.
  • Use Case: When reviewing a PR, quickly gather context and leave precise inline feedback without leaving the CLI.

Quick Start

Use gh to view PR 123 and add a comment: gh pr view 123 --repo OWNER/REPO --json title,body,author,state,baseRefName,headRefName,url gh pr comment 123 --repo OWNER/REPO --body "Please address the reviewer notes."

Frequently Asked Questions about github-pr-review-operation

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

FAQPage Schema
How do I automate GitHub PR reviews with the command line?

Automate PR reviews by using gh CLI to extract PR metadata, retrieve diffs with line numbers, and post inline comments. This reduces manual review time by orchestrating gh commands like gh pr view, gh pr diff, and gh api to gather context and leave precise feedback without leaving the terminal.

Can I retrieve diffs with line numbers and post inline comments on GitHub PRs?

Yes. Use gh pr diff with awk to view diffs with line numbers, then post inline comments by calling gh api with commit_id, path, and line parameters to target specific code locations in your review.

What do I need to set up before automating PR reviews with gh CLI?

Install and authenticate gh CLI on your system. The Skill parses PR URLs into owner/repo/NUMBER format and requires valid GitHub credentials to execute pr view, diff, and api commands across repositories.

How do I retrieve PR information like title, author, and base branch using gh?

Run gh pr view NUMBER --repo OWNER/REPO --json to extract PR metadata including title, body, author, state, baseRefName, headRefName, and URL in structured format for downstream analysis or reporting.

Can I post both general and inline comments on a GitHub PR from the CLI?

Yes. Post general comments using gh pr comment, and create inline code comments by calling gh api with commit_id, path, and line parameters to attach feedback to specific code segments.

What are the limitations when automating PR reviews across multiple repositories?

Authentication scope and API rate limits apply across repositories. Ensure gh CLI is authenticated with sufficient permissions; review GitHub's API rate limits when scripting bulk operations across multiple repos.