Adds live GitHub star counts, badges, and buttons to websites or apps for social proof. Provides React hooks for client-side fetches and Next.js server-side caching.
From bopen-toolsnpx claudepluginhub b-open-io/claude-plugins --plugin bopen-toolsThis skill uses the workspace's default tool permissions.
references/patterns.mdSearches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Executes pre-written implementation plans: critically reviews, follows bite-sized steps exactly, runs verifications, tracks progress with checkpoints, uses git worktrees, stops on blockers.
Add live GitHub star counts to websites as social proof. Two patterns depending on traffic level — pick the right one and go.
Client-side hook (default) — fetch directly from GitHub API in the browser.
Server-side caching — proxy through your own API route with a GITHUB_TOKEN.
next: { revalidate: 300 } to cache for 5 minutesimport { useEffect, useState } from "react";
export function useGitHubStars(repo: string) {
const [stars, setStars] = useState<number | null>(null);
useEffect(() => {
fetch(`https://api.github.com/repos/${repo}`)
.then((res) => res.json())
.then((data) => {
if (data.stargazers_count !== undefined) {
setStars(data.stargazers_count);
}
})
.catch(() => {}); // Intentional: star count is non-critical social proof — icon renders without it
}, [repo]);
return stars;
}
import { Github } from "lucide-react";
const stars = useGitHubStars("owner/repo");
<a
href="https://github.com/owner/repo"
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
>
<Github className="h-4 w-4" />
{stars !== null && <span className="text-xs tabular-nums">{stars}</span>}
</a>
Why tabular-nums: prevents layout shift as the digit count changes — all numerals occupy the same width.
Why stars !== null: the GitHub icon always renders; the count only appears after the fetch succeeds. If GitHub is down or rate-limited, the link still works as a plain GitHub link.
Read references/patterns.md for: