reply-pr-comment

Reply to GitHub PR comment threads using the GitHub CLI.

1|Updated Nov 22, 2025
One-click install
npx skills add https://github.com/gmliao/swift-state-tree --skill reply-pr-comment
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: reply-pr-comment
Source: https://github.com/gmliao/swift-state-tree/tree/main/.agent/skills/SwiftStateTree/reply-pr-comment
Command: npx skills add https://github.com/gmliao/swift-state-tree --skill reply-pr-comment

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables you to respond to PR feedback by posting replies to a specific comment thread using GitHub CLI.

Core Features & Use Cases

  • Reply to a specific PR comment thread using gh
  • Support both line comments and review comments
  • Improve collaboration by quickly acknowledging feedback and clarifying changes

Quick Start

Use the GitHub CLI to reply to a PR comment.

Step 1: Get Repository Name Command: gh repo view --json nameWithOwner --jq '.nameWithOwner' Example output: gmliao/swift-state-tree

Step 2: Get PR Number Command: gh pr view --json number --jq '.number' Example output: 24

Step 3: Find Comment ID Option A: View Line Comments Command: gh api repos/$REPO/pulls/$PR_NUMBER/comments --jq '.[] | {id: .id, path: .path, line: .line, body: (.body | split("\n")[0:2] | join("\n"))}' Option B: View Review Comments Command: gh pr view 24 --json reviews --jq '.reviews[].comments[] | {id: .id, author: .author.login, body: (.body | split("\n")[0:2] | join("\n"))}'

Output format (example): { "id": 2700778279, "path": "Sources/SwiftStateTree/Sync/SyncEngine.swift", "line": 123, "body": "This could be optimized..." }

Step 4: Reply to Comment Command: gh api --method POST repos/$REPO/pulls/$PR_NUMBER/comments/$COMMENT_ID/replies -f body="Your reply text"

Example: gh api --method POST repos/$REPO/pulls/$PR_NUMBER/comments/$COMMENT_ID/replies -f body="Thanks for the review! I've addressed this in the latest commit."

Frequently Asked Questions about reply-pr-comment

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

FAQPage Schema
How do I reply to a PR comment thread using GitHub CLI?

To reply to a PR comment thread using GitHub CLI, locate the target comment ID via `gh api` or `gh pr view`, then execute `gh api --method POST` targeting the `/comments/$COMMENT_ID/replies` endpoint with your reply text.

How does GitHub CLI handle replies to review comments on a pull request?

GitHub CLI handles replies to PR review comments by querying the repository and PR details with `gh repo view` and `gh pr view`, extracting the specific comment ID, and sending a POST request to the GitHub API replies endpoint.

Do I need GitHub CLI installed and authenticated to reply to pull request comments?

Yes, you need the GitHub CLI (gh) installed and authenticated. The Skill relies on `gh repo view`, `gh pr view`, and `gh api` to locate the specific comment thread and post your reply successfully.

What is the best way to find the comment ID for a PR line comment before replying?

The best way to find the comment ID is querying the PR line comments with `gh api repos/$REPO/pulls/$PR_NUMBER/comments`. This returns JSON objects containing the `id`, `path`, `line`, and `body` needed for your reply.

Can I reply to both line comments and review comments on a pull request?

Yes, you can reply to both line comments and review comments. The Skill supports querying line comments via `gh api` and review comments via `gh pr view` to retrieve the necessary comment ID for posting a reply.

Why does my GitHub CLI reply fail to post to the PR comment thread?

Your GitHub CLI reply fails if the `$COMMENT_ID` is incorrect or GitHub CLI is not authenticated. Ensure you accurately parse the JSON output from `gh pr view` or `gh api` to extract the correct ID before posting your reply.