reply-to-pr-threads

$npx mdskill add tobihagemann/turbo/reply-to-pr-threads

Drafts, confirms, and posts replies to GitHub PR review threads.

  • Solves drafting and posting replies to multiple PR review threads.
  • Depends on GitHub GraphQL API and /github-voice skill.
  • Re-fetches thread state to skip auto-resolved threads before drafting.
  • Delivers formatted replies for user confirmation and posts via GraphQL.

SKILL.md

.github/skills/reply-to-pr-threadsView on GitHub ↗
---
name: reply-to-pr-threads
description: "Draft, confirm, and post replies to GitHub PR review threads. Handles per-category reply formatting, re-fetches thread resolution state so auto-resolved threads are skipped, and posts via GraphQL. Use when the user asks to \"reply to PR threads\", \"post PR thread replies\", or \"draft PR reply messages\"."
---

# Reply to PR Threads

Draft replies for a processed review-thread list, confirm with the user, and post the surviving drafts.

## Step 1: Re-fetch Thread State

Auto-detect owner, repo, and PR number from the current branch if not provided, then query the current resolution state:

```bash
gh api graphql -f query='
query($owner: String!, $repo: String!, $pr: Int!) {
  repository(owner: $owner, name: $repo) {
    pullRequest(number: $pr) {
      reviewThreads(first: 100) {
        nodes { id isResolved }
      }
    }
  }
}' -f owner='{owner}' -f repo='{repo}' -F pr={pr_number}
```

Drop threads whose `isResolved` is now true. Reviewers or bots such as CodeRabbit may resolve threads after the original fetch, and drafting replies for them is wasted work.

## Step 2: Run `/github-voice` Skill

Run the `/github-voice` skill to load voice rules and the insider-vs-outsider detection.

## Step 3: Draft Replies

Use the processed-thread list from conversation context. Each entry has: thread id, file path, line, category (`fix`, `skip`, `answer`, or `clarify`), and per-category payload.

Keep every reply to one or two sentences. No bullet-point reasoning. No bolded labels.

**fix**: payload is a commit SHA, optionally with a divergence note.

```
Fixed in <commit-sha>.
```

Only add a brief sentence after the SHA when the fix meaningfully diverges from what the reviewer suggested. Otherwise the SHA alone is enough.

**skip**: payload is the skip reasoning. State the reasoning directly. Do not apologize or hedge.

**answer**: payload is raw answer text from `/answer-reviewer-questions`. Tighten to one or two sentences and apply `/github-voice` rules. Do not cite transcripts or mention Claude. The reply reads as the implementer's own explanation.

**clarify**: payload is a user-directed question. Draft it as directed.

## Step 4: Present Drafts and Confirm

Output all drafts as text, grouped by file:

```
### <file-path>

**Thread <id>** (<category>, line <line>)
Reviewer: <original comment, truncated if long>
Reply: <drafted reply>
```

Then use `AskUserQuestion` to ask whether to post. Offer:

- **Post** — post all drafts as shown
- **Cancel** — skip posting

## Step 5: Post Replies

For each approved draft, write the drafted reply to `.turbo/pr/thread-<thread-id>.md` with the Write tool, then post via the reply mutation:

```bash
gh api graphql -f query='
mutation($threadId: ID!, $body: String!) {
  addPullRequestReviewThreadReply(input: {pullRequestReviewThreadId: $threadId, body: $body}) {
    comment { id }
  }
}' -f threadId='<thread-id>' -F [email protected]/pr/thread-<thread-id>.md
```

Substitute `<thread-id>` with the thread's id for each post. Report what was posted and what was skipped (due to auto-resolution between re-fetch and posting).

Then use the TaskList tool and proceed to any remaining task.

## Rules

- Never resolve or dismiss a review thread. Only reply. Let the reviewer resolve.
- If a post mutation fails because the thread is already resolved, log the skip and continue with the rest.

More from tobihagemann/turbo

SkillDescription
answer-reviewer-questionsFor each reviewer question on a PR, recall implementation reasoning and compose a raw answer. Use when the user asks to \"answer reviewer questions\", \"draft answers to PR questions\", or \"explain reviewer questions\".
apply-findingsApply findings by making the suggested code changes. Applies accepted verdicts, escalates ambiguous findings to the user, and offers to note genuine improvements for later. Use when the user asks to \"apply findings\", \"apply fixes\", \"apply suggestions\", \"apply accepted findings\", \"fix the findings\", or \"apply the review results\".
assess-technical-debtAssess project-wide structural technical debt: complexity hotspots, deprecated API usage, duplication clusters, and architecture rot. Ranks findings by impact and refactor effort into a report at .turbo/technical-debt.md. Use when the user asks to \"assess technical debt\", \"find technical debt\", \"review technical debt\", \"what should we refactor\", \"find refactoring candidates\", \"where is the code rot\", or \"what's our worst code\". Analysis-only — does not modify code.
changelog-rulesShared changelog conventions and formatting rules referenced by /create-changelog and /update-changelog. Not typically invoked directly.
claude-printRun a non-interactive Claude Code print-mode call from Codex. Use when the user asks to \"claude print\", \"ask claude\", \"run claude\", \"consult claude\", or when a Codex Turbo skill needs Claude as an independent peer reviewer.
code-styleEnforce mirror, reuse, and symmetry principles to keep new code consistent with surrounding code. Use when writing new code in an existing codebase, adding new features, refactoring, or making any code changes.
codex-execRun autonomous task execution using the codex CLI. Use when the user asks to \"codex exec\", \"run codex exec\", \"execute a task with codex\", or \"delegate to codex\".
commit-rulesShared commit message rules and technical constraints referenced by /stage-commit and /commit-staged. Not typically invoked directly.
commit-staged-pushCommit already-staged changes and push in one step. Use when the user asks to \"commit and push staged changes\", \"commit and push what's staged\", or \"commit staged and push\".
consult-claudeConsult Claude Code for second opinions, brainstorming, or difficult debugging from Codex. Use when the user asks to \"consult claude\", \"ask claude\", \"get claude's opinion\", \"brainstorm with claude\", or \"discuss with claude\".