cd /news/ai-tools/claude-skill-to-address-pr-comments Β· home β€Ί topics β€Ί ai-tools β€Ί article
[ARTICLE Β· art-16987] src=gist.github.com pub= topic=ai-tools verified=true sentiment=Β· neutral

Claude skill to address PR comments

A developer created a Claude skill that automatically walks through unresolved pull request review comments, evaluates whether code changes are needed, and drafts replies. The tool fetches PR comments for the current branch, reads the relevant code context, proposes fixes, and posts replies to GitHub after user confirmation. It also handles committing and pushing approved changes with conventional commit messages.

read3 min publishedMay 28, 2026

| description | Walk through unresolved PR review comments one at a time for the PR on the current branch β€” evaluate, optionally fix, draft a reply, then prompt the user for the final reply text and whether to resolve before posting both to GitHub. | |---|

$ARGUMENTS

Consider the user input before proceeding (if not empty). It may name a specific comment author, file, or thread to focus on β€” narrow the loop accordingly.

Run in parallel:

git branch --show-current

β€” must not bemain

ormaster

.gh auth status

β€” must be authenticated.

If either fails, stop and tell the user what to fix.

Run the helper script:

.claude/skills/address-pr-comments/scripts/fetch-pr-comments.sh

It auto-detects the repo + PR for the current branch and emits JSON of the shape:

{
  "pr_number": 123,
  "repo": "owner/name",
  "threads": [
    {
      "thread_id": "PRRT_...",
      "comment_database_id": 1234567,
      "path": "app/foo.py",
      "line": 42,
      "author": "reviewer",
      "body": "...",
      "diff_hunk": "...",
      "url": "https://github.com/..."
    }
  ]
}

If threads

is empty, report "No unresolved review comments on PR #N" and stop β€” do not invent work.

Print Found N unresolved thread(s) on PR #X

and a one-line preview per thread (@author at path:line β€” first line of body

) so the user knows what's coming.

For each thread in order:

Print a header and the comment verbatim:

─── Comment N/M ─── @author at path:line ───
<quoted body>
<url>

Use Read

on the file at path

around line

(Β±10 lines) so the evaluation reflects the code as it is now, not as it was when the review was written.

In 1–3 sentences, state whether a code change is needed and why, referencing the current file state. Be explicit when the comment is already addressed by a later commit ("already fixed in 8c3ca9e β€” no further change needed").

Propose the edit in one sentence (e.g. "Apply: extract the URL-encoding into a helper in app/lib/s3.py

?"). On confirmation, use Edit

to apply it.

One short sentence. If a fix was applied, reference what changed in plain language ("Good catch β€” extracted the validator into helpers.py

."). If no fix, explain why ("Intentional β€” the upstream service guarantees non-null here.").

Invoke AskUserQuestion with two questions in a single call:

"Reply text?"β€” options:Use drafted reply

,Custom

(user selects "Other" and types)."Resolve this thread?"β€” options:Yes

,No

.

gh api -X POST "repos/$REPO/pulls/$PR_NUMBER/comments/$COMMENT_DATABASE_ID/replies" \
  -f body="$REPLY"

$COMMENT_DATABASE_ID

is the integer comment_database_id

from the JSON β€” not the GraphQL node ID.

gh api graphql \
  -f query='mutation($id: ID!) { resolveReviewThread(input: {threadId: $id}) { thread { id isResolved } } }' \
  -f id="$THREAD_ID"

$THREAD_ID

is the PRRT_...

thread_id

from the JSON.

Draft a one-line commit message (conventional-commit style β€” e.g. fix: extract URL-encoding helper for S3 paths

). Show it to the user verbatim and ask via AskUserQuestion

:

"Commit and push this fix?"β€” options:Use drafted message

,Custom

(user selects "Other" and types),Skip

.

On approval, run:

git add <edited files>
git commit -m "$MESSAGE"
git push

Do not append Co-Authored-By

or any signature β€” the commit body is the approved message text only, nothing else. Never use --no-verify

or --amend

.

Report:

  • Threads replied to: N
  • Threads resolved: M
  • Commits pushed: list short SHAs + messages
  • Files edited but not committed (skipped at 4i): list them

If any edits were skipped at 4i, remind the user to commit them (/commit

skill is available in this repo).

Never commit or push without explicit per-thread approval in step 4i. Never--amend

.Never addCo-Authored-By

or any signature line to commit messages β€” body is the approved text only.Never use--no-verify

or bypass hooks.Always show the proposed code edit before applying it.One thread at a time. Do not batchAskUserQuestion

prompts across threads β€” the user wants to see and decide per comment.- If the script returns zero threads, exit cleanly. Do not search for other comment sources.

  • The reply uses the integercomment ID (comment_database_id

); the resolve mutation uses thePRRT_...

nodeID (thread_id

). Mixing them up will 404 / fail GraphQL validation.

── more in #ai-tools 4 stories Β· sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/claude-skill-to-addr…] indexed:0 read:3min 2026-05-28 Β· β€”