Back to Documentation & Writing

context7

documentationapi-referencelibrariesframeworkscontext7code-examplescoding-assistantdeveloper-tools
⭐ 273πŸ“„ CC0-1.0πŸ•’ 2026-04-25Source β†—

Install this skill

npx skills add intellectronica/agent-skills

Works 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

  1. Identify the library and specific topic requiring clarification
  2. Execute a curl command to search for the library ID matching your keyword
  3. Parse the JSON response using jq to isolate the correct library ID
  4. Run a second curl command using the library ID to fetch the specific text content
  5. 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

Is an API key required to use Context7?
No, the service does not require an API key for basic usage.
Why use type=txt instead of the default JSON format?
The txt format is specifically optimized for human readability, making it better for quick reference inside a command-line interface.
What should I do if my search query returns no relevant results?
Try refining the library name or using more specific keywords in the query parameter to improve relevance ranking.
Does this tool work with any programming language?
It works with any library indexed within the Context7 system, provided you can successfully identify its specific library ID.

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.

Source & trust

⭐ 273 starsπŸ“„ CC0-1.0πŸ•’ Updated 2026-04-25
πŸ“„ Full skill instructions β€” original source: intellectronica/agent-skills
# Context7

## 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)

  1. Click "Download" above
  2. In your project, create the directory: .agent/skills/context7/
  3. Save the file as SKILL.md
  4. 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

Read the Master Guide: Mastering Agent Skills β†’

Recommended Rules

View more rules β†’

Recommended Workflows

View more workflows β†’

Recommended MCP Servers

View more MCP servers β†’

Take It Further

Maximize your productivity with these powerful resources

πŸ“‹

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
πŸ“–

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide

How to use this Skill in Claude Code & Cursor

For Claude Code (CLI)

To use this skill in Claude Code, copy the rule content into your project's custom instructions or follow our Add-Skill CLI guide. This ensures Claude follows your standards during every code generation.

For Cursor & Windsurf

For Cursor or Windsurf, individual skills are best used in the "Rules for AI" section. This specific unit helps the agent avoid documentation & writing issues, leading to cleaner, more efficient code.

Why the skill format matters: the standardized Agent Skills format lets your AI agent load detailed instructions only when they are relevant, keeping your prompt clean while improving results.

Source & attribution

This skill is categorized under Documentation & Writing and is published by intellectronica, maintained in intellectronica/agent-skills.

← Browse All Agent Skills
Sponsored AI assistant. Recommendations may be paid.