Use Context7 MCP to access up-to-date library documentation when working with project dependencies. Always consult Context7 for accurate API references, patterns, and examples when doing in-depth work with libraries.
This skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill provides access to up-to-date, version-specific documentation for libraries through the Context7 MCP server. Instead of relying on potentially outdated training data, use Context7 to fetch current documentation, API references, and code examples directly from library sources.
ALWAYS use Context7 when:
Before starting significant work with any library, use Context7 to:
Before fetching documentation, resolve the library ID (if not already known):
Use the Context7 MCP tool: resolve-library-id
Arguments: { "libraryName": "next.js" }
This returns the exact Context7-compatible library ID and available versions.
Once you have the library ID, fetch documentation for your specific use case:
Use the Context7 MCP tool: get-library-docs
Arguments: {
"context7CompatibleLibraryID": "/vercel/next.js",
"topic": "routing and server components",
"tokens": 5000
}
Recommended token ranges:
Use the fetched documentation to:
1. Resolve library ID: resolve-library-id("next.js")
2. Fetch docs: get-library-docs("/vercel/next.js", "server actions and mutations", 5000)
3. Review documentation for current patterns
4. Implement features following docs
5. If errors occur, fetch more specific docs about the error
1. Resolve library ID: resolve-library-id("fastapi")
2. Fetch docs: get-library-docs("/tiangolo/fastapi", "middleware and CORS", 4000)
3. Review middleware patterns and configuration
4. Implement middleware based on official examples
5. Verify implementation matches current best practices
1. Resolve library IDs: resolve-library-id("zod")
2. Fetch docs: get-library-docs("/colinhacks/zod", "schema validation and type inference", 3000)
3. Review schema definition patterns
4. Create schemas following docs
5. Validate integration with framework patterns
Before implementing any significant feature with a library, fetch Context7 docs to ensure you're using current patterns and APIs.
Be specific in your topic parameter:
When fetching docs, note the version returned and compare with your package.json version. Request specific versions if needed:
context7CompatibleLibraryID: "/vercel/next.js/v15.0.0"
After fetching docs for a common pattern, remember the key insights for similar use cases. Re-fetch if uncertain or if significant time has passed.
For features spanning multiple libraries, fetch docs for each relevant library.
When encountering library-specific errors:
If resolve-library-id doesn't find a library:
If returned docs are too general:
If the version in Context7 differs from your package.json:
/org/lib/v1.2.3Before using this skill, verify Context7 MCP is configured:
Check MCP configuration:
claude mcp list
Should show context7 in the list of available MCP servers.
If not configured, the .mcp.json file in this plugin provides the configuration. Ensure it's loaded or add Context7 MCP manually:
# Remote server
claude mcp add --transport http context7 https://mcp.context7.com/mcp \
--header "CONTEXT7_API_KEY: ctx7sk_your_api_key"
# OR local server
claude mcp add context7 -- npx -y @upstash/context7-mcp \
--api-key ctx7sk_your_api_key
This skill ensures you always have access to current, accurate library documentation when building features. By proactively using Context7, you reduce bugs, follow best practices, and implement features correctly the first time.
Remember: When in doubt about any library API, pattern, or feature, fetch Context7 docs before implementing.