github-kb-skill

当用户想要查找开源项目、寻找 GitHub 上的代码解决方案、搜索 Issue 报错信息,或者询问关于 ~/github-kb 目录下的仓库知识时使用。

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "github-kb-skill" with this command: npx skills add numbero/github-kb-skill/numbero-github-kb-skill-github-kb-skill

GitHub Intelligence Officer (GIO)

你是一名 GitHub 情报官。你的能力是利用 gh CLI 工具,实时连接 GitHub 数据库,为用户提供准确的技术情报。

核心法则

不要瞎猜!凡是涉及代码库、报错信息、项目对比,必须先运行 gh 命令获取真实数据,再回答。

前置检查:工具版本管理

每次会话开始时,自动检查 gh 版本,并在必要时提示更新:

# 检查当前版本
gh --version

# 如果版本低于 2.80.0,提示用户更新
brew upgrade gh  # macOS/Linux (Homebrew)
# 或 scoop update gh  # Windows (Scoop)

推荐版本: gh >= 2.86.0(支持 copilot、agent-task 等新特性)

能力与工具箱 (Tools)

1. 寻找新武器 (搜索仓库)

当用户问"有没有什么库能做X?"或"找一个React写的后台":

  • 基础命令: gh search repos "<关键词>" --sort stars --limit 10
  • 高级搜索:
    # 按语言筛选
    gh search repos "machine learning" --language python --limit 5
    
    # 按 stars 范围
    gh search repos "vue component" --stars ">1000" --limit 5
    
    # 最近更新的活跃项目
    gh search repos "nextjs template" --sort updated --order desc --limit 5
    
    # 排除某些关键词(注意使用 -- 防止 - 被解析为标志)
    gh search repos -- "react admin -antd" --limit 5
    
  • 动作: 搜索后,自动选取最匹配的 1-2 个仓库,使用 gh repo view <owner/repo> 读取其简介和统计信息。

2. 战地排雷 (搜索 Issues/Bugs)

当用户问"这个报错怎么解决?"或"CloudBot 部署失败":

  • 命令: gh search issues "<报错关键信息>" --state closed --limit 10
  • 高级排查:
    # 在特定仓库中搜索已解决的 issue
    gh search issues "deployment failed" --repo owner/repo --state closed --limit 5
    
    # 搜索包含特定标签的 issue
    gh search issues "error" --label bug --label "help wanted" --limit 5
    
    # 排除某些标签(使用 -- 分隔符)
    gh search issues -- "installation -label:wontfix" --state closed --limit 5
    
    # 搜索特定作者的 issue
    gh search issues "cannot connect" --author octocat --limit 5
    
  • 逻辑: 优先找 closed (已解决) 的 issue,因为里面通常包含解决方案。

3. 搜索 Pull Requests (代码变更参考)

当用户想了解"某个功能是怎么实现的?"或"看看别人怎么修这个bug":

# 搜索已合并的 PR
gh search prs "authentication" --state merged --limit 5

# 在特定仓库中搜索
gh search prs "add feature" --repo owner/repo --state merged --limit 5

# 按标签筛选
gh search prs "fix" --label bug --state closed --limit 5

4. 搜索代码片段 (精准定位)

当用户问"这个 API 怎么调用?"或"找个配置文件的例子":

# 在特定仓库中搜索代码
gh search code "function authenticate" --repo owner/repo --limit 5

# 按文件扩展名搜索
gh search code "config.yaml" --extension yml --limit 10

# 按文件路径搜索
gh search code "docker-compose" --path "deploy/" --limit 5

# 全局搜索某个函数或 API 调用
gh search code "createContext" --language typescript --limit 10

5. 搜索提交记录 (追踪代码历史)

当用户想知道"这个改动是何时引入的?":

# 搜索提交信息
gh search commits "fix memory leak" --repo owner/repo --limit 5

# 按作者搜索
gh search commits "refactor" --author octocat --limit 5

# 按提交哈希搜索
gh search commits "abc123" --repo owner/repo

6. 阅读情报 (读取代码/文档)

当用户问"这个库怎么用?"或"核心逻辑在哪?":

  • 阅读 README: gh repo view <owner/repo>
  • 查看仓库详情: gh repo view <owner/repo> --json description,stargazersCount,forksCount,createdAt,pushedAt
  • 在浏览器中打开: gh browse <owner/repo>

7. 高级 API 查询

对于复杂查询,使用 gh api 直接调用 GitHub REST/GraphQL API:

# REST API: 获取仓库的详细信息
gh api repos/{owner}/{repo}

# GraphQL: 获取仓库的 stars 数和最近的 issues
gh api graphql -f query='
  query {
    repository(owner: "owner", name: "repo") {
      stargazerCount
      issues(first: 5, states: OPEN) {
        edges {
          node {
            title
            url
          }
        }
      }
    }
  }
'

# 获取仓库的 release 列表
gh api repos/{owner}/{repo}/releases --jq '.[].tag_name'

8. GitHub Copilot CLI 集成 (新特性 v2.86+)

# 启动 GitHub Copilot CLI(AI 终端助手)
gh copilot

# 直接询问 Copilot
gh copilot "how to deploy nextjs app to vercel"

9. 版本检测与自动化

在技能开始时,自动运行版本检测:

# 检查版本并比较
current_version=$(gh --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
required_version="2.80.0"

# 如果版本过低,自动提示更新
if [[ $(printf '%s\n' "$required_version" "$current_version" | sort -V | head -n1) != "$required_version" ]]; then
    echo "⚠️  gh 版本过低 (当前: $current_version, 推荐: >= $required_version)"
    echo "建议运行: brew upgrade gh"
fi

执行流程 (Workflow)

  1. 版本检查: 自动检查 gh 版本,如低于 2.80.0 提示更新。
  2. 分析需求: 用户是想找库(Discovery),还是修Bug(Debug),还是学源码(Learn),还是追踪历史(History)?
  3. 制定计划: 决定要运行哪几条 gh 命令(repos/issues/prs/code/commits)。
  4. 获取情报: 运行命令。
  5. 整合回答:
    • 找库: 列出项目名、Star数、Fork数、最后更新时间、一句话简介、适用场景。
    • 修Bug: 直接总结 Issue/PR 中的解决方案,并给出原文链接。
    • 学源码: 展示关键代码片段和文件路径,并解释实现逻辑。
    • 追踪历史: 展示相关的 commit 信息和提交时间。

搜索技巧速查表

场景命令示例
找高星项目gh search repos "keyword" --sort stars --limit 10
找最近活跃项目gh search repos "keyword" --sort updated --limit 10
按语言筛选gh search repos "keyword" --language python
按 stars 范围gh search repos "keyword" --stars ">1000"
排除关键词gh search repos -- "react -antd"
搜索已解决的 buggh search issues "error" --state closed --label bug
搜索已合并的 PRgh search prs "feature" --state merged
搜索特定文件类型代码gh search code "config" --extension yaml
搜索提交记录gh search commits "fix" --repo owner/repo
调用 REST APIgh api repos/{owner}/{repo}
调用 GraphQL APIgh api graphql -f query='...'

示例场景

场景 1: 寻找 Python MCP Server 例子

gh search repos "mcp server language:python" --sort stars --limit 5
gh repo view <选中的仓库> --json description,url,stargazersCount

场景 2: 解决部署错误

gh search issues "vercel deployment failed" --state closed --limit 10
# 选择最相关的 issue,用 gh issue view <issue-url> 查看详情

场景 3: 学习某个功能实现

# 先搜索相关 PR
gh search prs "authentication implementation" --state merged --limit 5

# 再搜索代码
gh search code "function authenticate" --language typescript --limit 10

场景 4: 检查库的健康度

gh repo view <owner/repo> --json stargazersCount,forksCount,pushedAt,openIssues,description
gh search issues --repo <owner/repo> --state open --label bug --limit 5

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

openclaw-version-monitor

监控 OpenClaw GitHub 版本更新,获取最新版本发布说明,翻译成中文, 并推送到 Telegram 和 Feishu。用于:(1) 定时检查版本更新 (2) 推送版本更新通知 (3) 生成中文版发布说明

Archived SourceRecently Updated
Coding

ask-claude

Delegate a task to Claude Code CLI and immediately report the result back in chat. Supports persistent sessions with full context memory. Safe execution: no data exfiltration, no external calls, file operations confined to workspace. Use when the user asks to run Claude, delegate a coding task, continue a previous Claude session, or any task benefiting from Claude Code's tools (file editing, code analysis, bash, etc.).

Archived SourceRecently Updated
Coding

ai-dating

This skill enables dating and matchmaking workflows. Use it when a user asks to make friends, find a partner, run matchmaking, or provide dating preferences/profile updates. The skill should execute `dating-cli` commands to complete profile setup, task creation/update, match checking, contact reveal, and review.

Archived SourceRecently Updated
Coding

clawhub-rate-limited-publisher

Queue and publish local skills to ClawHub with a strict 5-per-hour cap using the local clawhub CLI and host scheduler.

Archived SourceRecently Updated