🚀 快速安装

复制以下命令并运行,立即安装此 Skill:

npx @anthropic-ai/skills install am-will/codex-skills/read-github

💡 提示:需要 Node.js 和 NPM

读取 GitHub 文档

通过 gitmcp.io MCP 服务访问 GitHub 仓库文档和代码。

URL 转换

将 GitHub URL 转换为 gitmcp.io:

  • github.com/owner/repogitmcp.io/owner/repo
  • https://github.com/karpathy/llm-councilhttps://gitmcp.io/karpathy/llm-council

命令行使用

scripts/gitmcp.py 脚本提供了访问仓库文档的命令行接口。

列出可用工具

python3 scripts/gitmcp.py list-tools owner/repo

获取文档

检索完整的文档文件(README、docs 等):

python3 scripts/gitmcp.py fetch-docs owner/repo

搜索文档

在仓库文档内进行语义搜索:

python3 scripts/gitmcp.py search-docs owner/repo "查询词"

搜索代码

使用 GitHub 搜索 API 搜索代码(精确匹配):

python3 scripts/gitmcp.py search-code owner/repo "函数名"

获取引用的 URL

获取文档中提到的 URL 的内容:

python3 scripts/gitmcp.py fetch-url owner/repo "https://example.com/doc"

直接调用工具

直接调用任何 MCP 工具:

python3 scripts/gitmcp.py call owner/repo tool_name '{"arg": "value"}'

工具名称

工具名称会动态添加仓库名前缀(使用下划线连接):

  • karpathy/llm-councilfetch_llm_council_documentation
  • facebook/reactfetch_react_documentation
  • my-org/my-repofetch_my_repo_documentation

可用的 MCP 工具

对于任何仓库,以下工具可用:

  1. fetch_{repo}_documentation – 获取完整文档。对于一般性问题,首选调用此工具。
  2. search_{repo}_documentation – 在文档内进行语义搜索。用于具体查询。
  3. search_{repo}_code – 通过 GitHub API 搜索代码(精确匹配)。返回匹配的文件。
  4. fetch_generic_url_content – 获取文档中引用的任何 URL,遵守 robots.txt。

工作流程

  1. 当给定一个 GitHub 仓库时,首先获取文档以了解项目
  2. 针对关于用法或功能的具体问题,使用 search-docs
  3. 使用 search-code 查找实现或特定函数
  4. 使用 fetch-url 检索文档中提到外部引用

📄 原始文档

完整文档(英文):

https://skills.sh/am-will/codex-skills/read-github

💡 提示:点击上方链接查看 skills.sh 原始英文文档,方便对照翻译。

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。