Claude-skill-registry context7-skill
Access up-to-date, version-specific documentation and code examples from Context7. Use this skill to verify library and framework details.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/context7-skill" ~/.claude/skills/majiayu000-claude-skill-registry-context7-skill && rm -rf "$T"
manifest:
skills/data/context7-skill/SKILL.mdsource content
Context7 Skill
Overview
The Context7 skill connects you to accurate, version-specific documentation and code examples directly from the source. Use this skill to verify syntax, API details, and usage patterns for third-party libraries and frameworks, ensuring your code is based on the correct version.
Access Methods:
- MCP Tools (Primary): Direct calls to
andresolve_library_id
.query_docs - CLI Fallback (Secondary): A Python script (
) using the FastMCP v2 client, intended for use when direct MCP tools are unavailable.scripts/context7_cli.py
Prerequisites
- Context7 API Key: Must be set as the environment variable
.CONTEXT7_API_KEY - Python Manager (
): Required only if using the CLI fallback script.uv
Available Tools
1. Library Resolver (resolve-library-id
)
resolve-library-idResolves a package or library name to a Context7-compatible library ID and returns a list of matches.
- MCP Call:
resolve_library_id(query="...", libraryName="...") - CLI Command:
uv run scripts/context7_cli.py resolve-library-id <name>
2. Documentation Query (query-docs
)
query-docsRetrieves documentation and code examples using a specific library ID.
- MCP Call:
query_docs(libraryId="/org/project/version", query="...") - CLI Command:
uv run scripts/context7_cli.py query-docs <library_id> <query>
IMPORTANT: Tool names may have prefixes (e.g.,
) depending on the runtime environment. Always check available tools first.context7_resolve_library_id
Usage Guidelines
- Resolve First: Always obtain a valid library ID via
before querying, unless the user provides a full ID (e.g.,resolve_library_id
)./org/project/version - Limit Attempts: Do not retry a tool call more than three times for the same query. If unsuccessful, proceed with the best available information.
Workflow
Step 1: Check Availability
Determine if the
resolve_library_id and query_docs tools are directly available in your environment. If not, default to the CLI fallback commands.
Step 2: Resolve Library ID
Use
resolve-library-id to identify the correct library.
Selection Criteria:
- Exact Match: Prioritize names that exactly match the user's request.
- Relevance: Ensure the description aligns with the user's intent.
- Quality: Look for high documentation coverage (snippet counts), reputation, and benchmark scores.
Action:
- If ambiguous, ask the user for clarification.
- Briefly explain the selected library to the user.
- If no good match is found, clearly state this and suggest query refinements.
Step 3: Query Documentation
Use
query-docs with the resolved libraryId.
Handling Results:
- The tool returns a snippet or summary.
- Example Output:
Source: https://github.com/context7/react_dev/blob/main/learn.md ... (content) ... - Insufficient Info? If the returned text is incomplete, use a web fetch tool (if available) to retrieve the full content from the provided source URL.
Configuration
| Variable | Description | Required |
|---|---|---|
| API key for authenticating with Context7. | Yes |
Resources
: Unified CLI entry point for fallback access.scripts/context7_cli.py
: Solutions for common integration issues.references/troubleshooting.md