changelog/tooling/automated-pr-analysis-guide.md
This document describes an efficient methodology for analyzing large numbers of pull requests (PRs) to generate comprehensive release documentation focusing on public-facing API changes, flag modifications, and breaking changes.
Key Innovation: Specialized Agent Architecture
Instead of manually reviewing hundreds of PRs, we used specialized pr-flag-metric-tracker agents that can work in parallel to analyze
PRs systematically for specific types of changes. The agent description can be found in the file pr-flag-metric-tracker.md. This can be copied into the .claude/agents directory.
gh api 'repos/org/repo/issues?milestone=X&state=all' --paginate --jq '.[].number'
Key Innovation: Check merge status BEFORE analysis to avoid wasting time on unmerged PRs
gh pr view PR_URL --json state,mergedAt
Decision Tree:
Deploy agents in batches of 5-10 PRs simultaneously for maximum parallelization while avoiding rate limits.
By using a template, we can guide the agents to no be wordy and write a lot of unneccesary info to the reports that would then just take time to read and ignore. The agent profile describes a specific template to use.
Ensure agents only use pre-approved GitHub commands to avoid permission prompts:
What Worked Well
Each PR gets a focused report following the standard template, making it easy to:
Parse all individual reports to create comprehensive release documentation with:
gh): Authenticated and configured (gh auth login)pr-flag-metric-tracker.md to your .claude/agents/ directory# Authenticate GitHub CLI if not already done
gh auth login
# Copy agent definition to Claude agents directory
cp pr-flag-metric-tracker.md ~/.claude/agents/
# Create working directory
mkdir release-analysis && cd release-analysis
# Get milestone ID from GitHub UI, then fetch all PR numbers
gh api 'repos/vitessio/vitess/issues?milestone=MILESTONE_ID&state=all' --paginate --jq '.[].number' > all_pr_numbers.txt
# Verify count
echo "Total PRs to analyze: $(wc -l < all_pr_numbers.txt)"
Launch agents in batches of 5 PRs at a time using this prompt template:
Analyze these 5 PRs in batch. For each:
1. Check merge: gh pr view https://github.com/vitessio/vitess/pull/XXXX --json state,mergedAt
2. If NOT merged: Create PRXXXX.md with just "PR not merged"
3. If MERGED: Create full analysis with template focusing on public-facing changes
PRs: 18520, 18521, 18522, 18523, 18524
Use ONLY: gh pr view, gh pr diff, gh api, Edit tool. Focus on flags, metrics, APIs, parser changes, query planning.
# Check completion status
ls PR*.md | wc -l
echo "Progress: $(ls PR*.md | wc -l)/$(wc -l < all_pr_numbers.txt)"
Once all PRs analyzed, create comprehensive release documentation by parsing individual reports into structured tables.
Permission Errors with GitHub CLI:
gh pr view, gh pr diff, gh api are pre-approved in Claude CodeAgent Rate Limiting:
Inconsistent Report Formats:
Missing PRs:
Time Performance:
Output Quality: