/get-pr-comments

Fetch all open PR review comments from GitHub and address them inline — fixes justified ones, explains design choices — without ever posting back to GitHub.

GitHub CLICode ReviewClaude Code

The problem

Addressing review comments in GitHub's interface is slow. You're constantly switching between the browser, your editor, and the terminal — losing context at every hop.

Missing a comment or replying to the wrong thread is easy. And every fix still requires manually tracking which comments are resolved and which are not.

How it works

1. Fetch all unresolved comments

Uses the GitHub CLI to pull both inline review comments and general PR comments. Only unresolved ones are included — already-resolved threads are filtered out at fetch time.

2. Evaluate each one

For every comment that implies a code change, the skill reads the relevant file and evaluates whether the feedback is justified given the project context and existing conventions.

3. Fix or explain

Justified comments get fixed directly. Comments that are incorrect or go against project conventions get a written explanation in the conversation — the code stays unchanged.

4. Design discussions stay in-chat

Questions and architectural discussions are answered here, not on GitHub. The skill never calls gh pr comment or any GitHub API write endpoint.

How to use it

# From any branch with an open PR
/get-pr-comments

Skill definition

---
description: Fetch PR comments from GitHub, fix issues in this conversation. Never replies on GitHub.
allowed-tools: Bash(git branch:*), Bash(gh pr view:*), Bash(gh pr comments:*), Bash(gh api:*), Read, Edit, Glob, Grep
---

## Context

- Current branch: !`git branch --show-current`
- PR info: !`gh pr view --json number,title,url,body 2>/dev/null || echo "No open PR found for this branch"`
- PR review comments (inline): !`gh api "repos/{owner}/{repo}/pulls/$(gh pr view --json number --jq .number 2>/dev/null)/comments" --jq '[.[] | select(.state != "RESOLVED") | {path: .path, line: .line, body: .body, author: .user.login, state: .state}]' 2>/dev/null || echo "[]"`
- PR issue comments (general): !`gh pr view --json comments --jq '[.comments[] | {author: .author.login, body: .body}]' 2>/dev/null || echo "[]"`

## Your task

1. Parse all PR comments above (both inline review comments and general comments).
   Only unresolved comments are included — resolved ones are already filtered
   out at fetch time. Do not process any comment whose `state` is `"RESOLVED"`
   if it somehow appears.
2. For each remaining comment that requires a code change:
   - Identify the file and location concerned
   - Read the relevant code
   - Evaluate whether the comment is justified given the project context,
     architecture rules, and existing conventions
   - If justified: apply the fix
   - If not justified: explain in this conversation why the current
     implementation is correct or preferable — do not change the code
3. For each comment that is a question or design discussion:
   - Explain the reasoning and choice in this conversation only
4. Summarize what was fixed and what was explained.

## Hard rules

- **NEVER** use `gh pr comment`, `gh pr review`, or any GitHub API call that
  posts, edits, or replies to a comment. Do not write anything back to GitHub.
- All explanations and discussions happen here in the conversation, not on GitHub.
- Follow all project conventions from CLAUDE.md.