Agent skill
context7
Fetch up-to-date documentation for any open-source library or framework. Use when the user asks to look up docs, check an API, find code examples, or verify how a feature works — especially with a specific library name, version migration, or phrases like 'what's the current way to...' or 'the API might have changed'. Also covers setup and configuration docs. Do NOT use for general programming concepts, internal project code, or version lookups (use deps-dev).
Install this agent skill to your Project
npx add-skill https://github.com/trancong12102/agentskills/tree/main/context7
SKILL.md
Context7
Retrieve current documentation for software libraries by querying the Context7 API. This is especially useful when you're unsure about an API's current interface — library docs change frequently and your training data may be outdated.
Requires CONTEXT7_API_KEY environment variable.
When to Use
- Looking up how a library function works (e.g., "how does
useEffectcleanup work?") - Checking if an API has changed in a newer version
- Finding code examples for a specific library feature
- Verifying correct import paths or function signatures
- Installing or configuring a library and needing setup docs
When NOT to Use
- General programming questions (e.g., "how do closures work in JS?")
- Questions about your own project's internal code
- Topics unrelated to a specific open-source library or framework
Workflow
DO NOT read script source code. Run scripts directly and use --help for usage.
Step 1: Search for the Library
python3 scripts/context7.py search <library> <topic>
Returns TSV with top 5 matches: id, title, snippets. Use the id from the best-matching row for the fetch step.
Step 2: Fetch Documentation
python3 scripts/context7.py fetch <library_id> <topic> [--max-tokens N]
Fetches documentation snippets relevant to the topic, truncated to a token budget (default: 5000).
Choosing --max-tokens:
| Scenario | Tokens | Why |
|---|---|---|
| Quick lookup (one function signature) | 2000 | Keeps output focused, faster response |
| Typical usage (API patterns, examples) | 5000 (default) | Good balance of depth and brevity |
| Broad exploration (migration guide, full API surface) | 8000–10000 | Needed when topic spans multiple sections |
Run python3 scripts/context7.py --help for full usage.
Examples
# Find React library ID, then fetch useState docs
python3 scripts/context7.py search react "useState hook"
python3 scripts/context7.py fetch /websites/react_dev "useState hook with objects"
# Smaller budget for a quick lookup
python3 scripts/context7.py fetch /vercel/next.js "middleware redirect" --max-tokens 2000
# Broader exploration
python3 scripts/context7.py fetch /langchain-ai/langchainjs "retrieval chain setup" --max-tokens 8000
Rules
- Write specific queries —
"useState hook with objects"retrieves much better results than"hooks", because the API ranks snippets by relevance to your query. - Always search before fetching — Library IDs aren't guessable (e.g.,
/websites/react_dev), so you need the search step to find the right one. - Match
--max-tokensto the task — Use the table above. Overshooting wastes context window; undershooting may miss the answer.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
deps-dev
Look up the latest stable version of any open-source package across npm, PyPI, Go, Cargo, Maven, and NuGet. Use when the user asks 'what's the latest version of X', 'what version should I use', 'is X deprecated', 'how outdated is my package.json/requirements.txt/Cargo.toml', or needs version numbers for adding or updating dependencies. Also covers pinning versions, checking if packages are maintained, or comparing installed vs latest versions. Do NOT use for private/internal packages or for looking up documentation (use context7).
github-codebase-search
Semantic search for public GitHub repos without cloning. Use when the user wants to understand how an external library or framework works internally, investigate upstream bugs, trace code paths in a repo they haven't cloned, or search GitHub source code by intent. Do NOT use for local codebase questions (use codebase-search), documentation lookup (use context7), or private repos.
council-review
Multi-model AI code review — runs Codex, Claude, and Simplify reviews in parallel, then synthesizes a unified report. Use when the user asks to review code changes, audit a diff, check code quality, review a PR, review commits, or review uncommitted changes. Also covers 'code review', 'review my changes', 'check this before I merge', or wanting multiple perspectives on code. Do NOT use for documentation/markdown review or trivial single-line changes.
react-native-advanced
React Native and Expo patterns for navigation, data fetching lifecycle, infinite scroll lists, form handling, state persistence, authentication routing, gesture-driven animations, bottom sheets, push notifications, and OTA updates. Use when building Expo/React Native apps that need screen-level data prefetching, auth guards with protected routes, infinite scroll feeds, native form input handling, offline-capable state persistence, platform-specific setup (focus/online managers), fluid animations and gesture interactions, modal bottom sheets, push notification flows, or over-the-air update strategies. Do not use for React web apps.
react-web-advanced
Web-specific React patterns for type-safe file-based routing, route-level data loading, server-side rendering, search param validation, code splitting, and list virtualization. Use when building React web apps with route loaders, SSR streaming, validated search params, lazy route splitting, or virtualizing large DOM lists. Do not use for React Native apps — use react-native-advanced instead.
ast-grep
Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for code patterns, find specific language constructs, or locate code with particular structural characteristics.
Didn't find tool you were looking for?