SuperAPI AI Directory

pr-review-analysis

General & other

View repository

Updated 10-15 17:29

About this skill

PR Review Analysis

Fetch and analyze GitHub PR review comments, verify the validity of each point raised, and output a report.

Workflow

Step 1: Fetching review comments

  1. Receive the PR URL or repository information and PR number from the user
  2. gh api Use to fetch the review comments:
    gh api repos/{owner}/{repo}/pulls/{number}/reviews
    gh api repos/{owner}/{repo}/pulls/{number}/comments
    
  3. Parse the list of comments and organize the points raised, target files, and line numbers

Step 2: Verifying each point raised

For each review comment:

  1. Checking the relevant code: Read the file and line referenced by the comment using the Read tool
  2. Analyzing the point raised: Verify whether the reviewer's claim is technically correct
  3. Determining validity:
    • ✅ Valid (Valid): The point is correct and a fix is needed
    • ❌ Invalid (Invalid): The point is wrong or does not apply
    • ⚠️ Partially valid (Partial): Part of the point is correct, but it does not fully apply

Step 3: Checking the scope of impact

Use the Grep tool to check whether the pattern referenced by the comment (bug, anti-pattern, etc.) also exists in other files. If the same pattern exists in multiple places, include those in the report as well.

Step 4: Report output

Output the summary in the following format:

## PR Review Analysis: #{PR番号}

### Summary
- Total comments: {件数}
- Valid: {件数} | Partial: {件数} | Invalid: {件数}

### Details

| # | File | Severity | Validity | Summary | Action |
|---|------|----------|----------|---------|--------|
| 1 | path/to/file.ts:L42 | Major | ✅ Valid | 説明 | 修正必要 |
| 2 | path/to/file.ts:L100 | Minor | ⚠️ Partial | 説明 | 検討 |

### Detailed Analysis

#### Comment 1: [タイトル]
- **File**: `path/to/file.ts:L42`
- **Reviewer's point**: 指摘内容の要約
- **Verification**: 検証結果の説明
- **Verdict**: ✅ Valid
- **Recommended action**: 具体的な修正方針
- **Same pattern found in**: (該当する場合) 他のファイルパス

...

Step 5: Replying to review comments

After outputting the report, if the fix has been completed, propose a reply to the review comments.

  1. User confirmation: Ask "Would you like to reply to the comments?" Only execute replies if the user approves
  2. Generating reply content: Generate a reply according to the Verdict for each comment:
    • ✅ Valid: Reply in the format "Fixed in {hash}" including the fix commit hash
    • ⚠️ Partial: Briefly explain the parts addressed and the reasons for not addressing the rest
    • ❌ Invalid: Technically explain why it does not apply (e.g., it is a generated file and cannot be edited directly)
  3. Executing replies: gh api Reply to each comment with:
    gh api repos/{owner}/{repo}/pulls/{number}/comments \
      -f body='{返信内容}' \
      -F in_reply_to={comment_id}
    
  4. Handling outside-diff comments: For points that cannot be replied to as inline comments (outside-diff), reply collectively in the thread of a related inline comment

Notes

  • Support both bot reviews (CodeRabbit, GitHub Actions, etc.) and human reviews
  • Also consider reply threads to review comments
  • Estimate the severity of the point from the review comment's label or content
  • Output in Japanese (keep technical terms such as code and paths in their original form)