Skip to main content
Automatically redirects Claude from WebFetch/curl to the authenticated gh CLI when accessing GitHub resources. Works with private repos and avoids rate limits.

Overview

Claude Code’s WebFetch tool and Bash curl/wget commands don’t use GitHub authentication. This plugin solves that by:
  1. Intercepting GitHub URL access via PreToolUse hooks
  2. Suggesting the correct gh CLI command instead
  3. Providing comprehensive gh CLI guidance via a skill
  4. Auto-cleaning cloned repositories when sessions end
Author: William Tan

Problems Solved

Private Repos

Unauthenticated fetches fail with 404 errors. gh uses your token automatically.

Rate Limits

Unauthenticated: 60 req/hr. Authenticated: 5,000 req/hr.

Incomplete Data

Some API responses require authentication to return full data.

What Gets Intercepted

What Passes Through

  • Non-GitHub URLs (any domain that isn’t github.com, api.github.com, raw.githubusercontent.com, or gist.github.com)
  • GitHub Pages sites (*.github.io)
  • Commands already using gh
  • Git commands (git clone, git push, etc.)
  • Search commands that mention GitHub URLs (grep, rg, etc.)

Installation

1

Install GitHub CLI

If not already installed:
2

Authenticate

Follow the prompts to authenticate with your GitHub account.
3

Install Plugin

If gh is not installed, the hooks silently pass through (no disruption to your workflow).

Browsing Repository Code

Key Principle: To read or browse files from a GitHub repo, clone it locally and use normal file tools (Read, Glob, Grep).

Clone Pattern

Cloning is:
  • Faster for browsing multiple files
  • More natural - use Read, Glob, Grep like any local code
  • More efficient - one clone vs many API calls
  • Session-scoped - auto-cleaned when session ends

Using the Explore Agent

After cloning, use the Explore agent to investigate the repo:
The Explore agent can use Read, Glob, and Grep efficiently across the clone.

Automatic Cleanup

Cloned repositories are stored in session-scoped temp directories:
A SessionEnd hook automatically removes them when the session ends. No manual cleanup needed.

Common Usage Patterns

View Repository

List and View Pull Requests

List and View Issues

API Access

Download Release Assets

Reference Documentation

The skill includes comprehensive reference files:
  • pull-requests.md - List, view, create, merge, review PRs
  • issues.md - List, view, create, close, comment on issues
  • repos-and-files.md - View repos, browse files, clone
  • api.md - Raw REST/GraphQL access, pagination, jq filtering
  • releases.md - List, create, download releases
  • actions.md - View runs, trigger workflows, check logs

Usage Examples

Before (fails for private repos):
After (uses gh CLI):

Hook Behavior

PreToolUse Hooks

The plugin includes hooks that run before WebFetch and Bash commands:
  1. Fast-fail for non-GitHub URLs - Exit immediately if URL doesn’t match GitHub patterns
  2. Parse GitHub URLs - Extract owner/repo/endpoint information
  3. Suggest gh command - Return the equivalent gh CLI command
  4. No execution blocking - Claude receives the suggestion and can choose to use it

SessionEnd Hook

Cleans up cloned repositories when the session ends:
Concurrent sessions don’t interfere with each other (each has unique session ID).

Benefits

Private Repository Access

Uses your authenticated token automatically - works with all private repos you have access to.

Higher Rate Limits

5,000 requests/hour (authenticated) vs 60 requests/hour (unauthenticated).

Complete API Data

Authenticated requests return full response data, not limited public information.

No Manual Cleanup

Session-scoped temp directories are automatically removed when session ends.
  • Devcontainer Setup - GitHub CLI comes pre-installed in devcontainers
  • Second Opinion - Uses gh pr commands for code review workflows
  • Git Cleanup - Works alongside gh for branch management