GitHub 代码库智能管理助手
简介
基于 GitHub CLI 的本地代码库管理工具,帮助开发者高效搜索、克隆和组织 GitHub 项目,构建个人知识库。
原始描述
Manage a local GitHub knowledge base and provide GitHub search capabilities via gh CLI. Use when users ask about repos, PRs, issues, request to clone GitHub repositories, explore codebases, or need information about GitHub projects. Supports searching GitHub via gh CLI and managing local KB with GITHUB_KB.md catalog. Configure via GITHUB_TOKEN and GITHUB_KB_PATH environment variables.
通过你的 Agent 添加
安装目录:github-kb/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
github-kb 是一款纯文档型 Skill,旨在帮助用户通过 GitHub CLI (gh) 构建和维护本地代码知识库。其核心功能分为两大模块:
-
GitHub 搜索能力:依托
ghCLI 提供仓库、Issue、PR 的高级搜索支持,涵盖语言过滤、星标筛选、主题标签、状态过滤等 qualifiers,满足开发者快速定位开源项目的需求。 -
本地知识库管理:通过维护
GITHUB_KB.md目录文件,实现已克隆仓库的结构化归档。支持从搜索到克隆、再到目录更新的完整工作流,默认存储路径可自定义。
显著优点
- 纯文档零风险:不含任何可执行代码,仅提供 Markdown 指南和 bash 示例,从根本上杜绝代码注入或恶意执行风险。
- 安全凭证实践:明确倡导通过
GITHUB_TOKEN 环境变量注入令牌,文档中警示"Never hardcode tokens",符合安全合规要求。
- 工作流标准化:将 GitHub 搜索、克隆、归档、描述维护整合为一套可复现的标准操作流程,适合团队知识库建设。
- 灵活配置:支持自定义
GITHUB_KB_PATH 和可选的 Token 配置,兼顾公开与私有仓库场景。
潜在缺点与局限性
- 外部依赖强:功能完全依赖 GitHub CLI 的预安装与认证状态,若环境缺失
gh 或未登录,搜索功能将无法使用。
- 手动维护成本:知识库目录需人工更新,缺乏自动同步机制,长期维护可能产生滞后。
- 无自动化触发:不支持 webhook 或定时任务,无法自动追踪仓库更新或 PR/Issue 状态变更。
- T3 来源风险:作者为个人开发者(jameschan21),虽账号历史达 9 年,但个人项目的长期维护承诺弱于组织级项目。
适合人群
- 需要系统性整理 GitHub 开源资源的开发者
- 研究团队技术栈选型、希望建立内部代码参考库的工程师
- 习惯命令行工作流、熟悉 GitHub CLI 的进阶用户
常规风险
- Token 泄露风险:若用户误将
GITHUB_TOKEN 硬编码或提交至版本控制,可能导致账户被滥用。
- 目录污染风险:默认克隆路径若配置不当,可能覆盖现有目录结构。
- gh CLI 版本差异:不同版本
gh 的搜索语法可能存在细微差异,跨环境使用时需注意兼容性。
GITHUB_TOKEN 环境变量注入令牌,文档中警示"Never hardcode tokens",符合安全合规要求。GITHUB_KB_PATH 和可选的 Token 配置,兼顾公开与私有仓库场景。- 外部依赖强:功能完全依赖 GitHub CLI 的预安装与认证状态,若环境缺失
gh或未登录,搜索功能将无法使用。 - 手动维护成本:知识库目录需人工更新,缺乏自动同步机制,长期维护可能产生滞后。
- 无自动化触发:不支持 webhook 或定时任务,无法自动追踪仓库更新或 PR/Issue 状态变更。
- T3 来源风险:作者为个人开发者(jameschan21),虽账号历史达 9 年,但个人项目的长期维护承诺弱于组织级项目。
适合人群
- 需要系统性整理 GitHub 开源资源的开发者
- 研究团队技术栈选型、希望建立内部代码参考库的工程师
- 习惯命令行工作流、熟悉 GitHub CLI 的进阶用户
常规风险
- Token 泄露风险:若用户误将
GITHUB_TOKEN 硬编码或提交至版本控制,可能导致账户被滥用。
- 目录污染风险:默认克隆路径若配置不当,可能覆盖现有目录结构。
- gh CLI 版本差异:不同版本
gh 的搜索语法可能存在细微差异,跨环境使用时需注意兼容性。
- Token 泄露风险:若用户误将
GITHUB_TOKEN硬编码或提交至版本控制,可能导致账户被滥用。 - 目录污染风险:默认克隆路径若配置不当,可能覆盖现有目录结构。
- gh CLI 版本差异:不同版本
gh的搜索语法可能存在细微差异,跨环境使用时需注意兼容性。
技能正文
name: github-kb
description: Manage a local GitHub knowledge base and provide GitHub search capabilities via gh CLI. Use when users ask about repos, PRs, issues, request to clone GitHub repositories, explore codebases, or need information about GitHub projects. Supports searching GitHub via gh CLI and managing local KB with GITHUB_KB.md catalog. Configure via GITHUB_TOKEN and GITHUB_KB_PATH environment variables.
GitHub Knowledge Base
Manage a local GitHub knowledge base and provide GitHub search capabilities via gh CLI. Key file: GITHUB_KB.md at the root of the KB directory catalogs all projects with brief descriptions.
Configuration
Set environment variables before use:
GITHUB_TOKEN- GitHub Personal Access Token (optional, for private repos)GITHUB_KB_PATH- Path to local KB directory (default:/home/node/clawd/github-kb)
Example:
export GITHUB_TOKEN="ghp_xxxx..."
export GITHUB_KB_PATH="/your/path/github-kb"
Token Privacy: Never hardcode tokens. Inject via environment variables or container secrets.
GitHub CLI (gh)
Requirement: GitHub CLI must be installed and authenticated.
Installation:
- macOS:
brew install gh - Linux:
apt install ghor see official install guide - Windows:
winget install GitHub.cli
Authentication:
# Interactive login
gh auth login
# Or use token from GITHUB_TOKEN env var
gh auth login --with-token <(echo "$GITHUB_TOKEN")
Verify: gh auth status
If gh is not installed or not authenticated, skip search operations and use only local KB features.
Searching Repos
# Search repos by keyword
gh search repos <query> [--limit <n>]
# Examples:
gh search repos "typescript cli" --limit 10
gh search repos "language:python stars:>1000" --limit 20
gh search repos "topic:mcp" --limit 15
# Search repos by keyword
gh search repos <query> [--limit <n>]
# Examples:
gh search repos "typescript cli" --limit 10
gh search repos "language:python stars:>1000" --limit 20
gh search repos "topic:mcp" --limit 15
Search qualifiers:
language:<lang>- Filter by programming languagestars:<n>orstars:><n>- Filter by star counttopic:<name>- Filter by topicuser:<owner>- Search within a user's reposorg:<org>- Search within an organization
Searching Issues
gh search issues "react hooks bug" --limit 20
gh search issues "repo:facebook/react state:open" --limit 30
gh search issues "language:typescript label:bug" --limit 15
gh search issues "react hooks bug" --limit 20
gh search issues "repo:facebook/react state:open" --limit 30
gh search issues "language:typescript label:bug" --limit 15
Search qualifiers:
repo:<owner/repo>- Search in specific repositorystate:open|closed- Filter by issue stateauthor:<username>- Filter by authorlabel:<name>- Filter by labellanguage:<lang>- Filter by repo languagecomments:<n>orcomments:><n>- Filter by comment count
Searching Pull Requests
# Search PRs
gh search prs <query> [--limit <n>]
# Examples:
gh search prs "repo:vercel/next.js state:open" --limit 30
gh search prs "language:go is:merged" --limit 15
# Search PRs
gh search prs <query> [--limit <n>]
# Examples:
gh search prs "repo:vercel/next.js state:open" --limit 30
gh search prs "language:go is:merged" --limit 15
Search qualifiers:
repo:<owner/repo>- Search in specific repositorystate:open|closed|merged- Filter by PR stateauthor:<username>- Filter by authorlabel:<name>- Filter by labellanguage:<lang>- Filter by repo languageis:merged|unmerged- Filter by merge status
Viewing PR/Issue Details
# View issue/PR details
gh issue view <number> --repo <owner/repo>
gh pr view <number> --repo <owner/repo>
# View with comments
gh issue view <number> --repo <owner/repo> --comments
gh pr view <number> --repo <owner/repo> --comments
Local Knowledge Base Workflow
Querying About a Repo in KB
- Read GITHUB_KB.md to understand what projects exist
- Locate the project directory under ${GITHUB_KB_PATH:-/home/node/clawd/github-kb}/
Cloning a New Repo to KB
- Search GitHub if the full repo name is not known
- Clone to KB directory:
git clone https://github.com/<owner>/<name>.git ${GITHUB_KB_PATH:-/home/node/clawd/github-kb}/<name>
- Generate project description: Read README or key files to understand the project
- Update GITHUB_KB.md: Add entry for the new repo following the existing format:
### [<name>](/<name>)
Brief one-line description of what the project does. Additional context if useful (key features, tech stack, etc.).
- Confirm completion: Tell user the repo was cloned and where to find it
Default Clone Location
# View issue/PR details
gh issue view <number> --repo <owner/repo>
gh pr view <number> --repo <owner/repo>
# View with comments
gh issue view <number> --repo <owner/repo> --comments
gh pr view <number> --repo <owner/repo> --comments
Querying About a Repo in KB
- Search GitHub if the full repo name is not known
- Clone to KB directory:
git clone https://github.com/<owner>/<name>.git ${GITHUB_KB_PATH:-/home/node/clawd/github-kb}/<name> - Generate project description: Read README or key files to understand the project
- Update GITHUB_KB.md: Add entry for the new repo following the existing format:
### [<name>](/<name>) Brief one-line description of what the project does. Additional context if useful (key features, tech stack, etc.). - Confirm completion: Tell user the repo was cloned and where to find it
Default Clone Location
If user says "clone X" without specifying a directory, default to ${GITHUB_KB_PATH:-/home/node/clawd/github-kb}/.
GITHUB_KB.md Format
The catalog file follows this structure:
# GitHub Knowledge Base
This directory contains X GitHub projects covering various domains.
---
## Category Name
### [project-name](/project-name)
Brief description of the project.
Maintain categorization and consistent formatting when updating.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。