Gh Address Comments

Automate and integrate GitHub Address Comments workflows efficiently

Gh Address Comments is a community skill for systematically resolving pull request review comments on GitHub, tracking feedback items, implementing requested changes, and verifying each resolution before marking conversations as complete.

What Is This?

Overview

Gh Address Comments provides workflows for handling code review feedback on GitHub pull requests efficiently. It covers comment categorization, priority assessment, change implementation strategies, batch response patterns, and verification steps that confirm each piece of feedback has been addressed. The skill turns the often chaotic review resolution process into a structured, trackable workflow.

Who Should Use This

This skill serves developers receiving pull request reviews who need to address multiple comments systematically, team leads ensuring all review feedback gets resolved before merge, and automated tools that assist developers in processing review comments programmatically.

Why Use It?

Problems It Solves

Large pull requests accumulate dozens of review comments that are easy to miss when addressed individually. Without tracking, some comments get resolved while others remain unnoticed until a follow-up review. Interleaving code changes for different review comments creates merge conflicts and confusing commit histories. Responding to feedback without verifying the fix actually resolves the concern leads to repeated review cycles.

Core Highlights

Comment extraction pulls all pending review threads from a pull request into a structured list. Priority classification separates blocking issues from style suggestions and questions. Grouped implementation applies related changes together to reduce commit noise. Verification checks confirm that each addressed comment actually resolves the original concern before marking the thread as resolved.

How to Use It?

Basic Usage

import subprocess
import json
from dataclasses import dataclass, field

@dataclass
class ReviewComment:
    id: int
    path: str
    line: int
    body: str
    author: str
    resolved: bool = False

def fetch_comments(pr_number: int) -> list[ReviewComment]:
    result = subprocess.run(
        ["gh", "api", f"repos/:owner/:repo/pulls/{pr_number}/comments"],
        capture_output=True, text=True
    )
    comments = []
    for c in json.loads(result.stdout):
        comments.append(ReviewComment(
            id=c["id"], path=c["path"],
            line=c.get("line", 0), body=c["body"],
            author=c["user"]["login"]
        ))
    return comments

def group_by_file(comments: list[ReviewComment]) -> dict:
    grouped = {}
    for c in comments:
        grouped.setdefault(c.path, []).append(c)
    return grouped

Real-World Examples

class CommentResolver:
    PRIORITY_KEYWORDS = {
        "blocking": ["bug", "security", "broken", "crash"],
        "important": ["should", "please change", "needs"],
        "suggestion": ["nit", "optional", "consider", "minor"]
    }

    def classify(self, comment: ReviewComment) -> str:
        body_lower = comment.body.lower()
        for priority, keywords in self.PRIORITY_KEYWORDS.items():
            if any(kw in body_lower for kw in keywords):
                return priority
        return "suggestion"

    def create_plan(self, comments: list[ReviewComment]) -> list[dict]:
        classified = []
        for c in comments:
            classified.append({
                "id": c.id, "file": c.path, "line": c.line,
                "priority": self.classify(c),
                "summary": c.body[:100]
            })
        classified.sort(key=lambda x: {
            "blocking": 0, "important": 1, "suggestion": 2
        }.get(x["priority"], 3))
        return classified

Advanced Tips

Address all comments in the same file together in a single commit to keep the change history clean and reviewable. Reply to each comment thread explaining what was changed before resolving it so reviewers can verify without re-reading the full diff. Batch non-blocking suggestions into a separate commit that can be reviewed independently from critical fixes.

When to Use It?

Use Cases

Process large pull request reviews with dozens of comments across multiple files. Build automated assistants that extract and categorize review feedback for developers. Track review resolution progress across team pull requests to identify bottlenecks.

Related Topics

GitHub API for pull request management, code review best practices, Git commit organization strategies, and continuous integration feedback loops.

Important Notes

Requirements

The GitHub CLI installed and authenticated with repository access, permissions to read and respond to pull request comments, and a local checkout of the repository for implementing requested changes.

Usage Recommendations

Do: address blocking issues first before moving to style suggestions. Reply to each comment explaining the resolution before marking it resolved. Run tests after each batch of changes to confirm nothing breaks.

Don't: resolve comment threads without actually making the requested change. Squash all review responses into a single commit that mixes unrelated changes. Ignore questions from reviewers that require a response rather than a code change.

Limitations

Automated comment classification may misinterpret tone or intent of nuanced review feedback. Some comments require broader design discussions rather than direct code changes. Comment threading in the GitHub API does not always expose the full conversation context needed to understand dependent feedback chains.