context7
Original:🇺🇸 English
Translated
Provides up-to-date documentation and version guidance for external libraries. Use when working with any third-party library (JS, Python, Ruby, Go, .NET, etc.), when the user asks about a library-specific API or best practice, when debugging a dependency issue, or when installing or upgrading a dependency. Prefer this over guessing or relying on stale knowledge.
1installs
Added on
NPX Install
npx skill4agent add kittne/codex-skills-by-codex context7Tags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Context7
Workflow
- Identify the library/framework involved (and the language/ecosystem).
- Determine the installed version from the repo when possible.
- Resolve the Context7 library ID.
- Query Context7 docs for the user's exact question (narrow, API-surface specific).
- Answer using doc-backed facts and note any version-specific caveats.
Version Detection (Repo-Local)
- JavaScript/Node: check ,
package.json,package-lock.json,pnpm-lock.yaml.yarn.lock - Python: check ,
pyproject.toml,requirements*.txt,poetry.lock.Pipfile.lock - Go: check .
go.mod - Rust: check /
Cargo.toml.Cargo.lock - Ruby: check .
Gemfile.lock - .NET: check /
*.csproj.packages.lock.json
If the version cannot be determined, assume the user means the latest docs and phrase the answer as such.
Tool Usage (MCP)
- Always call first to get the exact library ID.
resolve-library-id - Then call with a specific, narrow query.
query-docs - Do not call Context7 tools more than 3 times per user question.
Example Query Pattern
- Resolve (call ):
resolve-library-id
yaml
libraryName: "<package/framework name>"
query: "<what the user is trying to do + API names + error strings>"- Query docs (call ):
query-docs
yaml
libraryId: "</org/project[/version]>"
query: "<precise question with config keys / function names / expected behavior>"Response Rules
- Prefer official docs and primary references returned by Context7.
- If docs are ambiguous or missing, ask a targeted follow-up question or state uncertainty.
- If the user's installed version differs materially from the docs, call it out and suggest the relevant migration/upgrade notes.
References
references/context7.md
Extended Guidance
Use this section for higher-fidelity Context7 usage when the question is ambiguous, version-sensitive,
or likely to change.
Decision Rules (When to Query)
- Query Context7 if the user names a library, framework, or API surface.
- Query Context7 if the library version is unknown but likely to matter.
- Query Context7 before suggesting configuration flags or function signatures.
- Do not guess on breaking changes; confirm against docs.
Version Resolution Tips
- Prefer lockfiles over manifests (lockfiles reflect the resolved version).
- If multiple versions exist (monorepo), use the one in the target package.
- If a toolchain is involved (Next.js, Django), check for related config files too.
Query Construction Examples
text
Query: "How do I configure CORS in FastAPI?"
Better: "FastAPI CORS middleware example with allowed origins and credentials"text
Query: "React state update in a loop"
Better: "React setState functional update in loop, avoid stale state"text
Query: "Prisma transaction"
Better: "Prisma $transaction interactive example with timeout and rollback behavior"Failure Modes and Fixes
- Library not found:
- Try the official repo name (e.g., ).
vercel/next.js - Try the package name on the registry (e.g., ).
@nestjs/core
- Try the official repo name (e.g.,
- Docs too broad:
- Narrow with function names, config keys, error messages.
- Docs conflict with local version:
- Call out the mismatch and suggest checking migration guides.
Response Quality Checklist
- Cite the specific API/config key from docs.
- Note version-specific caveats if the project version is known.
- Provide a minimal working example or code snippet if useful.
- If uncertain, ask a single targeted question rather than guessing.
Reference Index
rg -n "Required Tool Sequence|Resolve the library ID" references/context7.mdrg -n "Version Awareness|installed version" references/context7.mdrg -n "Query Tips|Include the relevant API surface" references/context7.mdrg -n "Failure Modes|cannot be resolved" references/context7.md
Version Detection Commands (Examples)
bash
rg -n "\"dependencies\"|\"devDependencies\"" package.json
rg -n "go\\s+\\d+\\.\\d+" go.mod
rg -n "django|fastapi|flask" requirements*.txtQuery Refinement Steps
- Start with the exact API or error string.
- Add the config keys or flags involved.
- Narrow to the specific environment (browser/node/server).
- Re-query if results are too general.
Output Consistency Checklist
- Note the library version you used (or that it was unknown).
- Include at least one verified example or usage pattern.
- Call out any breaking changes or deprecations.
Reference Index (Expanded)
rg -n "Resolve the library ID|query docs" references/context7.mdrg -n "Version Awareness|installed" references/context7.mdrg -n "Failure Modes|ambiguous" references/context7.md
Quick Questions (When Stuck)
- What is the minimal change that solves the issue?
- What is the rollback plan?
- What is the highest-risk assumption?
- What is the simplest validation step?
- What is the known-good baseline?
- What evidence would change the decision?
- What is the user-visible impact?
- What is the operational impact?
- What is the most likely failure mode?
- What is the fastest safe experiment?
Reference Index (Extra)
rg -n "Checklist|checklist" references/context7.mdrg -n "Example|examples" references/context7.mdrg -n "Workflow|process" references/context7.mdrg -n "Pitfall|anti-pattern" references/context7.mdrg -n "Testing|validation" references/context7.mdrg -n "Security|risk" references/context7.mdrg -n "Configuration|config" references/context7.mdrg -n "Deployment|operations" references/context7.mdrg -n "Troubleshoot|debug" references/context7.mdrg -n "Performance|latency" references/context7.mdrg -n "Reliability|availability" references/context7.mdrg -n "Monitoring|metrics" references/context7.mdrg -n "Error|failure" references/context7.mdrg -n "Decision|tradeoff" references/context7.mdrg -n "Migration|upgrade" references/context7.md