github-repo-stats
/github-repo-stats
How to gather GitHub repository statistics (PRs, issues, contributors) using the GitHub REST API via curl and Python. Use this skill whenever the user asks for a community pulse, activity summary, monthly report, or repository metrics for any GitHub repo — even if they don't explicitly mention the API.
- Author
- cxcscmu ↗
- Repository
- SkillLearnBench ↗
- Licence
- MIT
- Last repository change
- 02.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 3
No signals detected. Repository changed on 02.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
How to gather GitHub repository statistics (PRs, issues, contributors) using the GitHub REST API via curl and Python. Use this skill whenever the user asks for a community pulse, activity summary, monthly report, or repository metrics for any GitHub repo — even if they don't explicitly mention the API.
Original author description
How to gather GitHub repository statistics (PRs, issues, contributors) using the GitHub REST API via curl and Python. Use this skill whenever the user asks for a community pulse, activity summary, monthly report, or repository metrics for any GitHub repo — even if they don't explicitly mention the API.
How it works
- Overview
- Base URL pattern
- Authenticated header (use when token available)
- Pagination pattern
- Date filtering
- Key fields
- Detecting merged PRs
- Computing average time-to-merge
- Finding top contributor
- Output: write report.json
SKILL.md preview
---
name: github-repo-stats
description: >
How to gather GitHub repository statistics (PRs, issues, contributors) using
the GitHub REST API via curl and Python. Use this skill whenever the user asks
for a community pulse, activity summary, monthly report, or repository metrics
for any GitHub repo — even if they don't explicitly mention the API.
---
# GitHub Repository Stats via REST API
## Overview
Use the GitHub REST API (no SDK needed) with `curl` + `python3` to pull PR and
issue data for a given repo and date range. The unauthenticated rate limit is 60
requests/hour; set `GITHUB_TOKEN` in the environment for 5000/hour.
## Base URL pattern
```
https://api.github.com/repos/{owner}/{repo}/pulls # PRs
https://api.github.com/repos/{owner}/{repo}/issues # Issues (includes PRs!)
https://api.github.com/search/issues # Search endpoint
```
> Issues endpoint returns both issues AND pull requests. Filter with
> `"pull_request" in item` to separate them.
## Authenticated header (use when token available)
```bash
AUTH_HEADER="-H \"Authorization: token $GITHUB_TOKEN\""
```
## Pagination pattern
GitHub paginates at 100 items max per page. Always loop until an empty page:
```python
import requests, time
def fetch_all(url, params, token=None):
headers = {"Authorization": f"token {token}"} if token else {}
headers["Accept"] = "application/vnd.github+json"
results = []
page = 1
while True:
params["page"] = page
params["per_page"] = 100
r = requests.get(url, headers=headers, params=params)
if r.status_code == 403:
time.sleep(60) # rate-limited, back off
continue
data = r.json()
if not data:
break
results.extend(data)
if len(data) < 100:
break
page += 1
return results
```
## Date filtering
GitHub REST API supports `since` parameter (ISO 8601) for issues/PRs but NOT
`until`. Filter the `until` boundary in Python after fetching:
```python
from datetime import datetime, timezone
def parse_dt(s):
return datetime.fromisoformat(s.replace("Z", "+00:00"))
start = datetime(2024, 12, 1, tzinfo=timezone.utc)
end = datetime(2024, 12, 31, 23, 59, 59, tzinfo=timezone.utc)
created_in_range = [i for i in items
if start <= parse_dt(i["created_at"]) <= end]
```
## Key fields
| Field | Description |
|---|---|
| `number` | PR/issue number |
| `state` | `"open"` or `"closed"` |
| `created_at` | ISO 8601 creation timestamp |
| `closed_at` | ISO 8601 close timestamp (null if open) |
| `merged_at` | ISO 8601 merge timestamp (PRs only, null if unmerged) |
| `pull_request.merged_at` | In issue-endpoint results; same as above |
| `user.login` | Author login |
| `labels` | List of `{"name": "..."}` objects |
## Detecting merged PRs
Via `/pulls` endpoint, `merged_at` is present and non-null.
Via `/issues` endpoint, check `item.get("pull_request", {}).get("merged_at")`.
## Computing average time-to-merge
```python
from datetime import datetime, timezone
def days_between(a, b):
da = datetime.fromisoformat(a.replace("Z", "+00:00"))
db = datetime.fromisoformat(b.replace("Z", "+00:00"))
return (db - da).total_seconds() / 86400
merged = [p for p in prs if p.get("merged_at")]
avg = sum(days_between(p["created_at"], p["merged_at"]) for p in merged) / len(merged)
avg_rounded = round(avg, 1)
```
## Finding top contributor
```python
from collections import Counter
logins = [p["user"]["login"] for p in prs]
top = Counter(logins).most_common(1)[0][0]
```
## Output: write report.json
```python
import json, pathlib
report = {
"pr": {
"total": total_prs,
"merged": merged_count,
"closed": closed_count,
"avg_merge_days": avg_merge_days,
"top_contributor": top_contributor,
},
"issue": {
"total": total_issues,
"bug": bug_count,
"resolved_bugs": resolved_bugs,
}
}
pathlib.Path("/app/report.json").write_text(json.dumps(report, indent=2))
```
Versions
The database has no other skills named github-repo-stats.
Database snapshot: 13.11.2026 · package version f05cda7ee130 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100github-report-builder
Build structured JSON reports from GitHub repository activity data. Use this skill whenever you need to compile PR and issue statistics into a formatted JSON file for meeting summaries, community pulse reports, or stakeholder updates. Triggers on tasks that require outputting a… - 100gh-activity-query
Query GitHub repository activity (PRs, issues) for a date range using the gh CLI. Use this skill whenever you need to fetch pull request or issue data from a GitHub repository, compute statistics like counts, merge times, or identify top contributors. Triggers on tasks involving… - 100pulse-repo-stats
Build the Pulse engineering dashboard for a GitHub repo on this computer, as one HTML file - release weeks, PRs merged per week, review wait, time to merge, unreviewed merges, the commit grid, who does the work, how much of it AI agents do, and branch rules. Use when someone… - 100github-dashboard
GitHub repository analytics dashboard — stars, forks, contributors, issues, pull requests, recent activity, and top contributors. Use when the brief asks for a GitHub repo dashboard, open-source growth report, repository health page, or GitHub analytics view. - 90github
Read and manage GitHub repos, issues, pull requests, and code search via the GitHub REST API. Use when the user asks about GitHub repos, issues, PRs, or code. - 100int-github-review
Review GitHub repos — open PRs, community issues, stars/forks, releases, contributors. Use when user says 'check github', 'github review', 'repo status', 'open PRs', 'github issues', 'repository status', or any reference to checking GitHub repos status.