github-star-velocity
GitHub计算 GitHub 仓库在指定时间窗口内的 Star 增长速率。通过 API 获取 Star 数据并处理分页陷阱,提供精确的增速指标。
Trigger Scenarios
Install
npx skills add Tracer-Cloud/opensre --skill github-star-velocity -g -y
SKILL.md
Frontmatter
{
"name": "github-star-velocity",
"tools": [
"execute_python_code"
],
"description": "Compute GitHub repository star velocity over a rolling time window using the stargazers API."
}
GitHub Star Velocity
Use this skill only when the dedicated get_github_star_history tool is not
available. When that tool is available, prefer it for GitHub star velocity,
stars gained in a recent window, day-by-day stars, star growth rate, or similar
metrics for a repository.
Prerequisites
- Set
allow_network: trueonexecute_python_code. - Read
GITHUB_TOKENfrom the subprocess environment (injected when GitHub credentials are configured). Never print the token. - Parse
owner/repofrom the repository URL or user input.
API approach
- Fetch current
stargazers_countfromGET /repos/{owner}/{repo}. - Fetch stargazers with timestamps from
GET /repos/{owner}/{repo}/stargazers?per_page=100usingAccept: application/vnd.github.v3.star+json. - Each entry includes
starred_at. Count stars wherestarred_atis within the requested window.
Critical pagination trap
Stargazers are returned oldest first, not newest first. Do not stop after the first page when the newest entries on that page fall outside the window — that produces a false zero.
For responsiveness, compute the last page from stargazers_count and
per_page=100, fetch newest pages by explicit page number in descending
order, and stop once the oldest starred_at on a fetched page is before the
window start. Only run a full historical scan when the user explicitly asks for
all-time history or an audit-quality export.
Sanity check before reporting
Treat these results as suspicious and rerun with a full paginated scan before answering:
0stars in the last 24 hours for a repo with thousands of stars and recent activity- Velocity that implies losing stars without an explicit unstar request
- Counts that disagree sharply with
stargazers_countdeltas when you have a recent baseline
When a result looks wrong, widen the scan (all pages), print the most recent
starred_at observed, and only then return the velocity.
Output shape
Return:
- Total current stars
- Stars gained in the window
- Velocity (stars per hour and stars per day)
- Window start timestamp (UTC)
- Most recent
starred_atin the window - Optional hourly breakdown for the last 24 hours
Version History
-
8bfe7b1
Current 2026-08-19 21:46
新增 get_github_star_history 工具以替代脆弱的分页扫描,优化内存注入及测试隔离。
- 719551f 2026-07-24 21:56


