Use gh CLI to fetch, reply to, and resolve GitHub PR review comment threads programmatically.

Install

mkdir -p .claude/skills/pr-comments-oysteinamundsen && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10539" && unzip -o skill.zip -d .claude/skills/pr-comments-oysteinamundsen && rm skill.zip

Installs to .claude/skills/pr-comments-oysteinamundsen

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Read, reply to, and resolve review-comment threads on a GitHub pull request using the gh CLI. Use whenever you need to triage PR feedback (fetch all unresolved review threads as structured JSON, post inline replies on specific threads, and mark threads resolved) instead of hand-writing a one-off gh/GraphQL script each time. Prefer this over the generic address-pr-comments skill for bulk thread triage and programmatic gh/GraphQL access.
439 charsno explicit “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • Fetch all unresolved review threads as normalized JSON
  • Fetch all review threads including resolved ones
  • Post inline replies on specific review threads
  • Resolve review comment threads after replying
  • Validate the shape of the JSON replies file
  • Preview API calls with a dry run option

How it works

The skill uses `gh` CLI to fetch review threads as JSON, then posts inline replies and resolves threads based on a provided JSON replies file, validating the input and offering a dry run.

Inputs & outputs

You give it
Pull request number, optional `--all` flag, and a JSON items file for replies
You get back
JSON array of review threads or posted replies and resolved threads

When to use pr-comments

  • Managing PR feedback
  • Resolving review threads
  • Batching PR comments

About this skill

Reading and answering PR review comments

Inline PR review comments live in review threads. Each thread has a GraphQL node id (PRRT_…) used to resolve it, and its first comment has a numeric databaseId used to post an inline reply. The GitKraken/MCP git tools only expose PR-level comments and approvals — they cannot read or reply to inline threads — so this skill drives the gh CLI directly.

This skill ships two scripts so you never have to recreate the fetch/parse/reply loop by hand. Both are zero-dependency Bun/Node ESM (they shell out to gh and parse JSON in-process — no jq required, since jq is not installed here):

ScriptPurpose
fetch-threads.mjsFetch all review threads as normalized JSON (paginated, unresolved-only by default).
reply-resolve.mjsPost inline replies from a JSON items file, then resolve those threads.

Prerequisites

  • gh authenticated (gh auth status).
  • bun on PATH (repo runtime).
  • Run from the repo root. Repo is auto-detected via gh repo view; override with --repo owner/name or GH_REPO=owner/name.

1. Fetch the threads

bun .github/skills/pr-comments/fetch-threads.mjs <pr>            # unresolved only
bun .github/skills/pr-comments/fetch-threads.mjs <pr> --all      # include resolved
bun .github/skills/pr-comments/fetch-threads.mjs <pr> > tmp/pr<pr>-threads.json

Output is a JSON array, one object per thread:

[
  {
    "threadId": "PRRT_kwDOQtIN_86EKNlu",
    "commentId": 3289521091,
    "author": "copilot-pull-request-reviewer",
    "path": "libs/grid/src/lib/plugins/editing/editing-integration.spec.ts",
    "line": 1679,
    "isResolved": false,
    "isOutdated": false,
    "body": "Avoid `as unknown as` casts …"
  }
]

commentId is the first comment's databaseId (reply target); threadId is the node id (resolve target). Read the body to classify each comment, then build a replies file (next step).

2. Reply and resolve

Write a JSON items file (e.g. tmp/pr<pr>-replies.json) — one entry per thread you're answering:

[
  {
    "commentId": 3289521091,
    "threadId": "PRRT_kwDOQtIN_86EKNlu",
    "body": "Fixed. Typed the option as `HTMLOptionElement` directly (L1679); no `as unknown as`."
  }
]

Then run:

bun .github/skills/pr-comments/reply-resolve.mjs <pr> tmp/pr<pr>-replies.json
bun .github/skills/pr-comments/reply-resolve.mjs <pr> tmp/pr<pr>-replies.json --dry-run     # preview, no API calls
bun .github/skills/pr-comments/reply-resolve.mjs <pr> tmp/pr<pr>-replies.json --no-resolve  # reply but leave open

The script validates the file shape up front, posts each reply via repos/{repo}/pulls/{pr}/comments/{commentId}/replies, then resolves each thread via the resolveReviewThread mutation. Use --dry-run first if unsure.

3. Final PR-level summary comment

For /pr-qa, do not post an extra PR-level summary comment. The required output is per-thread: reply inline and resolve each thread.

Constraints

  • Resolving a thread ≠ closing the PR. resolveReviewThread only collapses an individual thread. Never close, merge, approve, push, or force-push — the PR author handles all git operations.
  • Never push or run remote-mutating git commands without explicit per-turn user consent. Posting replies / resolving threads is the only mutation this skill performs; use --dry-run first if unsure.
  • Put generated *-threads.json / *-replies.json files under tmp/ (gitignored scratch), not in the repo tree.
  • This skill only handles GitHub I/O. For the triage policy (classify valid / partially-valid / wrong, cite DECIDED entries, follow the delivery workflow for code changes), see .github/prompts/pr-qa.prompt.md.

When not to use it

  • When the task involves PR-level comments and approvals (use GitKraken/MCP git tools instead)
  • When the user wants to close, merge, approve, push, or force-push the PR
  • When the task is to post an extra PR-level summary comment for `/pr-qa`

Prerequisites

`gh` authenticated (`gh auth status`)`bun` on PATH (repo runtime)Run from the repo root

Limitations

  • Cannot read or reply to inline threads using GitKraken/MCP git tools
  • Never closes, merges, approves, pushes, or force-pushes the PR
  • Only handles GitHub I/O; triage policy is separate

How it compares

This skill automates the bulk triage and resolution of inline PR review threads using structured JSON and the `gh` CLI, providing programmatic access that is more efficient than manual interaction or generic PR comment skills.

Compared to similar skills

pr-comments side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
pr-comments (this skill)02moReviewIntermediate
resolve-conflicts818moReviewIntermediate
git-advanced-workflows112moReviewAdvanced
nx-workspace46moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry