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
- Source file
- plugins/gh-cli/.claude-plugin/plugin.json
- 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
- 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.
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.
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:
- 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
- A gh PATH shim that blocks anti-patterns: API /contents/ fetching and non-session-scoped temp directory clones
- 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
- Supply Chain Risk Auditor Audit a project's npm, PyPI, and Go dependencies for supply-chain risk: version-matched advisories for direct dependencies and the full lockfile tree, abandoned upstreams, npm publisher concentration, and install scripts Plugin · trailofbits/skills
- Testing Handbook Skills Skills from the Trail of Bits Application Security Testing Handbook (appsec.guide) Plugin · trailofbits/skills
- Static Analysis Static analysis toolkit with CodeQL, Semgrep, and SARIF parsing for security vulnerability detection Plugin · trailofbits/skills
- Trailmark Builds source and binary code graphs for security analysis, context slicing, mutation testing, cryptographic protocol modeling, finding triage, and variant analysis. Plugin · trailofbits/skills
- Git Cleanup Safely analyzes and cleans up local git branches and worktrees by categorizing them as merged, squash-merged, superseded, or active work. Plugin · trailofbits/skills
- Fp Check Systematic false positive verification for security bug analysis with mandatory gate reviews Plugin · trailofbits/skills
- Insecure Defaults Detects insecure default configurations including hardcoded credentials, fallback secrets, weak authentication defaults, and dangerous values in production Plugin · trailofbits/skills
- Firebase Apk Scanner Scan Android APKs for Firebase security misconfigurations including open databases, storage buckets, authentication issues, and exposed cloud functions. For authorized security research only. Plugin · trailofbits/skills