PR Statistics from gh CLI Output
SkillDev toolsComputing pull request statistics (merge time, top contributors) from gh CLI JSON output using jq.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the PR Statistics from gh CLI Output skill
What this skill tells your AI
The instructions your AI receives, as published by cxcscmu/skilllearnbench in skills/b1-one-shot-claude-opus-4-6/github-repo-analytics/gh-cli-pr-stats/SKILL.md and read by ahel’s review.
Fetching PR Data with Timestamps
gh pr list --repo owner/repo --state all \
--search "created:2024-12-01..2024-12-31" \
--limit 500 \
--json number,state,author,createdAt,mergedAt
The author field returns an object: {"login": "username"}.
The state field returns: OPEN, CLOSED, or MERGED.
Computing Average Merge Time with jq
# Filter merged PRs and compute average days to merge
echo "$pr_json" | jq '
[.[] | select(.state == "MERGED") |
{ created: (.createdAt | fromdateiso8601),
merged: (.mergedAt | fromdateiso8601) } |
(.merged - .created) / 86400
] | add / length
'
fromdateiso8601converts ISO 8601 strings to Unix epoch seconds.- Divide difference by 86400 to get days.
add / lengthcomputes the mean.
Finding Top Contributor
echo "$pr_json" | jq '
group_by(.author.login) |
map({login: .[0].author.login, count: length}) |
sort_by(-.count) |
.[0]
'
Counting by State
echo "$pr_json" | jq '{
total: length,
merged: [.[] | select(.state == "MERGED")] | length,
closed: [.[] | select(.state == "CLOSED")] | length
}'
Note: In gh CLI output, CLOSED and MERGED are distinct states. A merged PR has state MERGED, not CLOSED.
Signals
- GitHub stars
- 83
- Forks
- 5
- Last commit
- Jul 2026
Advanced
- Catalog kind
- skill
- Gateway key
gh-cli-pr-stats- Source
- github.com/cxcscmu/skilllearnbench