netresearch/context7-skill / skills/context7
context7
VerifiedUse when looking up library documentation, API references, framework patterns, or code examples for ANY library (React, Next.js, Vue, Django, Laravel, etc.) and the Context7 MCP server is unavailable or not configured. Fetches the same current docs directly via the Context7 REST API as a fallback. Triggers on: how to use library, API docs, framework pattern, import usage, library example.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.6 KB |
| scripts/context7.shexecutable | script | 4.7 KB |
scripts/context7.sh
View on GitHub#!/bin/bash
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: Netresearch DTT GmbH
# 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"
# GET a URL with the source header and, when CONTEXT7_API_KEY is set, the
# API key as a bearer token. The key reaches curl on standard input
# (`-H @-`, curl 7.55 or later), never on its command line, which other
# local users can read from the process list. printf is a shell builtin, so
# the key is in no process's arguments at all.
api_get() {
local url="$1"
if [ -n "$CONTEXT7_API_KEY" ]; then
printf 'Authorization: Bearer %s\n' "$CONTEXT7_API_KEY" |
curl -s "$url" -H "X-Context7-Source: claude-skill" -H @-
else
curl -s "$url" -H "X-Context7-Source: claude-skill"
fi
}
# 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
response=$(api_get "$url")
# 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 "---"
api_get "$url"
}
# 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"
echo ""
echo "Examples:"
echo " context7.sh search react"
echo " context7.sh search \"next.js app router\""
echo " context7.sh docs /facebook/react hooks"
echo " context7.sh docs /vercel/next.js routing"
echo " context7.sh docs /prisma/prisma queries info"
echo ""
echo "Environment:"
echo " CONTEXT7_API_KEY Optional API key for higher rate limits"
echo " Get one at: https://context7.com/dashboard"
exit 0
;;
*)
echo "Context7 Documentation Lookup"
echo "Usage: context7.sh <command> [args...]"
echo "Run 'context7.sh --help' for usage information"
exit 1
;;
esac
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization. | Stars: 467k | Updated | Claude CodeCodex | Verified | Install |
| academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file). | Stars: 196k | Updated | Claude CodeCodex | Unverified | Install |
| doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |