
Context7
Resolve a library ID and pull fresh documentation snippets from the Context7 API via a bash wrapper so your agent codes against current docs instead of stale training data.
Overview
Context7 is an agent skill most often used in Build (also Ship, Operate) that searches Context7 for library IDs and fetches up-to-date documentation through a bash REST wrapper.
Install
npx skills add https://github.com/netresearch/context7-skill --skill context7What is this skill?
- Bash wrapper `context7.sh` with `search <query>` and `docs <library-id> [topic] [mode]`
- Uses Context7 REST API v2 (`GET /search`, docs fetch) with optional `CONTEXT7_API_KEY` Bearer auth
- Sends `X-Context7-Source: claude-skill` header for attribution
- Search results include library ID, title, snippet counts, benchmark score, and description via jq formatting
- Derived from @upstash/context7-mcp behavior without requiring MCP runtime for basic CLI use
- 2 CLI commands: search and docs
- Context7 API base path v2 documented in skill
Adoption & trust: 492 installs on skills.sh; 20 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your agent is coding against a library but only has outdated or hallucination-prone API knowledge from training data.
Who is it for?
Builders using Claude Code or terminal agents who want Context7 doc lookup without standing up the full MCP server for every task.
Skip if: Offline-only workflows with no network, or teams that already standardize on Context7 MCP inside the IDE with no need for a shell skill.
When should I use this skill?
User needs current third-party library documentation, Context7 lookup, or mentions @upstash/context7-mcp-style search and docs fetch from the terminal.
What do I get? / Deliverables
You retrieve Context7 search hits and targeted doc snippets keyed by library ID so implementation steps align with current published documentation.
- Formatted library search results (ID, scores, descriptions)
- Fetched documentation snippets for a chosen library ID and topic
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Library lookup and doc fetch is core Build work whenever you wire third-party packages or APIs into the product. Integrations subphase covers connecting external doc and knowledge services into the agent loop during implementation.
Where it fits
Search for a payment SDK library ID and pull topic docs before writing the webhook handler.
Fetch server framework docs to confirm middleware signatures during API implementation.
Cross-check public API usage against Context7 snippets before tagging a release.
Re-fetch docs after a minor version bump to see breaking changes affecting production.
How it compares
CLI skill package wrapping Context7 HTTP APIs—not the MCP server itself, though behavior mirrors @upstash/context7-mcp.
Common Questions / FAQ
Who is context7 for?
Solo developers and agent users who integrate many third-party libraries and want searchable, fetchable docs from Context7 during coding sessions.
When should I use context7?
During Build when wiring SDKs or APIs, during Ship when verifying integration docs before release, and during Operate when debugging a dependency behavior against current docs.
Is context7 safe to install?
The skill runs curl against context7.com and may use a `CONTEXT7_API_KEY`; review the Security Audits panel on this Prism page and treat API keys as secrets.
SKILL.md
READMESKILL.md - Context7
#!/bin/bash # Context7 REST API wrapper # Based on @upstash/context7-mcp source # Usage: context7.sh <command> [args...] # Commands: # search <query> - Search for library ID # docs <library-id> [topic] [mode] - Fetch documentation set -e CONTEXT7_API_KEY="${CONTEXT7_API_KEY:-}" BASE_URL="https://context7.com/api/v2" # Build auth header if API key is set build_headers() { local headers=() if [ -n "$CONTEXT7_API_KEY" ]; then headers+=(-H "Authorization: Bearer $CONTEXT7_API_KEY") fi headers+=(-H "X-Context7-Source: claude-skill") echo "${headers[@]}" } # Search for library ID # API: GET /v2/search?query=<query> search_library() { local query="$1" if [ -z "$query" ]; then echo "Usage: context7.sh search <query>" echo "Example: context7.sh search react" exit 1 fi local encoded_query encoded_query=$(printf '%s' "$query" | jq -sRr @uri) local url="${BASE_URL}/search?query=${encoded_query}" echo "Searching for: $query" echo "---" local response if [ -n "$CONTEXT7_API_KEY" ]; then response=$(curl -s "$url" -H "Authorization: Bearer $CONTEXT7_API_KEY") else response=$(curl -s "$url") fi # Format results echo "$response" | jq -r ' if .results then .results[] | "ID: \(.id)\nName: \(.title // "Unknown")\nSnippets: \(.totalSnippets // "N/A") | Score: \(.benchmarkScore // "N/A")\nDescription: \(.description // "No description")[0:100]\n---" elif .error then "Error: \(.error)" else . end ' 2>/dev/null || echo "$response" } # Fetch documentation # API: GET /v2/docs/<mode>/<username>/<library>[/<tag>]?type=txt&topic=<topic> fetch_docs() { local library_id="$1" local topic="$2" local mode="${3:-code}" # Default to 'code' mode if [ -z "$library_id" ]; then echo "Usage: context7.sh docs <library-id> [topic] [mode]" echo "" echo "Arguments:" echo " library-id Format: /org/project or /org/project/version" echo " topic Optional: Focus area (e.g., 'hooks', 'routing')" echo " mode Optional: 'code' (default) or 'info'" echo "" echo "Examples:" echo " context7.sh docs /facebook/react hooks" echo " context7.sh docs /vercel/next.js routing code" echo " context7.sh docs /vercel/next.js \"app router\" info" exit 1 fi # Validate mode if [ "$mode" != "code" ] && [ "$mode" != "info" ]; then echo "Error: mode must be 'code' or 'info'" exit 1 fi # Remove leading slash and build URL path local cleaned_id="${library_id#/}" local url="${BASE_URL}/docs/${mode}/${cleaned_id}?type=txt" if [ -n "$topic" ]; then local encoded_topic encoded_topic=$(printf '%s' "$topic" | jq -sRr @uri) url="${url}&topic=${encoded_topic}" fi echo "Fetching docs: /$cleaned_id" echo "Mode: $mode${topic:+ | Topic: $topic}" echo "---" if [ -n "$CONTEXT7_API_KEY" ]; then curl -s "$url" \ -H "Authorization: Bearer $CONTEXT7_API_KEY" \ -H "X-Context7-Source: claude-skill" else curl -s "$url" \ -H "X-Context7-Source: claude-skill" fi } # Main command dispatch case "${1:-}" in search) shift search_library "$@" ;; docs) shift fetch_docs "$@" ;; -h|--help|help) echo "Context7 Documentation Lookup" echo "" echo "Usage: context7.sh <command> [args...]" echo "" echo "Commands:" echo " search <query> Search for library ID" echo " docs <library-id> [topic] [mode] Fetch documentation" echo "" echo "Modes:" echo " code API references and code examples (default)" echo " info Conceptual guides and tutorials" e