feat(badges): add skills.sh badge support#124
Conversation
New /skills provider backed by the official skills.sh API (api/v1):
installs, all-time rank, trending, hot, and security audit badges,
addressed as /skills/{topic}/{owner}/{repo}/{skill}. Base badges
default to the Vercel logo, branded variant uses Vercel black.
- Provider scans cached leaderboard pages for rank (top 1000) and
trending/hot (top 500); optional SKILLS_SH_API_KEY raises the
upstream rate limit
- Docs page with sandboxes and examples, sidebar + API reference
entries, Agent Skills showcase category, README and agent skill
endpoint tables
- Hero headline now reads 'The badges your readme and SKILL.md
crave.' with the announcement pointing at the new docs page
https://claude.ai/code/session_01Hj2JcBwH1WDSx5HLfAhAWU
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| maxPages: number | ||
| ): Promise<number | null> { | ||
| let position = 0 | ||
| for (let page = 0; page < maxPages; page++) { |
There was a problem hiding this comment.
Bug: The findRank function uses 0-based pagination for an API that expects 1-based pagination, causing it to fail or return incorrect data.
Severity: HIGH
Suggested Fix
Modify the findRank function's loop to use 1-based indexing for the page parameter. Change the loop from for (let page = 0; page < maxPages; page++) to for (let page = 1; page <= maxPages; page++) to align with the API's expected pagination.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/core/src/providers/skills.ts#L116
Potential issue: The `findRank` function iterates through leaderboard pages starting
with `page = 0`. However, the skills.sh API uses 1-based indexing, where the first page
is `page=1`. Querying with `page=0` may return an empty list, causing the function to
terminate prematurely and return `null`. This would result in `getSkillsTrending` and
`getSkillsHot` always returning `null`, and `getSkillsRank` always showing "1000+". If
`page=0` is treated as a duplicate of `page=1`, the rank calculation will be inaccurate.
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
Verified — this is a false positive, and the comment is also outdated (the function was renamed findRank → scanLeaderboard in a later commit).
The skills.sh leaderboard endpoint /api/skills/{view}/{page} is 0-based: page 0 is the first page and returns the top of the board, not an empty list. Confirmed across the real-world clients of this API:
2lbj/auto-skill-downloaderdocumentshttps://skills.sh/api/skills/all-time/0as returning the top 200 skills.derekross/onyxiteratesfor page in 0..pages(0-based).mastra-ai/skills-apiandpmiscn/skillsmcpboth build.../all-time/{page}starting at0.
So starting at page = 0 is correct; switching to 1-based would actually skip the top page. The scan also doesn't rely on a fixed page count — it stops on hasMore === false or an empty page — so it's robust to the per-page size too. No change needed.
Generated by Claude Code
… ids
The live deploy rendered every skills.sh badge as 'not found' for two
reasons, both fixed here:
- The provider hit the OIDC-authenticated /api/v1 tier, which a public
badge service can't authenticate to. Switch to the public
/api/skills/{view}/{page} leaderboard endpoint (no auth, confirmed
envelope { skills: [{ source, skillId, name, installs }], hasMore }).
Installs and rank both come from one cached all-time scan; trending
and hot scan their own boards.
- Example/sandbox/showcase skill ids were wrong (frontend-design is
under anthropics/skills, not vercel-labs/agent-skills). All examples
now use real skills, primarily vercel-labs/agent-skills/vercel-react-best-practices.
Drop the audit badge (only available on the authenticated tier).
Add a provider test covering installs, multi-page rank, source+skillId
matching, trending/hot, and the not-found path.
https://claude.ai/code/session_01Hj2JcBwH1WDSx5HLfAhAWU
New /skills provider backed by the official skills.sh API (api/v1):
installs, all-time rank, trending, hot, and security audit badges,
addressed as /skills/{topic}/{owner}/{repo}/{skill}. Base badges
default to the Vercel logo, branded variant uses Vercel black.
trending/hot (top 500); optional SKILLS_SH_API_KEY raises the
upstream rate limit
entries, Agent Skills showcase category, README and agent skill
endpoint tables
crave.' with the announcement pointing at the new docs page
https://claude.ai/code/session_01Hj2JcBwH1WDSx5HLfAhAWU