Get the FREE Ultimate OpenClaw Setup Guide →

pr-comments

Scanned
npx machina-cli add skill YoniChechik/claude-code-config/pr-comments --openclaw
Files (1)
SKILL.md
3.3 KB

Displays all comments (from users and bots) and test results for a pull request, then helps triage them interactively.

Optional PR number from user input

"$ARGUMENTS"

Argument Handling

  • If PR number provided: Use specified PR
  • If empty: Use PR for current branch (via gh pr view)

Process

Step 1: Determine PR Number

Get the PR number to query:

# If user provided PR number, use it; otherwise get current branch's PR
if [ -n "$ARGUMENTS" ]; then
  PR_NUM="$ARGUMENTS"
else
  PR_NUM=$(gh pr view --json number --jq '.number' 2>/dev/null)
  if [ -z "$PR_NUM" ]; then
    echo "Error: No PR number provided and current branch has no associated PR"
    exit 1
  fi
fi

Step 2: Fetch All Data

Retrieve PR comments, review comments, and test results:

# Get basic PR info
PR_INFO=$(gh pr view "$PR_NUM" --json title,author,url)
PR_TITLE=$(echo "$PR_INFO" | jq -r '.title')
PR_URL=$(echo "$PR_INFO" | jq -r '.url')
PR_AUTHOR=$(echo "$PR_INFO" | jq -r '.author.login')

# Get PR issue comments (conversation tab)
COMMENTS=$(gh pr view "$PR_NUM" --json comments --jq '.comments[]? | "**[\(.author.login)]** _\(.createdAt)_\n\(.body)\n"')
if [ -z "$COMMENTS" ]; then
  COMMENTS="No comments found"
fi

# Get review comments with IDs (inline code comments)
REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner')
REVIEW_COMMENTS=$(gh api "repos/$REPO/pulls/$PR_NUM/comments" --jq '.[]? | "[ID: \(.id)] **[\(.user.login)]** _\(.path):\(.line // .original_line)_\n\(.body)\n"')
if [ -z "$REVIEW_COMMENTS" ]; then
  REVIEW_COMMENTS="No review comments found"
fi

# Get test/check results
CHECKS=$(gh pr checks "$PR_NUM" --json name,status,conclusion,detailsUrl)

Step 3: Display All Comments and Tests

Show structured report with all data:

cat <<EOF
# PR #$PR_NUM: $PR_TITLE

**Author**: $PR_AUTHOR
**URL**: $PR_URL

---

## Comments

$COMMENTS

---

## Review Comments

$REVIEW_COMMENTS

---

## Test Results

$(echo "$CHECKS" | jq -r '.[] | "- [\(.conclusion // .status | ascii_upcase)] **\(.name)**\n  \(.detailsUrl)"')

---
EOF

Step 4: Interactive Triage

Ask user to categorize each comment:

  • What to fix? - Comments that need to be addressed (leave as is)
  • What to ignore? - Comments to ignore (resolve + comment "ignore")
  • What is outdated? - Comments no longer relevant (resolve + comment "outdated")
  • What is fixed? - Comments already addressed (comment "fixed")

Step 5: Process User Decisions

For each category, execute the appropriate actions:

Ignore comments:

# For each comment ID to ignore
gh api "repos/$REPO/pulls/$PR_NUM/comments/$COMMENT_ID/replies" -f body="ignore"
# Mark as resolved if it's a review comment thread

Fixed comments:

# For each comment ID that's fixed
gh api "repos/$REPO/pulls/$PR_NUM/comments/$COMMENT_ID/replies" -f body="fixed"

Outdated comments:

# For each comment ID that's outdated
gh api "repos/$REPO/pulls/$PR_NUM/comments/$COMMENT_ID/replies" -f body="outdated"
# Mark as resolved

Untouched comments:

  • Leave as is (no action needed)

Step 6: Summary

Display summary of actions taken:

  • X comments marked as ignore
  • X comments marked as fixed
  • X comments marked as outdated
  • X comments left for review

Source

git clone https://github.com/YoniChechik/claude-code-config/blob/main/skills/pr-comments/SKILL.mdView on GitHub

Overview

Displays all PR comments (from users and bots) and test results for a pull request, then guides you through interactive triage. This helps teams quickly surface feedback and decide what to fix, ignore, or mark as outdated before merging.

How This Skill Works

You provide a PR number or let the tool resolve the PR from the current branch using gh pr view. It fetches PR data, comments, inline review comments, and checks with gh pr view and gh api, builds a structured report, and prompts you to categorize each item. Actions are applied via gh api to mark comments as fixed, ignore, or outdated.

When to Use It

  • When you need a complete view of all PR comments and test results before merging
  • When a PR has many comments from multiple reviewers and bots
  • When a PR from the current branch needs triage but no PR number was provided
  • When you want to quickly identify comments that are outdated or already fixed
  • When preparing a triage summary for release or stakeholder review

Quick Start

  1. Step 1: Provide the PR number as an argument or run on the current branch to resolve the PR
  2. Step 2: The tool fetches PR info, comments, review comments, and test results from gh pr view and gh api
  3. Step 3: Review the report and interactively categorize each item, applying actions via gh api

Best Practices

  • Fetch the latest PR data by providing a PR number or letting the tool resolve it from the current branch
  • Review the structured sections: Comments, Review Comments, and Test Results before triage
  • Use clear action terms in triage: ignore, outdated, fixed, or leave untouched
  • Make actions idempotent and verify the correct PR and comment IDs are targeted
  • Document key decisions in the PR thread after triage for transparency

Example Use Cases

  • Team triages a busy PR with dozens of comments and automated test results
  • Maintainer resolves bot-generated comments by marking them fixed
  • New contributor PR is guided through triage to surface missing docs or tests
  • Hotfix PR with no explicit PR number uses the current branch to fetch and triage
  • No comments case gracefully shows No comments found and continues to show review comments and checks

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers