GitHub PR Comment Replier
Reply to comments on a GitHub pull request by finding threads that need responses, generating thoughtful replies based on codebase context, and posting them directly.
Filter criteria for actionable threads:
- •Thread is not resolved
- •Latest comment was not generated by Claude Code (detected by "Claude Code" signature in comment body)
Helper Scripts
This skill provides two helper scripts in scripts/:
| Script | Purpose |
|---|---|
fetch-review-threads.sh | Fetch review threads from a PR with optional filtering |
post-reply.sh | Post a reply to a review thread |
Workflow
Step 1: Fetch Actionable Threads
Use the helper script to fetch review threads that need replies:
PR_NUMBER=$ARGUMENTS
bash ${CLAUDE_PLUGIN_ROOT}/skills/reply/scripts/fetch-review-threads.sh $PR_NUMBER --filter-actionable
This returns JSON with:
- •
owner,repo,prNumber: Repository context - •
threads: Array of threads requiring action - •
totalCount: Number of actionable threads
Each thread contains:
- •
id: Thread ID for posting replies (e.g.,PRRT_xxx) - •
isResolved: Alwaysfalse(filtered) - •
path: File path in the repository - •
line: Line number in the file - •
comments.nodes: Array of all comments in the thread (latest comment is last)
If no actionable threads are found (totalCount: 0), report that no replies are needed.
Step 2: Analyze and Generate Replies
For each actionable thread:
- •Read all comments: Parse the entire
comments.nodesarray to understand the full conversation context - •Examine the code context: Read the file at
patharoundline - •Analyze the codebase: Use Grep and Glob to understand related code and patterns
- •Generate a thoughtful reply: Address the reviewer's concern with specifics
When generating replies:
- •Be concise but thorough
- •Reference specific code when relevant
- •Acknowledge valid points
- •Suggest changes or improvements (but do NOT modify any files)
- •If suggesting a fix, explain what should be changed and why
Step 3: Post Replies
Post each reply using the helper script:
bash ${CLAUDE_PLUGIN_ROOT}/skills/reply/scripts/post-reply.sh "<thread-id>" "<reply-body>"
Or for longer replies, write to a file first:
bash ${CLAUDE_PLUGIN_ROOT}/skills/reply/scripts/post-reply.sh --file "<thread-id>" /tmp/reply.md
The script returns JSON with:
- •
success: Boolean indicating success - •
comment.id: The created comment's ID - •
comment.url: URL to the comment
Step 4: Report Summary
After processing all threads, provide a summary:
- •Number of threads processed
- •Number of replies posted
- •Any errors encountered
Important Guidelines
No Code Changes
This skill must NOT modify any files. Only suggest changes in replies:
- •Do NOT use Write or Edit tools
- •Do NOT create or modify any files
- •Only read files for context and analysis
- •Suggest code changes in the reply text, not by editing files
Reply Quality
- •Address the specific concern raised in the comment
- •Provide context from the codebase when relevant
- •Be professional and collaborative
- •Keep replies focused and actionable
Codebase Analysis
- •Read the file mentioned in the thread's
pathfield - •Look at surrounding code for context
- •Check for related patterns elsewhere in the codebase
- •Consider the reviewer's perspective
Error Handling
- •If
ghCLI is not authenticated, inform the user to rungh auth login - •If the PR number is invalid, report the error clearly
- •If no actionable threads are found, report that no replies are needed
- •If posting a reply fails, report the error and continue with remaining threads
Script Reference
fetch-review-threads.sh
Usage: fetch-review-threads.sh <pr-number> [--filter-actionable]
Options:
--filter-actionable Filter to show only threads requiring a reply:
- Thread is not resolved
- Latest comment was NOT generated by Claude Code
Output: JSON with repository info and thread array
post-reply.sh
Usage: post-reply.sh <thread-id> <body>
post-reply.sh --file <thread-id> <body-file>
Arguments:
thread-id The GraphQL ID of the review thread (e.g., PRRT_xxx)
body The reply message text
body-file Path to a file containing the reply message
Note: Automatically appends a "Claude Code" signature to identify
AI-generated replies for filtering in subsequent runs.
Output: JSON with success status and comment details