git clone https://github.com/existential-birds/beagle
T=$(mktemp -d) && git clone --depth=1 https://github.com/existential-birds/beagle "$T" && mkdir -p ~/.claude/skills && cp -r "$T/plugins/beagle-core/skills/respond-pr-feedback" ~/.claude/skills/existential-birds-beagle-respond-pr-feedback && rm -rf "$T"
plugins/beagle-core/skills/respond-pr-feedback/SKILL.mdRespond to PR Feedback
Post replies to review comments after you've evaluated the feedback and made fixes. Resolves conversation threads by default.
Usage
/beagle-core:respond-pr-feedback [--pr <number>] [--no-resolve]
Flags:
- PR number to target (default: current branch's PR)--pr <number>
- Skip thread resolution after posting replies (default: resolve all)--no-resolve
Prerequisites
Run
/beagle-core:fetch-pr-feedback first to evaluate the feedback and make any necessary fixes.
Instructions
1. Parse Arguments
Extract flags from
$ARGUMENTS:
or detect from current branch--pr <number>
flag (boolean, default false)--no-resolve
2. Get PR Context
# Get PR info (if --pr not specified, uses current branch) gh pr view --json number,author --jq '{number, author: .author.login}' # Get repo owner/name gh repo view --json owner,name --jq '{owner: .owner.login, name: .name}' # Get current authenticated user gh api user --jq '.login'
Store as
$PR_NUMBER, $PR_AUTHOR, $OWNER, $REPO, $CURRENT_USER.
Note:
$OWNER, $REPO, etc. are placeholders. Substitute actual values from previous steps.
3. Fetch Unreplied Comments and Thread Data
3a. Unreplied Review Comments
Fetch review comments, excluding PR author and current user, filtering to root comments that haven't been replied to.
Write the jq filter to a temp file using a heredoc with single-quoted delimiter (prevents shell escaping issues with
!=, regex patterns, and angle brackets):
cat > /tmp/unreplied_comments.jq << 'JQEOF' add // [] | # Root comments from reviewers (not replies, not PR author, not current user) [.[] | select( .in_reply_to_id == null and .user.login != $pr_author and .user.login != $current_user )] as $roots | # IDs that current user has already replied to [.[] | select(.user.login == $current_user) | .in_reply_to_id] as $replied | # Filter to unreplied only $roots | map(select(. as $c | $replied | index($c.id) == null)) | # Dedup: group by path + line + reviewer, pick newest per group group_by({ p: .path, l: (.line // .original_line), u: .user.login }) | map(sort_by(.created_at) | last) | # Output needed fields map({ id, user: .user.login, path, line_display: ( .line as $end | .start_line as $start | if $start and $start != $end then "\($start)-\($end)" else "\($end // .original_line)" end ), body }) JQEOF
gh api --paginate "repos/$OWNER/$REPO/pulls/$PR_NUMBER/comments" | \ jq -s --arg pr_author "$PR_AUTHOR" --arg current_user "$CURRENT_USER" \ -f /tmp/unreplied_comments.jq
If no unreplied comments found, output: "All review comments have been addressed." and stop.
3b. Pre-fetch Thread Data
Fetch review thread IDs to enable resolution after posting replies:
gh api graphql -f query=" query { repository(owner: \"$OWNER\", name: \"$REPO\") { pullRequest(number: $PR_NUMBER) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 1) { nodes { databaseId } } } } } } } "
Build a lookup map: comment
databaseId → thread id (unresolved threads only). This enables immediate resolution after posting each reply.
4. Generate and Post Replies
For each unreplied comment, determine the appropriate response based on your evaluation:
| Evaluation Outcome | Response |
|---|---|
| Feedback was incorrect/unfounded | Explain why the current code is correct |
| Feedback lacked context | Explain the design decision |
| Feedback was valid and fixed | "Fixed in " or brief description of change |
| Feedback was valid but won't fix | Explain the tradeoff/decision |
Tagging guideline:
@-tag bot reviewers (e.g., @coderabbitai) to trigger their processing. Do not @-tag human reviewers.
Post reply to each comment:
gh api "repos/$OWNER/$REPO/pulls/$PR_NUMBER/comments/$COMMENT_ID/replies" \ -X POST --raw-field body="$RESPONSE"
5. Resolve Threads
This step runs by default. Skip only if
--no-resolve was passed.
After posting each reply, look up the
$THREAD_ID from the step 3b mapping using the comment's $COMMENT_ID:
gh api graphql -f query=" mutation { resolveReviewThread(input: {threadId: \"$THREAD_ID\"}) { thread { isResolved } } } "
- If a comment's
has a matching thread ID in the lookup, resolve it$COMMENT_ID - If no thread ID found (e.g., issue comment rather than review thread), skip resolution for that comment
6. Output Summary
Group by reviewer:
### Reviewer: coderabbitai[bot] | File:Line | Response Type | Thread | |-----------|---------------|--------| | `src/foo.ts:42` | Fixed in `abc1234` | Resolved | | `src/bar.ts:15` | Explained design | Resolved | ### Reviewer: octocat | File:Line | Response Type | Thread | |-----------|---------------|--------| | `src/baz.ts:7` | Won't fix | Resolved |
Footer:
**Threads resolved: 3/3**
Response Guidelines
-tag bot reviewers to trigger re-processing; do not tag human reviewers@- Keep responses concise and technical
- No performative agreement ("Great point!", "You're right!")
- Reference specific code/design when explaining decisions
- If fixed: state what changed, no gratitude
Example
# Respond to all reviewers on current PR (resolves threads) /beagle-core:respond-pr-feedback # Respond on a specific PR /beagle-core:respond-pr-feedback --pr 123 # Respond without resolving threads /beagle-core:respond-pr-feedback --no-resolve