
Context7
- 47 installs
- 33 repo stars
- Updated July 27, 2026
- dirnbauer/webconsulting-skills
Looks up current library documentation and code examples for any framework via the Context7 REST API.
About
Fetches current library documentation, API references, and code examples via the Context7 REST API. A developer uses it when asking about a library's API, framework patterns, or version-specific behavior.
- Fetches current docs via the Context7 REST API
- Search library IDs, then fetch focused topic docs
Context7 by the numbers
- 47 all-time installs (skills.sh)
- Ranked #823 of 1,879 Documentation skills by installs in the Skillselion catalog
- Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/dirnbauer/webconsulting-skills --skill context7Add your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 47 |
|---|---|
| repo stars | ★ 33 |
| Last updated | July 27, 2026 |
| Repository | dirnbauer/webconsulting-skills ↗ |
What it does
Looks up current library documentation and code examples for any framework via the Context7 REST API.
Files
Context7 Documentation Lookup Skill
Fetch current library documentation, API references, and code examples via the Context7 REST API.
When to Use
Use this skill when the user asks about library APIs, framework patterns, or version-specific behavior. Trigger on:
- Library questions: "How do I use [library]?", "[library] API docs", "[library] patterns"
- Import statements:
import,require,fromfollowed by a library name - Framework-specific topics: hooks, routing, middleware, ORM queries, schema definitions
When NOT to Use
Do NOT use this skill for:
- General programming concepts (closures, recursion, design patterns)
- Code review or refactoring tasks
- Debugging business logic
- Writing scripts from scratch without library-specific questions
Core Workflow
1. Search for the library ID:
scripts/context7.sh search "library-name"2. Pick the best result: Choose the ID with the highest score and most relevant description. Prefer official sources (e.g., /vercel/next.js over community forks).
3. Fetch documentation with a focused topic:
scripts/context7.sh docs "<library-id>" "<topic>" "<mode>"Always extract a specific topic from the user's question. For "How does React Suspense work with server components?", use topic suspense server components.
Parameters
| Parameter | Required | Description |
|---|---|---|
library-id | Yes | From search results, format /vendor/library |
topic | No | Focus area extracted from user query (e.g., hooks, routing, validation) |
mode | No | code (default) for API references; info for conceptual guides |
Mode Selection
Use code mode (default) when the user asks for API references, code examples, or implementation patterns.
Use info mode when the user asks for conceptual explanations, architecture guides, or migration tutorials.
Examples
# React hooks API
scripts/context7.sh search "react"
scripts/context7.sh docs "/facebook/react" "hooks" "code"
# Next.js App Router conceptual guide
scripts/context7.sh search "nextjs"
scripts/context7.sh docs "/vercel/next.js" "app router" "info"
# Django ORM queries
scripts/context7.sh search "django"
scripts/context7.sh docs "/django/django" "queryset filter" "code"
# Laravel Eloquent relationships
scripts/context7.sh search "laravel"
scripts/context7.sh docs "/laravel/framework" "eloquent relationships" "code"Environment Configuration
Set CONTEXT7_API_KEY for higher rate limits (optional):
export CONTEXT7_API_KEY="your-api-key"---
Contributing: https://github.com/netresearch/context7-skill
---
Credits & Attribution
This skill is based on the excellent work by [Netresearch DTT GmbH](https://www.netresearch.de/).
Original repository: https://github.com/netresearch/context7-skill
Copyright (c) Netresearch DTT GmbH — Methodology and best practices (MIT / CC-BY-SA-4.0)
Special thanks to Netresearch DTT GmbH for their generous open-source contributions to the TYPO3 community, which helped shape this skill collection. Adapted by webconsulting.at for this skill collection
#!/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"
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