gh-fetch: Stop Agents from Web Fetching GitHub URLs

Whenever I paste a GitHub issue or PR link into an AI coding agent, there’s basically a coin flip on whether it reaches for web fetch or the gh CLI. Web fetching is slower, hits rate limits, can’t touch private repos, and has to scrape HTML for data that gh just returns.

I built gh-fetch, a small agent skill that tells your agent to always use the gh CLI when it sees a GitHub URL.

What it does

Maps GitHub URL types to the right gh command:

URL type Command
Issue gh issue view <number> --repo owner/repo
Pull request gh pr view <number> --repo owner/repo
PR diff gh pr diff <number> --repo owner/repo
Commit gh api repos/owner/repo/commits/<sha>
Gist gh gist view <id>

Discussions, releases, action runs, file blobs, and more are covered too.

Why bother

gh is already authenticated, so private repos work without issues. You get structured data back instead of parsed HTML, it’s faster, and --json + --jq let you pull exactly what you need.

Install

npx skills add retlehs/gh-fetch

Works with Claude Code, Cursor, Codex, and 30+ other agents.