nathanchase

address-pr-comments

0
0
# Install this skill:
npx skills add nathanchase/claude-code-starter --skill "address-pr-comments"

Install specific skill from multi-skill repository

# Description

Automatically address unresolved PR review comments, commit fixes, and resolve threads

# SKILL.md


name: address-pr-comments
description: Automatically address unresolved PR review comments, commit fixes, and resolve threads


Address PR Comments

Fetch unresolved PR review comments, propose fixes for user approval, implement approved changes, commit and push, then mark comments as resolved.

Invocation

  • /address-pr-comments - Uses current branch's PR
  • /address-pr-comments 123 - Addresses comments on PR #123
  • "address the PR comments" or "fix the PR review comments"

Instructions

1. Identify the Pull Request

If a PR number is provided as an argument, use that. Otherwise:

git branch --show-current
gh pr list --head <branch-name> --json number,url --jq '.[0]'

2. Fetch Unresolved Review Threads

gh api graphql -f query='
query($owner: String!, $repo: String!, $pr: Int!) {
  repository(owner: $owner, name: $repo) {
    pullRequest(number: $pr) {
      reviewThreads(first: 50) {
        nodes {
          id
          isResolved
          path
          line
          comments(first: 10) {
            nodes {
              body
              author { login }
            }
          }
        }
      }
    }
  }
}' -f owner=<OWNER> -f repo=<REPO> -F pr=<PR_NUMBER>

Filter to only unresolved threads (isResolved: false).

3. Present Comments and Get User Approval

CRITICAL: Always ask for user confirmation before making changes.

For each unresolved comment:
1. Read the file mentioned in the thread's path field
2. Analyze the comment β€” understand what change is being requested
3. Propose a fix β€” explain what you plan to change
4. Use AskUserQuestion to get approval before implementing

Options:
- "Apply this fix" - Implement the proposed change
- "Skip this comment" - Don't address, don't resolve
- "Mark resolved without changes" - Already fixed or not applicable

4. Implement Approved Changes

Only after user approval β€” make code changes for approved fixes.

5. Commit and Push Changes

git add -A
git commit -m "fix: address PR review comments

- <summary of changes made>"
git push origin <branch-name>

6. Resolve Approved Threads

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

7. Report Summary

  • Number of comments addressed vs. skipped
  • Files modified
  • Commit hash
  • Link to the PR

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.