| name | pr-authorship-analysis |
| description | Analyze PR authorship from the prior calendar month, identifying real human authors behind bot-created PRs. Use when users want monthly PR analysis, contributor statistics, or team productivity reports. |
Monthly PR Authorship Analysis Skill
This skill provides comprehensive analysis of all pull requests merged in the prior calendar month, with special focus on identifying the real human contributors behind bot-created PRs by examining commit histories.
When to Use This Skill
Use this skill when users ask about:
- Monthly PR analysis and contribution reports
- "PRs from last month" or "prior month's PRs"
- Monthly team productivity statistics
- Finding real contributors behind bot PRs from previous month
- Monthly contributor rankings
- Team performance for the completed month
- "Who worked on what last month" questions
Core Methodology
1. Prior Month Date Calculation
Automatic Date Range:
CURRENT_DATE=$(date +%Y-%m-%d)
PRIOR_MONTH_START=$(date -d "$(date +%Y-%m-01) -1 month" +%Y-%m-01)
PRIOR_MONTH_END=$(date -d "$(date +%Y-%m-01) -1 day" +%Y-%m-%d)
echo "Analyzing PRs from: $PRIOR_MONTH_START to $PRIOR_MONTH_END"
Complete Data Collection:
gh pr list --state merged --search "merged:>=$PRIOR_MONTH_START merged:<=$PRIOR_MONTH_END" --json number --limit 1000 | jq 'length'
gh pr list --state merged --search "merged:>=$PRIOR_MONTH_START merged:<=$PRIOR_MONTH_END" --json number,title,author,mergedAt,body --limit 1000
Important: Always verify the actual count vs requested limit. Round numbers (like 100, 500) often indicate you hit the limit rather than the true count.
2. Bot PR Identification
Look for PRs authored by common bot accounts:
app/kilo-code-bot
kilo-code-bot[bot]
kiloconnect[bot]
- Any account with
[bot] suffix
3. Human Author Discovery
For each bot PR, analyze commit history:
gh pr view [PR_NUMBER] --json commits
Commit Analysis Pattern:
- Extract
authors array from each commit
- Identify human vs bot authors by:
- Email domains (avoid
@users.noreply.github.com patterns for bots)
- Login names (avoid
[bot] suffixes)
- Real human names vs system names
Attribution Rules:
- Human + Bot Collaboration: Most common - bot creates initial commits, human refines
- Pure Human: Fully human work misclassified as bot PR
- Pure Bot: Genuinely automated with no human commits
4. Statistical Analysis
Author Mapping:
- Direct PRs (straightforward human authorship)
- Bot PRs → Human contributors (via commit analysis)
- Combined totals for accurate attribution
Key Metrics to Track:
- Total PRs analyzed
- Bot vs Human PR counts
- Human authors found in bot PRs vs purely automated
- Top contributors (direct + bot PR contributions)
- Collaboration patterns
Implementation Workflow
Phase 1: Prior Month Data Collection
- Calculate prior month dates - first day to last day of previous calendar month
- Get accurate count - verify not hitting limits for the month
- Extract complete dataset - all PRs merged in prior month with metadata
Phase 2: Initial Classification
- Separate bot vs human PRs
- Count human contributors from direct PRs
- Identify bot PR candidates for analysis
Phase 3: Bot PR Analysis
For small datasets (< 50 bot PRs):
- Analyze all bot PRs directly
For large datasets (> 50 bot PRs):
- Sample analysis first (10-20 PRs) to validate approach
- Batch processing (50 at a time) with progress monitoring
- Full analysis once methodology confirmed
Phase 4: Human Author Attribution
- Extract commit data for each bot PR
- Identify human contributors from commit authors
- Map bot PRs to their real human authors
- Handle edge cases: multiple authors, partial automation
Phase 5: Final Analysis & Report Generation
- Combine statistics - direct PRs + bot PR attributions
- Rank contributors by total contributions
- Identify patterns - automation usage, collaboration styles
- Generate insights - development velocity, tooling adoption
- Save results - create markdown report in
.reports/ directory
Sample Code Patterns
Getting Prior Month PR Data
PRIOR_MONTH_START=$(date -d "$(date +%Y-%m-01) -1 month" +%Y-%m-01)
PRIOR_MONTH_END=$(date -d "$(date +%Y-%m-01) -1 day" +%Y-%m-%d)
echo "Analyzing prior month: $PRIOR_MONTH_START to $PRIOR_MONTH_END"
TOTAL_PRS=$(gh pr list --state merged --search "merged:>=$PRIOR_MONTH_START merged:<=$PRIOR_MONTH_END" --json number --limit 1000 | jq 'length')
echo "Total PRs in prior month: $TOTAL_PRS"
if [ $TOTAL_PRS -eq 1000 ]; then
echo "Warning: May have hit limit, consider pagination"
fi
gh pr list --state merged --search "merged:>=$PRIOR_MONTH_START merged:<=$PRIOR_MONTH_END" --json number,title,author,mergedAt,body --limit 1500
Analyzing Bot PR Commits
for pr_num in $bot_pr_numbers; do
echo "Analyzing PR #$pr_num"
gh pr view $pr_num --json commits
done
Saving Results
mkdir -p .reports
REPORT_DATE=$(date -d "$(date +%Y-%m-01) -1 month" +%Y-%m)
REPORT_FILE=".reports/pr-analysis-${REPORT_DATE}.md"
cat > $REPORT_FILE <<EOF
# PR Analysis Report: $REPORT_DATE
## Summary
- **Analysis Date**: $(date +%Y-%m-%d)
- **Period**: $PRIOR_MONTH_START to $PRIOR_MONTH_END
- **Total PRs**: $TOTAL_PRS
- **Bot PRs**: $BOT_PR_COUNT
- **Human-contributed Bot PRs**: $HUMAN_BOT_PR_COUNT
## Top Contributors
[Generated contributor rankings with direct + bot PR counts]
## Analysis Details
[Detailed breakdown of findings]
EOF
echo "Report saved to: $REPORT_FILE"
Common Patterns Discovered
Bot Collaboration Types
- Bot Initiator: Bot creates PR, human iterates (most common)
- Human Initiator: Human work routed through bot workflow
- Pure Automation: Genuinely bot-only work (typically 20-50% of bot PRs)
Email Address Patterns
- Human emails: Real domains, personal addresses
- Bot emails:
[number]+[botname][bot]@users.noreply.github.com
- System emails:
kilo@example.com, generic test accounts
Development Insights
- Heavy bot users often most productive contributors overall
- Bot workflows enable rapid iteration and refinement
- True automation focuses on maintenance, dependencies, formatting
- Human-bot collaboration shows sophisticated tooling integration
Error Handling
Common Issues
- Rate limiting: Use delays between API calls if needed
- Invalid PRs: Some PR numbers may not exist, handle gracefully
- Empty commit data: Some PRs may have no commit info
- Mixed authorship: PRs with both human and bot commits
Validation Steps
- Cross-reference total counts with manual verification
- Sample-check commit analysis results
- Verify human names aren't misclassified bot accounts
- Confirm attribution makes logical sense
Usage Examples
Basic Monthly Analysis
/pr-authorship-analysis "Analyze all PRs from last month"
Prior Month Bot Analysis
/pr-authorship-analysis "Find real authors behind bot PRs from the prior calendar month"
Monthly Team Report
/pr-authorship-analysis "Generate monthly contributor report for the completed month"
Specific Month Analysis
/pr-authorship-analysis "Show me March 2026 PR statistics with real authors"
Expected Outcomes
This skill will provide monthly reports with:
- Prior month contributor rankings including previously hidden human work behind bot PRs
- Monthly development velocity with accurate human attribution
- Team productivity insights showing automation adoption patterns for the month
- Bot vs human collaboration patterns from the completed calendar month
- True monthly metrics properly attributing bot-assisted contributions
The analysis typically reveals that 50-80% of "bot" PRs actually contain significant human contributions, providing accurate monthly team performance data and proper attribution to developers using advanced AI-assisted workflows.
Output and Storage
Report Location:
Results are automatically saved to .reports/pr-analysis-YYYY-MM.md where YYYY-MM represents the analyzed month.
Example Report Path:
- March 2026 analysis →
.reports/pr-analysis-2026-03.md
- February 2026 analysis →
.reports/pr-analysis-2026-02.md
Report Structure:
# PR Analysis Report: 2026-03
## Executive Summary
- **Analysis Date**: 2026-04-01
- **Period**: 2026-03-01 to 2026-03-31
- **Total PRs**: 739
- **Bot PRs**: 141 (19.1%)
- **Human-contributed Bot PRs**: 70 (50% of bot PRs)
## Top Contributors
1. **Christiaan Arnoldus**: 142 PRs (99 direct + 43 bot collaborations)
2. **eshurakov**: 82 PRs (78 direct + 4 bot collaborations)
3. **jrf0110**: 71 PRs (all direct)
## Bot Analysis Details
- Pure automation: 71 PRs
- Human collaboration: 70 PRs
- Most active bot collaborator: Christiaan Arnoldus (43 PRs)
## Team Insights
- Team velocity: 23.6 PRs per day
- Bot adoption: 19.1% of PRs use bot workflows
- Human-AI collaboration: 50% of bot PRs involve human work
The reports directory (.reports/) is automatically created and can be:
- Committed to git for historical tracking
- Added to .gitignore to keep reports local
- Shared via PR for team visibility