{"slug": "claude-skill-to-address-pr-comments", "title": "Claude skill to address PR comments", "summary": "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.", "body_md": "| 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. |\n|---|\n\n```\n$ARGUMENTS\n```\n\nConsider 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.\n\nRun in parallel:\n\n`git branch --show-current`\n\n— must not be`main`\n\nor`master`\n\n.`gh auth status`\n\n— must be authenticated.\n\nIf either fails, stop and tell the user what to fix.\n\nRun the helper script:\n\n```\n.claude/skills/address-pr-comments/scripts/fetch-pr-comments.sh\n```\n\nIt auto-detects the repo + PR for the current branch and emits JSON of the shape:\n\n```\n{\n  \"pr_number\": 123,\n  \"repo\": \"owner/name\",\n  \"threads\": [\n    {\n      \"thread_id\": \"PRRT_...\",\n      \"comment_database_id\": 1234567,\n      \"path\": \"app/foo.py\",\n      \"line\": 42,\n      \"author\": \"reviewer\",\n      \"body\": \"...\",\n      \"diff_hunk\": \"...\",\n      \"url\": \"https://github.com/...\"\n    }\n  ]\n}\n```\n\nIf `threads`\n\nis empty, report \"No unresolved review comments on PR #N\" and stop — do not invent work.\n\nPrint `Found N unresolved thread(s) on PR #X`\n\nand a one-line preview per thread (`@author at path:line — first line of body`\n\n) so the user knows what's coming.\n\nFor each thread in order:\n\nPrint a header and the comment verbatim:\n\n```\n─── Comment N/M ─── @author at path:line ───\n<quoted body>\n<url>\n```\n\nUse `Read`\n\non the file at `path`\n\naround `line`\n\n(±10 lines) so the evaluation reflects the code as it is *now*, not as it was when the review was written.\n\nIn 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\").\n\nPropose the edit in one sentence (e.g. \"Apply: extract the URL-encoding into a helper in `app/lib/s3.py`\n\n?\"). On confirmation, use `Edit`\n\nto apply it.\n\nOne short sentence. If a fix was applied, reference what changed in plain language (\"Good catch — extracted the validator into `helpers.py`\n\n.\"). If no fix, explain why (\"Intentional — the upstream service guarantees non-null here.\").\n\n**Invoke AskUserQuestion with two questions in a single call:**\n\n**\"Reply text?\"**— options:`Use drafted reply`\n\n,`Custom`\n\n(user selects \"Other\" and types).**\"Resolve this thread?\"**— options:`Yes`\n\n,`No`\n\n.\n\n```\ngh api -X POST \"repos/$REPO/pulls/$PR_NUMBER/comments/$COMMENT_DATABASE_ID/replies\" \\\n  -f body=\"$REPLY\"\n```\n\n`$COMMENT_DATABASE_ID`\n\nis the integer `comment_database_id`\n\nfrom the JSON — *not* the GraphQL node ID.\n\n```\ngh api graphql \\\n  -f query='mutation($id: ID!) { resolveReviewThread(input: {threadId: $id}) { thread { id isResolved } } }' \\\n  -f id=\"$THREAD_ID\"\n```\n\n`$THREAD_ID`\n\nis the `PRRT_...`\n\n`thread_id`\n\nfrom the JSON.\n\nDraft a one-line commit message (conventional-commit style — e.g. `fix: extract URL-encoding helper for S3 paths`\n\n). Show it to the user verbatim and ask via `AskUserQuestion`\n\n:\n\n**\"Commit and push this fix?\"**— options:`Use drafted message`\n\n,`Custom`\n\n(user selects \"Other\" and types),`Skip`\n\n.\n\nOn approval, run:\n\n```\ngit add <edited files>\ngit commit -m \"$MESSAGE\"\ngit push\n```\n\nDo **not** append `Co-Authored-By`\n\nor any signature — the commit body is the approved message text only, nothing else. Never use `--no-verify`\n\nor `--amend`\n\n.\n\nReport:\n\n- Threads replied to: N\n- Threads resolved: M\n- Commits pushed: list short SHAs + messages\n- Files edited but not committed (skipped at 4i): list them\n\nIf any edits were skipped at 4i, remind the user to commit them (`/commit`\n\nskill is available in this repo).\n\n**Never** commit or push without explicit per-thread approval in step 4i. Never`--amend`\n\n.**Never** add`Co-Authored-By`\n\nor any signature line to commit messages — body is the approved text only.**Never** use`--no-verify`\n\nor bypass hooks.**Always** show the proposed code edit before applying it.**One thread at a time.** Do not batch`AskUserQuestion`\n\nprompts 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.\n- The reply uses the\n*integer*comment ID (`comment_database_id`\n\n); the resolve mutation uses the`PRRT_...`\n\n*node*ID (`thread_id`\n\n). Mixing them up will 404 / fail GraphQL validation.", "url": "https://wpnews.pro/news/claude-skill-to-address-pr-comments", "canonical_source": "https://gist.github.com/samuel1992/65de47a7bf34e7f04dd6a08fcf93beb7", "published_at": "2026-05-28 22:36:43+00:00", "updated_at": "2026-05-28 23:43:48.646586+00:00", "lang": "en", "topics": ["ai-tools", "ai-products", "mlops"], "entities": ["GitHub", "Claude"], "alternates": {"html": "https://wpnews.pro/news/claude-skill-to-address-pr-comments", "markdown": "https://wpnews.pro/news/claude-skill-to-address-pr-comments.md", "text": "https://wpnews.pro/news/claude-skill-to-address-pr-comments.txt", "jsonld": "https://wpnews.pro/news/claude-skill-to-address-pr-comments.jsonld"}}