using-gh-cli by trailofbits/skills
npx skills add https://github.com/trailofbits/skills --skill using-gh-cligh)curl、wget 或 WebFetch 来完成WebFetch 或 curl)*.github.io) 上的公共网页内容 — 那些是常规网站git commit, ) — 直接使用 广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
git pushgit对于 GitHub URL,始终使用 gh 而不是 curl、wget 或 WebFetch。 gh CLI 会自动使用用户的认证令牌,因此它:
要读取或浏览 GitHub 仓库中的文件,请将其克隆到本地并使用常规文件工具(Read、Glob、Grep)。这比通过 API 逐个获取文件要快得多,也更自然。
# 克隆到会话范围的临时目录(会话结束时自动清理)
clonedir="$TMPDIR/gh-clones-${CLAUDE_SESSION_ID}"
mkdir -p "$clonedir"
gh repo clone owner/repo "$clonedir/repo" -- --depth 1
克隆后,使用 Explore agent(通过带有 subagent_type=Explore 的 Task 工具)来调查克隆的仓库。Explore agent 可以高效地在克隆的仓库中使用 Read、Glob 和 Grep — 比逐个调用它们要好得多:
Task(subagent_type="Explore", prompt="In $clonedir/repo/, find how authentication is implemented")
对于你已经了解的克隆仓库的针对性查找,直接使用 Read/Glob/Grep。
gh repo clone 使用用户的认证令牌 — 适用于私有仓库--depth 1 保持克隆快速(仅最新提交)gh api# 查看仓库
gh repo view owner/repo
# 列出并查看 PR
gh pr list --repo owner/repo
gh pr view 123 --repo owner/repo
# 列出并查看议题
gh issue list --repo owner/repo
gh issue view 456 --repo owner/repo
# 调用任何 REST API 端点
gh api repos/owner/repo/contents/README.md
# 调用时分页并使用 jq 过滤
gh api repos/owner/repo/pulls --paginate --jq '.[].title'
| 替代方案 | 使用 |
|---|---|
在 github.com/owner/repo 上使用 WebFetch | gh repo view owner/repo |
在 blob/tree URL 上使用 WebFetch | 使用 gh repo clone 克隆并使用 Read/Glob/Grep |
在 raw.githubusercontent.com/... 上使用 WebFetch | 使用 gh repo clone 克隆并使用 Read |
在 api.github.com/... 上使用 WebFetch | gh api <endpoint> |
curl https://api.github.com/... | gh api <endpoint> |
带有 -H "Authorization: token ..." 的 curl | gh api <endpoint>(认证自动完成) |
使用 wget 下载发布资源 | gh release download --repo owner/repo |
每周安装数
212
仓库
GitHub 星标数
3.9K
首次出现
2026年2月12日
安全审计
安装于
claude-code191
opencode188
codex187
gemini-cli179
github-copilot172
cursor170
gh)curl, wget, or WebFetch forWebFetch or curl for those)*.github.io) — those are regular websitesgit commit, git push) — use git directlyAlways usegh instead of curl, wget, or WebFetch for GitHub URLs. The gh CLI uses the user's authenticated token automatically, so it:
To read or browse files from a GitHub repo, clone it locally and use normal file tools (Read, Glob, Grep). This is much faster and more natural than fetching files one-by-one via the API.
# Clone to a session-scoped temp directory (cleaned up automatically on session end)
clonedir="$TMPDIR/gh-clones-${CLAUDE_SESSION_ID}"
mkdir -p "$clonedir"
gh repo clone owner/repo "$clonedir/repo" -- --depth 1
After cloning, use the Explore agent (via the Task tool with subagent_type=Explore) to investigate the cloned repo. The Explore agent can use Read, Glob, and Grep across the clone efficiently — much better than calling them one at a time:
Task(subagent_type="Explore", prompt="In $clonedir/repo/, find how authentication is implemented")
For targeted lookups on a clone you already understand, use Read/Glob/Grep directly.
gh repo clone uses the user's authenticated token — works with private repos--depth 1 keeps the clone fast (only latest commit)gh api only when you need a quick single-file lookup without cloning# View a repo
gh repo view owner/repo
# List and view PRs
gh pr list --repo owner/repo
gh pr view 123 --repo owner/repo
# List and view issues
gh issue list --repo owner/repo
gh issue view 456 --repo owner/repo
# Call any REST API endpoint
gh api repos/owner/repo/contents/README.md
# Call with pagination and jq filtering
gh api repos/owner/repo/pulls --paginate --jq '.[].title'
| Instead of | Use |
|---|---|
WebFetch on github.com/owner/repo | gh repo view owner/repo |
WebFetch on a blob/tree URL | Clone with gh repo clone and use Read/Glob/Grep |
WebFetch on raw.githubusercontent.com/... | Clone with gh repo clone and use Read |
Weekly Installs
212
Repository
GitHub Stars
3.9K
First Seen
Feb 12, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
claude-code191
opencode188
codex187
gemini-cli179
github-copilot172
cursor170
房地产专家系统:MLS集成、虚拟看房、AI估值与物业管理技术解决方案
206 周安装
TypeScript/JavaScript 开发技能 - 掌握 Metabase 开源项目开发流程与工具
206 周安装
Upstash Redis SDK 完整指南 - Redis-JS 安装、使用与性能优化教程
206 周安装
Tavily API 网络搜索技能 - 实现网页爬取、内容提取和智能研究功能
206 周安装
企业合规助手:GDPR、CCPA等隐私法规合规指南与数据处理协议审查清单
206 周安装
DeepSpeed 开发助手:官方文档指南、API 使用与性能优化教程
207 周安装
WebFetch on api.github.com/... | gh api <endpoint> |
curl https://api.github.com/... | gh api <endpoint> |
curl with -H "Authorization: token ..." | gh api <endpoint> (auth is automatic) |
wget to download a release asset | gh release download --repo owner/repo |