Claude
Skills
Sign in
Back

reply

Included with Lifetime
$97 forever

This skill should be used when the user asks to "reply to PR comments", "respond to review comments", "reply to PR

Code Review

What this skill does


# 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 this skill** (detected by "github-devflow:reply" signature)

## Helper Scripts

This skill uses shared helper scripts in `scripts/` at the plugin root:

| 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:

```bash
PR_NUMBER=$ARGUMENTS
bash ${CLAUDE_PLUGIN_ROOT}/scripts/fetch-review-threads.sh $PR_NUMBER --filter-resolved --filter-skill reply
```

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`: Always `false` (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:

1. **Read all comments**: Parse the entire `comments.nodes` array to understand the full conversation context
2. **Examine the code context**: Read the file at `path` around `line`
3. **Analyze the codebase**: Use Grep and Glob to understand related code and patterns
4. **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
bash ${CLAUDE_PLUGIN_ROOT}/scripts/post-reply.sh --skill reply "<thread-id>" "<reply-body>"
```

Or for longer replies, write to a file first:

```bash
mkdir -p /tmp/github-devflow:reply/${REPO}/${PR_NUMBER}
# Write reply body to /tmp/github-devflow:reply/${REPO}/${PR_NUMBER}/reply.md
bash ${CLAUDE_PLUGIN_ROOT}/scripts/post-reply.sh --skill reply --file "<thread-id>" /tmp/github-devflow:reply/${REPO}/${PR_NUMBER}/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 repository files.** Only suggest changes in replies:
- Do NOT use Edit tools
- Do NOT create or modify any repository files
- Only read files for context and analysis
- Suggest code changes in the reply text, not by editing files
- The Write tool is permitted ONLY for creating temp files under `/tmp/github-devflow:reply/` for the reply posting process

### 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 `path` field
- Look at surrounding code for context
- Check for related patterns elsewhere in the codebase
- Consider the reviewer's perspective

### Error Handling

- If `gh` CLI is not authenticated, inform the user to run `gh 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-resolved] [--filter-skill <name>]

Options:
  --filter-resolved    Filter out resolved threads
  --filter-skill <name>  Filter out threads where the latest
                         comment contains the specified skill's signature
                         (github-devflow:<name>)

Output: JSON with repository info and thread array
```

### post-reply.sh

```
Usage: post-reply.sh [--skill <name>] <thread-id> <body>
       post-reply.sh [--skill <name>] --file <thread-id> <body-file>

Options:
  --skill <name>  Include skill identifier in signature
                  (e.g., --skill reply → "github-devflow:reply")

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
```

Related in Code Review