Skip to content
github-traffic logo

Skill: GitHub Traffic

github-traffic

Fetch, store, and visualize GitHub repository traffic data (views, clones, referrers, stars) with trend charts. Requires repo push access.

SKILL.md

Full skill instructions

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:

  • gh CLI 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
  • matplotlib is optional (for PNG chart generation; falls back to ASCII if unavailable)

When to Use

  • The user asks about repository traffic, page views, clone counts, or where visitors come from
  • The user wants to see traffic trends over time (weekly, monthly, quarterly)
  • The user wants to generate traffic report charts for sharing or documentation
  • The user wants to periodically snapshot traffic data to build long-term history

Important: GitHub Traffic API Limitations

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:

# Daily snapshot via cron (no output, just stores data)
0 9 * * * python /​path/​to/​scripts/​github_traffic.py owner/​repo --snapshot

Default Workflow

python /​path/​to/​skills/​github-traffic/​scripts/​github_traffic.py <owner/​repo>

This will:

  1. Fetch current traffic data via gh api
  2. Save a snapshot to ~/​.github-traffic/ for historical tracking
  3. Display a formatted summary (views, clones, referrers, popular pages)

Generating Charts

# 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

The PNG chart includes up to 3 panels:

  1. Page Views — total views and unique visitors (area chart)
  2. Git Clones — total clones and unique cloners (bar + line chart)
  3. Star Growth — star count over time (line chart, shown when multiple snapshots exist)

Script Options

FlagDefaultDescription
repo (positional)requiredRepository in owner/​name format
--chartoffGenerate PNG trend chart
--asciioffForce ASCII bar chart output
--days30Number of days to include in chart
--history-dir~/​.github-traffic/Directory for historical data storage
--output<repo>_traffic.pngOutput path for chart image
--snapshotoffFetch and store data only (no display)

Examples

# 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

History & Long-Term Tracking

Each run merges the current 14-day window into a persistent JSON file at ~/​.github-traffic/<owner>_<repo>_traffic.json. The file contains:

  • Daily views: date → {views, unique}
  • Daily clones: date → {clones, unique}
  • Star snapshots: date → star count
  • Fetch metadata: timestamp, 14-day totals, stars, forks

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.


Permissions

The GitHub Traffic API requires push access to the repository. This means:

  • Repository owners and admins: full access
  • Collaborators with write/​maintain role: full access
  • Read-only users and forkers: no access (API returns 403)

If you get a permission error, check your gh auth status and ensure your token has the repo scope.


Troubleshooting

ProblemSolution
"Must have push access" errorYou need write access to the repo. Check gh auth status.
Chart shows only 14 daysGitHub only provides 14-day windows. Run --snapshot regularly to accumulate history.
matplotlib not foundInstall with pip install matplotlib. Or use --ascii for text-based charts.
No data for some datesGitHub may not report days with zero traffic. These gaps are normal.

More Git & Pull Requests skills

requesting-code-review logo
Git & Pull Requests

requesting-code-review

Dispatch code review subagents with focused context to catch issues before they compound.

295.4K 245.8K
View
receiving-code-review logo
Git & Pull Requests

receiving-code-review

Evaluate code review feedback with technical rigor before implementing, avoiding performative agreement and blind implementation.

295.4K 208.8K
View
using-git-worktrees logo
Git & Pull Requests

using-git-worktrees

Isolated git worktrees with smart directory selection and safety verification.

295.4K 205.2K
View

Structured workflow for completing development branches with test verification and merge/PR options.

295.4K 202.3K
View
review logo
Git & Pull Requests

review

review

276.6K 94.8K
View
code-review-and-quality logo
Git & Pull Requests

code-review-and-quality

Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch.

101.4K 55.6K
View
git-commit logo
Git & Pull Requests

git-commit

Standardized git commits using Conventional Commits specification with intelligent diff analysis and message generation.

39.7K 46.4K
View
git-workflow-and-versioning logo
Git & Pull Requests

git-workflow-and-versioning

Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams.

101.4K 44.2K
View
ponytail-review logo
Git & Pull Requests

ponytail-review

Code review focused exclusively on over-engineering. Finds what to delete: reinvented standard library, unneeded dependencies, speculative abstractions, dead flexibility. One line per finding: location, what to cut, what replaces it. Complements correctness-focused review, this one only hunts complexity.

155.5K 32.1K
View
excalidraw-diagram-generator logo
Git & Pull Requests

excalidraw-diagram-generator

Generate Excalidraw diagrams from natural language descriptions in multiple formats.

39.7K 31.1K
View
ponytail-audit logo
Git & Pull Requests

ponytail-audit

Whole-repo audit for over-engineering. Like ponytail-review, but scans the entire codebase instead of a diff: a ranked list of what to delete, simplify, or replace with stdlib/native equivalents. One-shot report, does not apply fixes.

155.5K 30K
View
code-review-excellence logo
Git & Pull Requests

code-review-excellence

Systematic code review practices for constructive feedback, bug detection, and team knowledge sharing.

40.2K 29.4K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
Imagica logo
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View