setup
Check or configure Context7 for lookups: the ctx7 CLI, CONTEXT7_API_KEY auth and the Context7 MCP server, with a CLI install on request.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 30
- Forks
- 7
01 前言 Front Matter
- shell
- bash
- description
- Check or configure Context7 for lookups: the ctx7 CLI, CONTEXT7_API_KEY auth and the Context7 MCP server, with a CLI install on request.
- allowed-tools
- [ "Bash(ctx7 --version*)", "Bash(npm view ctx7 version*)" ]
- argument-hint
- [check|apply] [install-cli]
- user-invocable
- true
- disable-model-invocation
- true
03 SKILL.md 正文
Pre-computed context
Installed CLI version: !ctx7 --version 2>/dev/null || echo "not installed"
Latest published CLI version: !npm view ctx7 version 2>/dev/null || echo "unknown (npm registry unreachable)"
MCP availability: if mcp__context7__resolve-library-id and mcp__context7__query-docs are in your tool list, the Context7 MCP server is configured.
Actions
/context7:lookup works through either of two paths: the CLI (ctx7 via npm) or the
Context7 MCP server (configured by the consuming project). CONTEXT7_API_KEY is optional for
both; what it changes is Context7 CLI § When is authentication required?.
- No argument or
check: run the check. apply: run the check, then the guidance-only remediations (auth, MCP).apply install-cli: also install or upgrade the globalctx7.
Never prompt; the action given is the whole instruction. Every action is safe to rerun.
check (read-only)
Report a PASS/FAIL/INFO table from the pre-computed context, with one remediation line per FAIL. Do not install, edit config, or write anything.
- CLI path. Installed and matching the latest published version is PASS. Installed but behind
is INFO, remediation
apply install-cli. Absent is INFO when the MCP path is live, otherwise it counts against step 3. - MCP path. Present in your tool list is PASS; absent is INFO. The CLI alone is sufficient.
- At least one path. FAIL only when neither the CLI nor the MCP server resolves, since every
lookup would then be blocked. Remediation:
apply install-cli, or add the MCP server (routed inapply). - Auth. INFO: whether
CONTEXT7_API_KEYis set ([ -n "$CONTEXT7_API_KEY" ]). Report presence only; never print the value. Absence is never a FAIL: a key is optional (pointer in Actions above). - Windows Git Bash. INFO: prefix CLI
ctx7 docs /org/project "..."calls withMSYS_NO_PATHCONV=1(a no-op elsewhere, so always safe), or the ID gets path-mangled. Detail:${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/cli.md.
apply
Refuse first: never run ctx7 setup (any form, --mcp included) or ctx7 skills install,
directly or through npx, even when the user asks for them in the same message. This plugin keeps
lookup in one skill it owns, never fragmented across a second, parallel one; what each command
installs is in ${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/cli.md, "Setup / install flags". Say
that you did not run them, and why, then continue with the steps below.
Run check, then resolve each finding. With both paths working, report "already configured" and
change nothing. State each change before making it, and re-detect before claiming it.
-
CLI, only with
apply install-cli, and only whencheckfoundctx7missing or behind:npm install -g ctx7@latestWithout a global install,
npx ctx7@latest <command>works per call; version floor and flags:${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/cli.md. Re-read the CLI version afterwards and report what it shows, never the install command's exit code alone. -
Auth, guidance only. Tell the user to set the key in their own shell profile or secret store, in preference to
ctx7 login:export CONTEXT7_API_KEY="<your-key>"It takes effect in a fresh session; report presence only and leave verification to that session. The
ctx7 logincaveat:${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/cli.md. -
MCP, guidance only. If the user wants the MCP path, point them to add a
context7server entry to their own MCP configuration; do not edit their.mcp.jsonfor them. The JSON (anonymous and API-key forms) and the unset-env-var caveat:${CLAUDE_PLUGIN_ROOT}/skills/lookup/context/mcp.md. -
Verify. Re-read the CLI version and your tool list; declare setup complete only when at least one path is live.
Output
What was already in place, what changed, what was skipped, and which lookup paths now work (CLI,
MCP, or both). A refused ctx7 setup or ctx7 skills install is listed under skipped with its
reason in full: this plugin keeps lookup in one skill, never fragmented across a parallel one.
Report every command as it happened: if one ran, say so and give its result, even when it failed;
never claim a command did not run when it did.
Boundaries
ctx7 setup, in any form, andctx7 skills installare refused; the rule is at the top ofapply.- Never edit the user's
.mcp.jsonwithout their consent: their MCP configuration is theirs. - Never write
CONTEXT7_API_KEYinto the repository, Claude Code settings or any config file, and never print it. - Never write the plugin cache, Claude Code user settings or
pluginConfigs: the cache is replaced on the next plugin update, and machine-wide Claude Code state belongs to the user. - Library lookups belong to
/context7:lookup.
04 同仓库更多 Skills
track
Backlog reads through the bound tracker: search open and closed items, view one item with its comments and state history. Use when another skill searches or reads tracker items.
reviewer-media
Reviewer media for one pull request: decides whether it needs a narrated walkthrough, builds the storyboard from /review:explain-change's digest, has /explainer-video:produce render it and hands the manifest to /source-control:pull-request media. Use when asked for 'reviewer media', 'a walkthrough video for this PR', 'a produced video of this change', or when pull-request ready or monitor hands a PR over.
route
Model and effort per agent role (orchestrator, worker, verifier, retrieval) for a multi-agent run, resolved through the bundled defaults and the user, team and personal override config layers into fenced JSON with single-agent and fan-out variants and the layer behind each value. Use when asked 'which model for the subagents', 'route the roles' or 'model routing', or before a skill passes a role's model on a spawn.
route
Model and effort per agent role (orchestrator, worker, verifier, retrieval) for a multi-agent run, resolved through the bundled defaults and the user, team and personal override config layers into fenced JSON with single-agent and fan-out variants and the layer behind each value. Use when asked 'which model for the subagents', 'route the roles' or 'model routing', or before a skill passes a role's model on a spawn.
principles
Module-design vocabulary for architecture findings, and the checks built on it. Use when: 'what is a deep module', 'what is a seam', 'deep vs shallow module', 'what is the deletion test', 'leverage and locality', 'module design vocabulary', 'which word do we use for X in architecture findings'. Scanning a codebase for friction is /architecture:improve.
write
Structured five-field bug report (title, steps to reproduce, expected vs actual, justified severity, suggested fix location) from an informal description, read-only. Use when the user names a defect they observed, or asks for one written up ('report a bug', 'file a bug', 'write this up as a bug').