context7
Install this skill
npx skills add intellectronica/agent-skillsWorks across Claude Code, Cursor, Codex, Copilot & Antigravity
Context7 serves as a real-time documentation retrieval interface for modern software engineering. By providing an abstraction over diverse documentation sources, the tool bypasses the risks associated with static model training data. Developers interact with the service through a two-stage process: identifying the correct library index via search and then pulling specific, context-aware snippets for that technology. The API supports raw text formats, making it highly compatible with terminal-based workflows and IDE-integrated coding assistants. By focusing on live library identifiers, it ensures that technical queries are addressed with up-to-date syntax, API definitions, and configuration standards. This tool is essential for maintaining accuracy when working with rapidly evolving frameworks where offline documentation may have fallen behind the latest production releases.
When to Use This Skill
- β’Retrieving the latest syntax for specific React hooks before implementation
- β’Checking current routing conventions for Next.js when migration docs change
- β’Verifying FastAPI dependency injection patterns against the canonical source
- β’Updating legacy codebase patterns using current library best practices
How to Invoke This Skill
Example prompts that trigger this skill in Claude Code, Cursor, or Antigravity:
- βLook up the latest documentation for [library] regarding [topic]
- βFind the library ID for [library] to fetch [topic] info
- βGet text-based documentation for [topic] in [library]
- βSearch Context7 for current [library] API references for [topic]
Pro Tips
- π‘For precise results, use both `libraryName` and a descriptive `query` in Step 1 to identify the most relevant library ID.
- π‘Always include a focused `query` parameter in Step 2 (Fetch Documentation) to narrow down the retrieved information to exactly what you need.
- π‘Consider piping the output of the Context7 documentation retrieval into another AI skill for summarization or reformatting to quickly digest complex information.
What this skill does
- β’Search across indexed technical libraries to retrieve valid project IDs
- β’Fetch granular documentation snippets based on specific technical queries
- β’Output retrieval data in plain text for easier reading within terminal buffers
- β’Automate the resolution of library endpoints without manual browsing
When not to use it
- βWhen you need to perform broad architectural research across non-documented domains
- βWhen you have no internet access to perform curl requests against the API
- βWhen the required library is not indexed within the Context7 system
Example workflow
- Identify the library and specific topic requiring clarification
- Execute a curl command to search for the library ID matching your keyword
- Parse the JSON response using jq to isolate the correct library ID
- Run a second curl command using the library ID to fetch the specific text content
- Direct the output to a temporary file or read it directly in your terminal
Prerequisites
- βCommand-line environment with curl installed
- βjq utility installed for JSON parsing
Pitfalls & limitations
- !Failing to URL-encode search queries containing spaces can result in request errors
- !Assuming the first search result is always the intended library target
- !Rate limiting may occur if high volumes of requests are sent in rapid succession
FAQ
How it compares
Unlike general-purpose LLM training data, Context7 provides a direct pipeline to current documentation, reducing the likelihood of hallucinations regarding deprecated APIs.
π Full skill instructions β original source: intellectronica/agent-skills
## Overview
This skill enables retrieval of current documentation for software libraries and components by querying the Context7 API via curl. Use it instead of relying on potentially outdated training data.
## Workflow
### Step 1: Search for the Library
To find the Context7 library ID, query the search endpoint:
curl -s "https://context7.com/api/v2/libs/search?libraryName=LIBRARY_NAME&query=TOPIC" | jq '.results[0]'**Parameters:**
-
libraryName (required): The library name to search for (e.g., "react", "nextjs", "fastapi", "axios")-
query (required): A description of the topic for relevance ranking**Response fields:**
-
id: Library identifier for the context endpoint (e.g., /websites/react_dev_reference)-
title: Human-readable library name-
description: Brief description of the library-
totalSnippets: Number of documentation snippets available### Step 2: Fetch Documentation
To retrieve documentation, use the library ID from step 1:
curl -s "https://context7.com/api/v2/context?libraryId=LIBRARY_ID&query=TOPIC&type=txt"**Parameters:**
-
libraryId (required): The library ID from search results-
query (required): The specific topic to retrieve documentation for-
type (optional): Response format - json (default) or txt (plain text, more readable)## Examples
### React hooks documentation
# Find React library ID
curl -s "https://context7.com/api/v2/libs/search?libraryName=react&query=hooks" | jq '.results[0].id'
# Returns: "/websites/react_dev_reference"
# Fetch useState documentation
curl -s "https://context7.com/api/v2/context?libraryId=/websites/react_dev_reference&query=useState&type=txt"### Next.js routing documentation
# Find Next.js library ID
curl -s "https://context7.com/api/v2/libs/search?libraryName=nextjs&query=routing" | jq '.results[0].id'
# Fetch app router documentation
curl -s "https://context7.com/api/v2/context?libraryId=/vercel/next.js&query=app+router&type=txt"### FastAPI dependency injection
# Find FastAPI library ID
curl -s "https://context7.com/api/v2/libs/search?libraryName=fastapi&query=dependencies" | jq '.results[0].id'
# Fetch dependency injection documentation
curl -s "https://context7.com/api/v2/context?libraryId=/fastapi/fastapi&query=dependency+injection&type=txt"## Tips
- Use
type=txt for more readable output- Use
jq to filter and format JSON responses- Be specific with the
query parameter to improve relevance ranking- If the first search result is not correct, check additional results in the array
- URL-encode query parameters containing spaces (use
+ or %20)- No API key is required for basic usage (rate-limited)
How to Use This Skill Unit
Option A: Project-Specific (Recommended)
- Click "Download" above
- In your project, create the directory:
.agent/skills/context7/ - Save the file as
SKILL.md - The agent will automatically discover the skill based on its description.
Option B: Global Installation (All Agents)
Save the file to these locations to make it available across all projects:
- Claude Code:
~/.claude/skills/intellectronica/agent-skills/context7/SKILL.md - Cursor:
~/.cursor/skills/intellectronica/agent-skills/context7/SKILL.md - Antigravity:
~/.gemini/antigravity/skills/intellectronica/agent-skills/context7/SKILL.md
π Install with CLI:npx skills add intellectronica/agent-skills