npx skills add ...
npx skills add zc277584121/marketing-skills --skill github-traffic
Fetch, store, and visualize GitHub repository traffic data (views, clones, referrers, stars) with trend charts. Requires repo push access.
npx skills add zc277584121/marketing-skills --skill github-traffic
Fetch and analyze GitHub repository traffic data — page views, git clones, referral sources, popular pages, and star growth. Optionally generate trend charts as PNG images.
Prerequisites:
ghCLI must be installed and authenticated- Push (write) access to the target repository is required — GitHub's Traffic API does not work with read-only access
matplotlibis optional (for PNG chart generation; falls back to ASCII if unavailable)
GitHub only provides the last 14 days of traffic data. To track trends over longer periods (30 days, 90 days, etc.), the script stores each fetch in a local history file (~/.github-traffic/<repo>_traffic.json). Regular snapshots are required to build up history.
Recommended: set up a cron job or CI schedule to run the snapshot command periodically:
This will:
gh api~/.github-traffic/ for historical trackingThe PNG chart includes up to 3 panels:
| Flag | Default | Description |
|---|---|---|
repo (positional) | required | Repository in owner/name format |
--chart | off | Generate PNG trend chart |
--ascii | off | Force ASCII bar chart output |
--days | 30 | Number of days to include in chart |
--history-dir | ~/.github-traffic/ | Directory for historical data storage |
--output | <repo>_traffic.png | Output path for chart image |
--snapshot | off | Fetch and store data only (no display) |
Each run merges the current 14-day window into a persistent JSON file at ~/.github-traffic/<owner>_<repo>_traffic.json. The file contains:
To build meaningful 30/90-day charts, run the script at least every 14 days (daily is ideal). Gaps longer than 14 days will show as missing data in charts.
The GitHub Traffic API requires push access to the repository. This means:
If you get a permission error, check your gh auth status and ensure your token has the repo scope.
| Problem | Solution |
|---|---|
| "Must have push access" error | You need write access to the repo. Check gh auth status. |
| Chart shows only 14 days | GitHub only provides 14-day windows. Run --snapshot regularly to accumulate history. |
| matplotlib not found | Install with pip install matplotlib. Or use --ascii for text-based charts. |
| No data for some dates | GitHub may not report days with zero traffic. These gaps are normal. |
# Generate PNG trend chart (last 30 days, default)
python .../github_traffic.py owner/repo --chart
# Last 7 days
python .../github_traffic.py owner/repo --chart --days 7
# Last 90 days (needs accumulated history)
python .../github_traffic.py owner/repo --chart --days 90
# ASCII chart (no matplotlib needed)
python .../github_traffic.py owner/repo --ascii# Quick traffic summary
python .../github_traffic.py zilliztech/memsearch
# Weekly trend chart
python .../github_traffic.py zilliztech/memsearch --chart --days 7
# Monthly trend chart, custom output path
python .../github_traffic.py zilliztech/memsearch --chart --days 30 --output ./reports/traffic.png
# Just store a snapshot (for cron jobs)
python .../github_traffic.py zilliztech/memsearch --snapshot
# ASCII chart when matplotlib is not available
python .../github_traffic.py zilliztech/memsearch --ascii --days 14