Sponsor Suno AI Music arrow_forward
Plugin

Gh Cli

Intercepts GitHub URL fetches (WebFetch and MCP fetch tools) and curl/wget commands, redirecting to the authenticated gh CLI.

Type
Plugin
Repository
trailofbits/skills
GitHub stars
7.3k
License
CC-BY-SA-4.0
Repo last updated
Sep 25, 2026
Version
1.6.2
Author
William Tan

What Gh Cli is

Gh Cli is a plugin published in the trailofbits/skills repository on GitHub, which has about 7.3k stars. The repository describes itself as: “Trail of Bits Claude Code skills for security research, vulnerability detection, and audit workflows”

A plugin is a package that bundles skills, slash commands, subagents, hooks, and MCP connectors so they install together. Plugins are plain files with a manifest at .claude-plugin/plugin.json, and they work in both Claude Code and Claude Cowork.

Installing Gh Cli adds everything it ships in one step. Connectors inside a plugin still need to be connected separately, and hooks and subagents only run in Cowork and Claude Code, not in regular chat.

How to install Gh Cli

Claude Code

  1. Add the repository as a plugin marketplace: claude plugin marketplace add trailofbits/skills
  2. Install the plugin: claude plugin install gh-cli@<marketplace-name>, using the marketplace name from the repository's .claude-plugin/marketplace.json.
  3. Restart the session if the new skills or commands don't appear straight away.

Claude Cowork

  1. Open Customize → Plugins and choose Add marketplace.
  2. Enter trailofbits/skills (the owner/repo shorthand works for GitHub).
  3. Find Gh Cli in the list, click Install, then connect any connectors it needs from its Connectors tab.

New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.

Inside the source file

An excerpt from plugins/gh-cli/.claude-plugin/plugin.json, shared under the repository's CC-BY-SA-4.0 license. Read the full file on GitHub.

A Claude Code plugin that intercepts GitHub URL fetches and redirects Claude to use the authenticated gh CLI instead.

Problem

Claude Code's WebFetch tool, MCP fetch tools (Exa's web_fetch_exa and similar), and Bash curl/wget commands don't use the user's GitHub authentication. This means:

  • Private repos: Fetches fail with 404 errors
  • Rate limits: Unauthenticated requests are limited to 60/hour (vs 5,000/hour authenticated)
  • Missing data: Some API responses are incomplete without authentication

Solution

This plugin provides:

  1. PreToolUse hooks that intercept GitHub URL access via WebFetch, MCP fetch/scrape/crawl/extract tools, or curl/wget, and suggest the correct gh CLI command
  2. A gh PATH shim that blocks anti-patterns: API /contents/ fetching and non-session-scoped temp directory clones
  3. A SessionEnd hook that automatically cleans up cloned repositories when the session ends

What Gets Intercepted

The fetch hook matches WebFetch plus any MCP tool whose name contains fetch, scrape, crawl, or extract — mcpexaweb_fetch_exa, mcpfirecrawlfirecrawl_scrape, mcptavilytavily_extract, and equivalents from other MCP servers. Web tools named something else entirely (browser navigation, for instance) are not covered; hooks/matcher.bats records exactly which names match.

It reads both fetch payload shapes — WebFetch's single url, and the urls field MCP fetch tools use to batch several pages into one call, whether that field arrives as an array or a bare string. Because a tool call is atomic, one GitHub URL anywhere in a batch denies the whole call; the denial names each offending URL alongside its suggestion. WebFetch's prompt field is deliberately not scanned, so a prompt that merely mentions a GitHub URL is not denied.

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 (except anti-patterns blocked by the shim; see table above)
  • Git commands (git clone, git push, etc.)
  • Search commands that mention GitHub URLs (grep, rg, etc.)

Note: When hooks deny blob/tree/raw URLs, the denial message explicitly warns against using gh api to fetch and base64-decode file contents as a fallback — clone the repo instead.

Automatic Cleanup

Cloned repositories are stored in session-scoped temp directories ($TMPDIR/gh-clones- /). A SessionEnd hook automatically removes them when the session ends, so there's no manual cleanup needed and concurrent sessions don't interfere with each other.

Prerequisites

  • GitHub CLI (gh) must be installed and authenticated (gh auth login)
  • If gh is not installed, the hooks pass through without disruption

Installation

/plugin marketplace add trailofbits/skills
/plugin install gh-cli

Before you install

  • Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
  • Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
  • Try it in a test project or a copy of your files before pointing it at real work.
  • Pin the version you tested, and review changes before updating.
  • Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.

FAQ

What is Gh Cli?

Gh Cli is a plugin for Claude Code and Claude Cowork from the trailofbits/skills repository on GitHub. Intercepts GitHub URL fetches (WebFetch and MCP fetch tools) and curl/wget commands, redirecting to the authenticated gh CLI.

How do I install Gh Cli in Claude Code?

Add the repository as a plugin marketplace: claude plugin marketplace add trailofbits/skills Install the plugin: claude plugin install gh-cli@<marketplace-name>, using the marketplace name from the repository's .claude-plugin/marketplace.json. Restart the session if the new skills or commands don't appear straight away.

Can I use Gh Cli in Claude Cowork?

Open Customize → Plugins and choose Add marketplace. Enter trailofbits/skills (the owner/repo shorthand works for GitHub). Find Gh Cli in the list, click Install, then connect any connectors it needs from its Connectors tab.

Is Gh Cli safe to install?

It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.

Similar resources

Browse all skills, subagents, and plugins →

Listing data comes from the public GitHub repository and was last checked in September 2026. Excerpts are © their authors and shared under CC-BY-SA-4.0. This directory is independent and not affiliated with Anthropic or the resource's authors.