Pre-computed context
Installed CLI version: !ctx7 --version 2>/dev/null || echo "not installed (run: npm install -g ctx7@latest)"
MCP availability: check your own tool list. If mcp__context7__resolve-library-id / mcp__context7__query-docs are present, the MCP path is configured.
Purpose
A primary source of up-to-date library documentation. Two equivalent interfaces: CLI (ctx7) via npm, and the Context7 HTTP MCP server (mcp__context7__*) when the consuming project has it configured. Both read the same backend. Pick by workflow (see When to use CLI vs MCP).
Philosophy: training data is stale by the time you use it. Library APIs, framework defaults, best practices change. Before claiming how a library works, verify against Context7, even for libraries you "know."
Actions
| Action | When | Loads |
|---|---|---|
lookup <library> <query> (default) |
User asks about a library | context/lookup.md |
update |
Drift check + CLI upgrade + upstream skill changes | context/update.md |
If the argument is bare (no action keyword), treat as lookup.
First-time setup covers CLI install, CONTEXT7_API_KEY auth, optional MCP server wiring, and the Windows Git Bash gotcha. It lives in its own skill: run /context7:setup.
Lookup (happy path)
Two-step: resolve library name → fetch docs with resolved ID.
# Step 1: name → Context7 library ID
ctx7 library "<name>" "<question>"
# Step 2: ID → docs (Windows Git Bash: prefix with MSYS_NO_PATHCONV=1 — see context/cli.md)
MSYS_NO_PATHCONV=1 ctx7 docs "<libraryId>" "<question>"
Equivalent via MCP when the consuming project has the Context7 MCP server configured (no Windows gotcha, cleaner output, more content per call; measured ratio in context/mcp.md):
mcp__context7__resolve-library-id(libraryName: "...", query: "...")
mcp__context7__query-docs(libraryId: "/org/project", query: "...")
Call library / resolve-library-id first to get a valid ID; docs / query-docs reject anything else, unless the user supplies an ID in /org/project format. One concept per query. When a question spans several independent topics, run a separate lookup per topic. Do not run more than 3 lookup commands per topic. If you cannot find what you need, fall back to training knowledge and tell the user Context7 didn't cover it.
Do not include sensitive information (API keys, passwords, credentials) in queries. Sent to the Context7 backend.
Details: query-writing, result selection, version-specific IDs, common mistakes → context/lookup.md
When to use CLI vs MCP
Both read the same backend. Results equivalent in substance. Pick by workflow.
Use the CLI (ctx7) when |
Use the MCP (mcp__context7__*) when |
|---|---|
Piping into grep, jq, head, a file |
Conversational lookup where the model picks the tool naturally |
Dumping large docs to disk (> docs.md) instead of context |
Default docs depth matters (MCP returns more content per call; see context/mcp.md) |
| Scripting, loops, Bash one-liners | Clean markdown output (no ANSI codes) |
No MCP server configured, or mcp.context7.com blocked |
Zero Windows Git Bash ceremony (no MSYS_NO_PATHCONV=1) |
Structured extraction (--json) |
Auto-discoverable from the model's tool list |
More: context/cli.md, context/mcp.md
Update
Two upstream dependencies can drift: the ctx7 npm package, and Upstash's reference skill content. Aggregate-level stale-tracking via metadata.upstream-version + metadata.synced in the frontmatter above; the verbatim upstream baselines under vendor/ refresh together.
When CLI or upstream skill content drifts:
bash "${CLAUDE_PLUGIN_ROOT}/skills/lookup/scripts/update.sh" # check only
bash "${CLAUDE_PLUGIN_ROOT}/skills/lookup/scripts/update.sh" --fix # apply CLI upgrade
Script (a) reports installed vs latest ctx7 version, (b) fetches latest upstream find-docs/SKILL.md and context7-cli/SKILL.md from upstash/context7, (c) diffs against the vendor/ baselines, (d) if different, reports NEW upstream guidance for manual integration into this skill. The script does NOT auto-overwrite this SKILL.md. Customizations (Windows gotcha, CLI-vs-MCP guidance, action dispatch) must be preserved.
Full protocol (merge strategy, what to preserve, maintainer-only baseline refresh) → context/update.md
What this skill does NOT do
- Does not replace multi-source research. Use your research workflow for architecture decisions or anything needing cross-referenced sources. This skill is library-doc retrieval only
- Does not refactor code. Retrieves docs. User's question shapes what comes back
- Does not cache content locally. Docs fetched fresh each call.
vendor/baseline is verbatim upstream for skill-content drift detection only, not doc retrieval, so read it when running theupdateaction and not on a normal lookup - Does not auto-overwrite on update.
updateis advisory. User approves any merge before changes land
Gotchas
- Windows Git Bash:
ctx7 docs /org/project "..."gets path-mangled toC:/Program Files/Git/org/project. Always prefix withMSYS_NO_PATHCONV=1.ctx7 libraryis unaffected. Full detail: context/cli.md - Prefer the
CONTEXT7_API_KEYenv var overctx7 login:ctx7 logintriggers browser OAuth and writes a token to~/.ctx7/. The env var is simpler and portable across machines. See context/cli.md - No content tuning: CLI has no
--tokens/--limitflag. Default depth is server-controlled. For more content per call, prefer MCP (measured ratio in context/mcp.md) - Don't run
ctx7 skills installinto.claude/skills/: this plugin owns the Context7 lookup surface. Installing Upstash'sfind-docsskill alongside creates a parallel surface that fragments lookups and drifts independently