
pr-comment-analysis
Extract, consolidate, and prioritize all comments from GitHub Pull Requests for systematic code revi
PR Comment Analysis - Quick Start Guide
Problem Solved: Automates extraction, filtering, and presentation of PR code review comments (including Qodo, CodeRabbit, and other bots) directly to Claude, with iterative loops until all issues are addressed.
🎯 What This Skill Does
Extracts ALL comments from GitHub PRs (inline reviews + general comments), filters out verbose summaries, and presents actionable feedback to Claude in a readable format. Includes iterative review loops and progress tracking with strikethrough for addressed items.
🚀 Quick Start (Recommended Workflow)
One-Time Setup
-
Set GitHub Token
# Option 1: Environment variable export GITHUB_TOKEN=ghp_xxxxxxxxxxxx # Option 2: .env file in your repo echo "GITHUB_TOKEN=ghp_xxxxxxxxxxxx" >> .env -
Verify Token Permissions
- Your token must have
reposcope (for private repos) orpublic_repo(for public repos) - Create at: https://github.com/settings/tokens/new
- Your token must have
Basic Usage: One-Time Analysis
cd /path/to/your/repo
/path/to/pr-comment-analysis/scripts/analyze-pr.sh owner/repo PR_NUMBER
Example:
cd ~/projects/my-app
~/skills/pr-comment-analysis/scripts/analyze-pr.sh myorg/my-app 456
What it does:
- ✅ Fetches ALL PR comments from GitHub API
- ✅ Filters to actionable items (removes verbose summaries)
- ✅ Explicitly checks for Qodo comment preservation
- ✅ Generates Claude-readable markdown summary
- ✅ Shows preview and next steps
Output:
pr-code-review-comments/pr456-analysis.md- Markdown summary for Claudepr-code-review-comments/pr456-code-review-comments-filtered.json- Structured JSON
Advanced Usage: Iterative Review Loop
cd /path/to/your/repo
/path/to/pr-comment-analysis/scripts/review-loop.sh owner/repo PR_NUMBER
What it does:
- Fetches and filters PR comments
- Shows Claude the unaddressed comments
- Waits for you to fix issues and commit
- Marks addressed comments
- Repeats until no actionable comments remain
Interactive mode (asks before each iteration):
./scripts/review-loop.sh owner/repo 456
Auto mode (waits 30 seconds between iterations):
./scripts/review-loop.sh owner/repo 456 --auto
Checking Progress
# See all comments with status markers
python scripts/show-with-status.py 456
# See only pending comments
python scripts/show-with-status.py 456 --unaddressed-only
# Save report to file
python scripts/show-with-status.py 456 --output review-status.md
Output format:
# PR #456 Code Review Status
**Progress**: 60% complete (6/10 comments addressed)
## 📝 Pending Comments
### 📝 [coderabbitai[bot]] Review Comment
**Location**: src/api/auth.ts:45
**Priority**: 🔴 CRITICAL
**Preview**: SQL injection vulnerability in authentication...
---
<details>
<summary>✅ Addressed Comments (6)</summary>
### ✅ [coderabbitai[bot]] Review Comment
**Location**: ~~src/models/user.ts:89~~
**Preview**: ~~Missing null check for user.email...~~
</details>
🔧 Available Scripts
| Script | Purpose | When to Use |
|---|---|---|
analyze-pr.sh | One-time analysis with Claude-readable output | Initial PR review or checking current state |
review-loop.sh | Iterative loop until all comments addressed | Working through all PR feedback systematically |
show-with-status.py | Progress report with strikethrough | Checking what's left to do |
diagnose-qodo.py | Debug Qodo comment filtering | Troubleshooting missing bot comments |
pr-comment-grabber.py | Fetch raw comments from GitHub | Manual workflow or custom integrations |
pr-comment-filter.py | Filter to actionable comments | Manual workflow or custom filtering |
🐛 Troubleshooting
"Claude never sees Qodo comments"
Quick diagnostic:
# 1. Fetch comments
python scripts/pr-comment-grabber.py owner/repo 456
# 2. Run diagnostic
python scripts/diagnose-qodo.py pr-code-review-comments/pr456-code-review-comments.json
Common fixes:
- If Qodo comments have importance < 7: Edit
scripts/pr-comment-filter.pyline 112 to lower threshold - If "PR Compliance Guide" triggers filtering: Remove from
SUMMARY_MARKERSinpr-comment-filter.py - If using auto mode: Ensure
analyze-pr.shorreview-loop.sh(not manual steps)
See detailed troubleshooting: USAGE-GUIDE.md
"Comments being discarded as summaries"
Edit scripts/pr-comment-filter.py:
# Lines 27-39: Adjust SUMMARY_MARKERS
SUMMARY_MARKERS = [
'<!-- This is an auto-generated comment: summarize',
'## Walkthrough',
# 'PR Compliance Guide', # ← Comment out if Qodo uses this
]
"Loop never completes"
- Increase
MAX_ITERATIONSinreview-loop.sh(default: 10) - Check if bots are stuck in feedback loop
- Use
show-with-status.pyto see what's left
"Missing inline review comments"
Lower priority threshold in scripts/pr-comment-filter.py line 112:
# Was: if importance < 7: continue
# Try: if importance < 5: continue # Keep medium+ priority
📚 Documentation
- SKILL.md - Complete skill definition with advanced features
- USAGE-GUIDE.md - Comprehensive troubleshooting and configuration guide
scripts/- All automation scripts with inline documentation
🔑 Key Features
✅ Solves "Claude Never Sees Comments" Problem
Before (manual workflow):
- Run
pr-comment-grabber.py - Run
pr-comment-filter.py - Manual step: Provide filtered JSON to Claude ← Where comments got lost
After (automated workflow):
- Run
analyze-pr.sh→ Automatically shows Claude the filtered comments - Or run
review-loop.sh→ Iterates until all comments addressed
✅ Intelligent Content-Based Filtering
- Removes verbose bot summaries/walkthroughs
- Preserves actionable suggestions (even from bots)
- Extracts structured suggestions with priority levels
- Configurable markers and thresholds
✅ Iterative Review Loop
- Tracks addressed vs pending comments
- Waits for CI/bot responses
- Automatically detects new issues
- Stops when all comments resolved
✅ Progress Tracking
- Visual progress bars
- Strikethrough formatting for addressed items
- Collapsible sections for completed work
- JSON export for custom reporting
🎓 Example Workflows
Scenario 1: Initial PR Review
# Fetch and analyze PR #123
cd ~/projects/my-app
~/skills/pr-comment-analysis/scripts/analyze-pr.sh myorg/my-app 123
# Claude reads the generated analysis:
# "Claude, please read: pr-code-review-comments/pr123-analysis.md"
# Fix issues, commit, done
Scenario 2: Systematic Review Loop
# Start iterative loop for PR #123
cd ~/projects/my-app
~/skills/pr-comment-analysis/scripts/review-loop.sh myorg/my-app 123
# → Shows 15 actionable comments
# Fix issues, commit, press ENTER
# → Bot analyzes, shows 5 new comments
# Fix issues, commit, press ENTER
# → No comments remain
# "🎉 ALL COMMENTS ADDRESSED!"
Scenario 3: Check Progress Mid-Review
# While working through PR #123 in another terminal:
python ~/skills/pr-comment-analysis/scripts/show-with-status.py 123
# See progress bar and pending items
# Focus on what's left to do
⚙️ Configuration
Environment Variables
GITHUB_TOKEN(required) - Personal access token withrepoorpublic_reposcopeMAX_ITERATIONS(optional) - Max review loop iterations (default: 10)
Customizing Filters
Edit scripts/pr-comment-filter.py to adjust:
- Priority threshold (line 112) - Default: importance >= 7
- Summary markers (lines 27-39) - What counts as verbose summary
- Actionable markers (lines 27-39) - What counts as actionable content
Bot Whitelisting
If you only want specific bots:
# Create whitelist
cat > ~/.pr-review-bots.txt << 'EOF'
coderabbitai[bot]
qodo-merge-pro[bot]
EOF
# Filter before processing
jq --slurpfile bots <(jq -R . ~/.pr-review-bots.txt | jq -s .) \
'[.[] | select(.user as $u | $bots[0] | map(. == $u) | any)]' \
pr-code-review-comments/pr123-code-review-comments.json \
> pr-code-review-comments/pr123-bots-only.json
# Now analyze filtered file
python scripts/pr-comment-filter.py pr-code-review-comments/pr123-bots-only.json
📦 Requirements
- Python 3.6+
requestslibrary:pip install requestsjq(for shell scripts):sudo apt install jqorbrew install jq- GitHub Personal Access Token with
repoorpublic_reposcope
🔗 Integration
With Claude Code
# In your .claude/commands/ directory
cat > analyze-pr.sh << 'EOF'
#!/bin/bash
SKILL_DIR="/path/to/pr-comment-analysis"
$SKILL_DIR/scripts/analyze-pr.sh $@
EOF
chmod +x .claude/commands/analyze-pr.sh
# Now use: /analyze-pr owner/repo PR_NUMBER
With CI/CD
# .github/workflows/pr-analysis.yml
name: PR Comment Analysis
on: pull_request_review
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fetch PR comments
run: |
python scripts/pr-comment-grabber.py ${{ github.repository }} ${{ github.event.pull_request.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v2
with:
name: pr-comments
path: pr-code-review-comments/
📝 Output Files
All output goes to pr-code-review-comments/ in your repository:
prNN-code-review-comments.json- Raw fetched commentsprNN-code-review-comments-filtered.json- Actionable comments onlyprNN-analysis.md- Claude-readable markdown summaryprNN-review-state.json- Iterative loop state trackingprNN-unaddressed.json- Comments still pending
🎯 Best Practices
- Run
analyze-pr.shimmediately after review - Don't wait, context is fresh - Use
review-loop.shfor systematic cleanup - Ensures nothing is missed - Check
show-with-status.pyfor progress - Know what's left before asking for re-review - Lower priority threshold if needed - Some bots use different importance scales
- Commit with comment references -
git commit -m "fix: address SQL injection (comment #123)"
🆘 Getting Help
- Read diagnostics output - Scripts provide detailed error messages
- Run
diagnose-qodo.py- Understand why comments disappear - Check USAGE-GUIDE.md - Comprehensive troubleshooting
- Review SKILL.md - Full skill capabilities and advanced features
📄 License
Part of the Instructor Workflow project.
Quick Reference Card:
# Initial setup
export GITHUB_TOKEN=ghp_xxxxxxxxxxxx
# One-time analysis
./scripts/analyze-pr.sh owner/repo 123
# Iterative loop
./scripts/review-loop.sh owner/repo 123
# Check progress
python scripts/show-with-status.py 123
# Debug Qodo comments
python scripts/diagnose-qodo.py pr-code-review-comments/pr123-code-review-comments.json