context7-cli — Claude Code skill: fresh library docs and Context7 MCP
This skill teaches your agent to pull current library documentation through the ctx7 CLI and wire up Context7 MCP for the editor.
npx skills add upstash/context7 --skill context7-cli -a claude-codeWhat context7-cli does
The skill covers the ctx7 CLI. It handles two jobs: fetching up-to-date documentation for a library and setting up Context7 MCP in your editor. Reach for it while writing code, when you need to verify an API signature and the model's training data may be stale.
The flow is two steps. ctx7 library <name> <query> resolves the library ID, then ctx7 docs <libraryId> <query> returns the docs. Library IDs need a leading slash — /facebook/react, not facebook/react. Skip the first step and the docs call fails, so ctx7 library always comes first.
Setup runs through ctx7 setup, which is interactive. It needs a login: ctx7 login opens a browser for OAuth, and ctx7 login --no-browser prints the URL instead. To skip interactive login entirely, export CONTEXT7_API_KEY. Most commands work without signing in, though logging in raises the rate limits on docs requests. Keep the CLI current before running anything: npm install -g ctx7@latest, or call it straight through npx ctx7@latest <command>.
What it helps with
- pull current library docs when model training data is outdated
- verify an API signature before writing code
- resolve a library ID for follow-up doc requests
- set up Context7 MCP in Claude, Cursor or OpenCode
- raise docs rate limits by logging in
Example prompts for the agent
- look up the react docs with ctx7 and show me the current hooks
- set up Context7 MCP for this project
- check the function signature in the latest version of this library
How to install context7-cli
1Skills CLI (Vercel)
npx skills add upstash/context7 --skill context7-cli -a claude-code2Manually: put the files in place
~/.claude/skills/context7-cli/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/context7-cli/
1Skills CLI (Vercel)
npx skills add upstash/context7 --skill context7-cli -a codex2Manually: put the files in place
.agents/skills/context7-cli/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add upstash/context7 --skill context7-cli -a cursor2Manually: put the files in place
.cursor/skills/context7-cli/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install upstash/context7 context7-cli2Manually: put the files in place
.github/skills/context7-cli/SKILL.md1Skills CLI (Vercel)
npx skills add upstash/context7 --skill context7-cli -a gemini-cli2Platform CLI
gemini skills install https://github.com/upstash/context7 --path skills/context7-cliManually: put the files in place
.devin/skills/context7-cli/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add upstash/context7 --skill context7-cli -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set3
The whole set →Similar
Questions about context7-cli
How do I install context7-cli in Claude?
Run npx skills add upstash/context7 --skill context7-cli -a claude-code. The skill file then sits at ~/.claude/skills/context7-cli/SKILL.md.
What does context7-cli do?
It gives your agent two things: the ctx7 CLI commands for fetching current library documentation, and a way to configure Context7 MCP for the editor.
Do I need to log in for ctx7 to work?
Most commands work without signing in. The exception is ctx7 setup, which requires a login unless you pass --api-key or --oauth. Logging in also raises the rate limits on docs commands.
Source text
SKILL.md · MIT
--- name: context7-cli description: Use the ctx7 CLI to fetch library documentation and configure Context7 MCP. Activate when the user mentions "ctx7" or "context7", needs current docs for any library, or needs to set up Context7 for their AI coding agent. --- # ctx7 CLI The Context7 CLI does two things: fetches up-to-date library documentation and sets up Context7 MCP for your editor. Make sure the CLI is up to date before running commands: ```bash npm install -g ctx7@latest ``` Or run directly without installing: ```bash npx ctx7@latest <command> ``` ## What this skill covers - **[Documentation](references/docs.md)** — Fetch current docs for any library. Use when writing code, verifying API signatures, or when training data may be outdated. - **[Setup](references/setup.md)** — Configure Context7 MCP for Claude Code / Cursor / OpenCode. ## Quick Reference ```bash # Documentation ctx7 library <name> <query> # Step 1: resolve library ID ctx7 docs <libraryId> <query> # Step 2: fetch docs # Setup ctx7 setup # Configure Context7 MCP (interactive) ctx7 login # Log in for higher rate limits ctx7 whoami # Check current login status ``` ## Authentication ```bash ctx7 login # Opens browser for OAuth ctx7 login --no-browser # Prints URL instead of opening browser ctx7 logout # Clear stored tokens ctx7 whoami # Show current login status (name + email) ``` Most commands work without login. Exception: `ctx7 setup` requires it unless `--api-key` or `--oauth` is passed. Login also unlocks higher rate limits on docs commands. Set an API key via environment variable to skip interactive login entirely: ```bash export CONTEXT7_API_KEY=your_key ``` ## Common Mistakes - Library IDs require a `/` prefix — `/facebook/react` not `facebook/react` - Always run `ctx7 library` first — `ctx7 docs react "hooks"` will fail without a valid ID
© upstash · MIT · upstash/context7