gh-cli

Intercepts GitHub URL fetches and redirects them to the authenticated gh CLI.

Updated May 17, 2026
One-click install
npx skills add https://github.com/irrit-us/agent_misc --skill gh-cli-irrit-us
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: gh-cli
Source: https://github.com/irrit-us/agent_misc/tree/main/skills/gh-cli
Command: npx skills add https://github.com/irrit-us/agent_misc --skill gh-cli-irrit-us

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Claude Code's WebFetch tool and Bash curl/wget commands do not use your GitHub authentication, causing 404 errors on private repos, low rate limits (60/hour unauthenticated vs 5,000/hour authenticated), and incomplete API responses. ## Core Features & Use Cases - PreToolUse Hooks: Intercept GitHub URL access via WebFetch or curl/wget and suggest the correct gh CLI command, such as gh repo view, gh pr list, or gh api. - PATH Shim for gh: Blocks anti-patterns like fetching file contents via the /contents/ API endpoint and cloning into non-session-scoped temp directories. - Automatic Cleanup: A SessionEnd hook removes session-scoped clones stored in $TMPDIR/gh-clones-<session-id>/ so concurrent sessions never conflict. - Use Case: When Claude tries to fetch a private repository file from raw.githubusercontent.com, the hook denies the request and instructs it to clone the repo with gh and read files locally instead. ## Quick Start Install the plugin and authenticate the GitHub CLI with gh auth login, then let the hooks automatically redirect any GitHub URL fetch to the authenticated gh CLI.

Frequently Asked Questions about gh-cli

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch private GitHub repos in Claude Code?▼

Install the gh CLI and authenticate with gh auth login, then this plugin's PreToolUse hooks intercept GitHub URL fetches and redirect them to authenticated gh commands. Private repos that previously returned 404 errors become accessible through your GitHub token.

How to avoid GitHub API rate limits when fetching URLs?▼

Use the authenticated gh CLI instead of unauthenticated curl or WebFetch requests. Unauthenticated requests are limited to 60 per hour, while authenticated requests through gh allow 5,000 per hour using your GitHub token.

Does this plugin work if gh CLI is not installed?▼

Yes, the hooks pass through without disruption when gh is not installed. The interception scripts check for gh availability first and exit silently if the binary is missing, so normal WebFetch and curl behavior continues.

Why does the plugin block gh api contents endpoint calls?▼

The PATH shim blocks gh api /contents/ fetching because base64-decoding file contents through the API is an anti-pattern. Instead, it instructs cloning the repo with gh repo clone into a session-scoped temp directory and reading files locally.

What happens to cloned repositories after a session ends?▼

A SessionEnd hook automatically deletes the session-scoped clone directory at $TMPDIR/gh-clones-<session-id>/. Each session uses a unique directory, so concurrent sessions never interfere and no manual cleanup is required.