Context7 Documentation Lookup
Use scripts/context7.py to fetch current library documentation without MCP tool-schema overhead.
This is an execution skill. Decide whether to search or fetch directly, run the script, then use the returned docs to answer. Keep the main flow lean and load REFERENCES.md only when you need example commands, common library IDs, or troubleshooting details.
When to Use
Activate when the user asks for:
- current library or framework APIs
- official code examples or implementation patterns
- version-specific docs or migration guidance
- third-party tool setup that depends on vendor docs
- documentation for libraries in npm, PyPI, or similar ecosystems
Core Workflow
-
If you already know the library ID, skip search and call:
python3 scripts/context7.py docs <library-id> [topic] [mode] -
If the library ID is unclear, search first:
python3 scripts/context7.py search "<query>" -
Pick the best matching library ID, then fetch docs.
-
Use the returned docs to answer with version-aware guidance and cite the source URL when the script provides one.
Decision Rules
- Search only when the library ID is unclear or ambiguous.
- Use
codemode (default) for API references, function signatures, and implementation examples. - Use
infomode for conceptual guides, architecture, and migration-heavy questions. - Use a focused topic first; broaden it if results are empty or off-target.
- For version-specific docs, append the version to the library ID (for example
/vercel/next.js/14) or include the version in the topic.
If syntax is unclear, run:
python3 scripts/context7.py --help
Output Rules
- Prefer official patterns over generic recall when the docs provide a direct answer.
- Keep the answer tied to the user's requested library and version.
- Call out deprecations, caveats, or migration notes when the docs surface them.
- If the docs are incomplete, say so and fall back to the best available general knowledge instead of inventing specifics.
Recovery
| Issue | Action |
|---|---|
| Library ID is unclear | Re-run search with an alternate name, org name, or broader query. |
| Results are empty or irrelevant | Broaden the topic, then retry with the other mode (code vs info). |
| User needs a specific version | Add the version to the library ID or mention it in the topic, then verify the returned docs match. |
| Rate limited | Tell the user about CONTEXT7_API_KEY, then use best-effort fallback guidance if needed. |
| Script usage is unclear | Run python3 scripts/context7.py --help. |
| Script or network failure | Say live docs lookup failed and continue with clearly-labeled fallback knowledge. |
License: MIT See also: REFERENCES.md