home / skills / openclaw / skills / context7-api
This skill fetches up-to-date library documentation via Context7 API to ensure accurate APIs, patterns, and best practices.
npx playbooks add skill openclaw/skills --skill context7-apiReview the files below or copy the command above to add this skill to your agents.
---
name: context7
description: |
Fetch up-to-date library documentation via Context7 API. Use PROACTIVELY when:
(1) Working with ANY external library (React, Next.js, Supabase, etc.)
(2) User asks about library APIs, patterns, or best practices
(3) Implementing features that rely on third-party packages
(4) Debugging library-specific issues
(5) Need current documentation beyond training data cutoff
Always prefer this over guessing library APIs or using outdated knowledge.
---
# Context7 Documentation Fetcher
Retrieve current library documentation via Context7 API.
## Workflow
### 1. Search for the library
```bash
python3 ~/.claude/skills/context7/scripts/context7.py search "<library-name>"
```
Example:
```bash
python3 ~/.claude/skills/context7/scripts/context7.py search "next.js"
```
Returns library metadata including the `id` field needed for step 2.
### 2. Fetch documentation context
```bash
python3 ~/.claude/skills/context7/scripts/context7.py context "<library-id>" "<query>"
```
Example:
```bash
python3 ~/.claude/skills/context7/scripts/context7.py context "/vercel/next.js" "app router middleware"
```
Options:
- `--type txt|md` - Output format (default: txt)
- `--tokens N` - Limit response tokens
## Quick Reference
| Task | Command |
|------|---------|
| Find React docs | `search "react"` |
| Get React hooks info | `context "/facebook/react" "useEffect cleanup"` |
| Find Supabase | `search "supabase"` |
| Get Supabase auth | `context "/supabase/supabase" "authentication row level security"` |
## When to Use
- Before implementing any library-dependent feature
- When unsure about current API signatures
- For library version-specific behavior
- To verify best practices and patterns
This skill fetches up-to-date library documentation from the Context7 API to provide current, authoritative information about third-party packages. It is designed to be used proactively whenever working with external libraries so answers reflect the latest APIs, patterns, and best practices rather than outdated training data. The skill is implemented as a small CLI that searches libraries and retrieves contextual documentation snippets for specific queries.
You first search for a library to obtain its Context7 identifier, then request documentation context for a precise query using that identifier. The CLI returns searchable metadata and formatted context (plain text or markdown) and supports limiting output size via token limits. Use the search step to locate the exact repo or package, then the context step to fetch targeted docs, examples, or API details.
What are the main steps to use this skill?
Search for the library to get its identifier, then request context for a specific query using that identifier. Optionally set output format and token limits.
How do I keep responses short?
Use narrow queries and the token limit option to return only the most relevant excerpt.
When should I prefer this over built-in knowledge?
Always prefer this skill for library APIs, patterns, or behaviors that may have changed since your model's training cutoff or for any version-specific questions.