跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 github-trending

Github Trending

获取并显示 GitHub 趋势寄存器和开发者 。 在构建显示趋势再现的仪表板,发现受欢迎的项目,或跟踪GitHub趋势时使用. GitHub上起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起起.

3206 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

获取并显示 GitHub 趋势寄存器和开发者

何时用

构建显示趋势回放的仪表板,发现受欢迎的项目,或跟踪GitHub趋势. GitHub 上的触发器、 趋势重置、 流行寄存器、 GitHub 发现

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:GitHub Trending Data、Important Note、Approach 1: Direct Web Scraping (Recommended)、Approach 2: GitHub Search API (Official Alternative)、Next.js API Route (Server-Side Scraping)、React Hook。

文件分析

文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。

官方 description(原文)

Fetch and display GitHub trending repositories and developers. Use when building dashboards showing trending repos, discovering popular projects, or tracking GitHub trends. Triggers on GitHub trending, trending repos, popular repositories, GitHub discover.

GitHub Trending DataImportant NoteApproach 1: Direct Web Scraping (Recommended)Approach 2: GitHub Search API (Official Alternative)Next.js API Route (Server-Side Scraping)React HookImportant ConsiderationsResources

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
github-trending
description
Fetch and display GitHub trending repositories and developers. Use when building dashboards showing trending repos, discovering popular projects, or tracking GitHub trends. Triggers on GitHub trending, trending repos, popular repositories, GitHub discover.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「github-trending」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-d59c81bbe6cc7d24-Github-%E8%B6%8B%E5%8A%BF.html
请存为 .cursor/skills/github-trending/SKILL.md 或 .claude/skills/github-trending/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/hoodini/ai-agents-skills' --list

npx skills add 'https://github.com/hoodini/ai-agents-skills' --skill 'github-trending'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: github-trending description: Fetch and display GitHub trending repositories and developers. Use when building dashboards showing trending repos, discovering popular projects, or tracking GitHub trends. Triggers on GitHub trending, trending repos, popular repositories, GitHub discover. --- # GitHub Trending Data Access GitHub trending repositories and developers data. ## Important Note **GitHub does NOT provide an official trending API.** The trending page at `github.com/trending` must be scraped directly or use the GitHub Search API as an alternative. ## Approach 1: Direct Web Scraping (Recommended) Scrape `github.com/trending` directly using Cheerio: ```typescript import * as cheerio from 'cheerio'; interface TrendingRepo { owner: string; name: string; fullName: string; url: string; description: string; language: string; languageColor: string; stars: number; forks: number; starsToday: number; } async function scrapeTrending(options: { language?: string; since?: 'daily' | 'weekly' | 'monthly'; } = {}): Promise { // Build URL: github.com/trending or github.com/trending/typescript?since=weekly let url = 'https://github.com/trending'; if (options.language) { url += `/${encodeURIComponent(options.language)}`; } if (options.since) { url += `?since=${options.since}`; } const response = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0 (compatible; TrendingBot/1.0)', }, }); if (!response.ok) { throw new Error(`Failed to fetch trending: ${response.status}`); } const html = await response.text(); const $ = cheerio.load(html); const repos: TrendingRepo[] = []; // Each trending repo is in an article.Box-row element $('article.Box-row').each((_, element) => { const $el = $(element); // Get repo link (e.g., /owner/repo) const repoLink = $el.find('h2 a').attr('href')?.trim() || ''; const [, owner, name] = repoLink.split('/'); // Get description const description = $el.find('p.col-9').text().trim(); // Get language const language = $el.find('[itemprop="programmingLanguage"]').text().trim(); // Get language color from the colored dot const langColorStyle = $el.find('.repo-language-color').attr('style') || ''; const langColorMatch = langColorStyle.match(/background-color:\s*([^;]+)/); const languageColor = langColorMatch ? langColorMatch[1].trim() : ''; // Get stars (total) const starsText = $el.find('a[href$="/stargazers"]').text().trim(); const stars = parseNumber(starsText); // Get forks const forksText = $el.find('a[href$="/forks"]').text().trim(); const forks = parseNumber(forksText); // Get stars today/this week/this month const starsTodayText = $el.find('.float-sm-right, .d-inline-block.float-sm-right').text().trim(); const starsToday = parseNumber(starsTodayText); if (owner && name) { repos.push({ owner, name, fullName: `${owner}/${name}`, url: `https://github.com${repoLink}`, description, language, languageColor, stars, forks, starsToday, }); } }); return repos; } function parseNumber(text: string): number { const clean = text.replace(/,/g, '').trim(); if (clean.includes('k')) { return Math.round(parseFloat(clean) * 1000); } return parseInt(clean) || 0; } ``` ## Approach 2: GitHub Search API (Official Alternative) Use GitHub's Search API to find recently created repos with high stars: ```typescript interface GitHubSearchResult { total_count: number; items: GitHubRepo[]; } interface GitHubRepo { full_name: string; html_url: string; description: string; language: string; stargazers_count: number; forks_count: number; created_at: string; } async function getTrendingViaSearch(options: { language?: string; days?: number; minStars?: number; } = {}): Promise { const days = options.days || 7; const minStars = options.minStars || 100; // Calculate date N days ago const date = new Date(); date.setDate(date.getDate() - days); const since = date.toISOString().split('T')[0]; // Build search query const queryParts = [ `created:>${since}`, `stars:>=${minStars}`, ]; if (options.language) { queryParts.push(`language:${options.language}`); } const query = queryParts.join(' '); const response = await fetch( `https://api.github.com/search/repositories?q=${encodeURIComponent(query)}&sort=stars&order=desc&per_page=25`, { headers: { 'Accept': 'application/vnd.github.v3+json', 'Authorization': `Bearer ${process.env.GITHUB_TOKEN}`, // Optional but recommended 'User-Agent': 'TrendingApp/1.0', }, } ); if (!response.ok) { throw new Error(`GitHub API error: ${response.status}`); } const data: GitHubSearchResult = await response.json(); return data.items; } ``` **Note:** The Search API has rate limits (10 requests/minute unauthenticated, 30/minute with token). ## Next.js API Route (Server-Side Scraping) ```typescript // app/api/trending/route.ts import { NextRequest } from 'next/server'; import * as cheerio from 'cheerio'; export async function GET(request: NextRequest) { const searchParams = request.nextUrl.searchParams; const language = searchParams.get('language') || ''; const since = searchParams.get('since') || 'daily'; try { let url = 'https://github.com/trending'; if (language) url += `/${encodeURIComponent(language)}`; url += `?since=${since}`; const response = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0 (compatible)' }, next: { revalidate: 3600 }, // Cache for 1 hour }); const html = await response.text(); const repos = parseGitHubTrending(html); return Response.json(repos); } catch (error) { console.error('Trending scrape failed:', error); return Response.json( { error: 'Failed to fetch trending repos' }, { status: 500 } ); } } function parseGitHubTrending(html: string) { const $ = cheerio.load(html); const repos: any[] = []; $('article.Box-row').each((_, el) => { const $el = $(el); const repoLink = $el.find('h2 a').attr('href') || ''; const [, owner, name] = repoLink.split('/'); repos.push({ owner, name, fullName: `${owner}/${name}`, url: `https://github.com${repoLink}`, description: $el.find('p.col-9').text().trim(), language: $el.find('[itemprop="programmingLanguage"]').text().trim(), stars: parseNumber($el.find('a[href$="/stargazers"]').text()), forks: parseNumber($el.find('a[href$="/forks"]').text()), starsToday: parseNumber($el.find('.float-sm-right').text()), }); }); return repos; } function parseNumber(text: string): number { const clean = text.replace(/,/g, '').trim(); if (clean.includes('k')) return Math.round(parseFloat(clean) * 1000); return parseInt(clean) || 0; } ``` ## React Hook ```tsx import { useState, useEffect } from 'react'; function useTrending(options: { language?: string; since?: string } = {}) { const [repos, setRepos] = useState([]); const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { async function fetchTrending() { setIsLoading(true); try { const params = new URLSearchParams(); if (options.language) params.set('language', options.language); if (options.since) params.set('since', options.since); const response = await fetch(`/api/trending?${params}`); if (!response.ok) throw new Error('Failed to fetch'); setRepos(await response.json()); } catch (err) { setError(err instanceof Error ? err.message : 'Unknown error'); } finally { setIsLoading(false); } } fetchTrending(); }, [options.language, options.since]); return { repos, isLoading, error }; } ``` ## Important Considerations 1. **No Official API**: GitHub's trending page has no official API - scraping is the only option 2. **Rate Limiting**: Respect GitHub's servers - cache aggressively 3. **HTML Structure Changes**: GitHub may change their HTML - monitor for breakages 4. **User-Agent**: Always include a User-Agent header 5. **Server-Side Only**: Do scraping server-side to avoid CORS issues ## Resources - **GitHub Trending Page**: https://github.com/trending - **GitHub Search API**: https://docs.github.com/en/rest/search

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…