Get the FREE Ultimate OpenClaw Setup Guide →

context7

npx machina-cli add skill arvindand/agent-skills/context7 --openclaw
Files (1)
SKILL.md
3.2 KB

Context7 Documentation Lookup

Use scripts/context7.py to fetch current library documentation without MCP tool-schema overhead.

This is an execution skill. Decide whether to search or fetch directly, run the script, then use the returned docs to answer. Keep the main flow lean and load REFERENCES.md only when you need example commands, common library IDs, or troubleshooting details.

When to Use

Activate when the user asks for:

  • current library or framework APIs
  • official code examples or implementation patterns
  • version-specific docs or migration guidance
  • third-party tool setup that depends on vendor docs
  • documentation for libraries in npm, PyPI, or similar ecosystems

Core Workflow

  1. If you already know the library ID, skip search and call:

    python3 scripts/context7.py docs <library-id> [topic] [mode]
    
  2. If the library ID is unclear, search first:

    python3 scripts/context7.py search "<query>"
    
  3. Pick the best matching library ID, then fetch docs.

  4. Use the returned docs to answer with version-aware guidance and cite the source URL when the script provides one.

Decision Rules

  • Search only when the library ID is unclear or ambiguous.
  • Use code mode (default) for API references, function signatures, and implementation examples.
  • Use info mode for conceptual guides, architecture, and migration-heavy questions.
  • Use a focused topic first; broaden it if results are empty or off-target.
  • For version-specific docs, append the version to the library ID (for example /vercel/next.js/14) or include the version in the topic.

If syntax is unclear, run:

python3 scripts/context7.py --help

Output Rules

  • Prefer official patterns over generic recall when the docs provide a direct answer.
  • Keep the answer tied to the user's requested library and version.
  • Call out deprecations, caveats, or migration notes when the docs surface them.
  • If the docs are incomplete, say so and fall back to the best available general knowledge instead of inventing specifics.

Recovery

IssueAction
Library ID is unclearRe-run search with an alternate name, org name, or broader query.
Results are empty or irrelevantBroaden the topic, then retry with the other mode (code vs info).
User needs a specific versionAdd the version to the library ID or mention it in the topic, then verify the returned docs match.
Rate limitedTell the user about CONTEXT7_API_KEY, then use best-effort fallback guidance if needed.
Script usage is unclearRun python3 scripts/context7.py --help.
Script or network failureSay live docs lookup failed and continue with clearly-labeled fallback knowledge.

License: MIT See also: REFERENCES.md

Source

git clone https://github.com/arvindand/agent-skills/blob/main/skills/context7/SKILL.mdView on GitHub

Overview

Context7 Documentation Lookup fetches up-to-date library APIs and official code examples via a REST API. It helps you quickly access current docs for React, Next.js, Prisma, Express, Vue, Angular, Svelte, and other npm/PyPI packages, including version-aware guidance and migration notes.

How This Skill Works

Decision: search for a library ID or fetch docs directly. Run python3 scripts/context7.py docs <library-id> [topic] [mode] to get API references or python3 scripts/context7.py search <query> to locate the best match. The results are version-aware and include implementation patterns, with source URLs cited when available.

When to Use It

  • Need current library APIs or framework patterns for a library or framework (e.g., React, Next.js, Prisma, Express, Vue, Angular, Svelte).
  • Require official code examples or implementation patterns from vendor docs.
  • Need version-specific docs or migration guidance.
  • Need vendor-backed setup instructions for npm/PyPI packages.
  • Seek API details or documentation for a library when the user mentions 'how do I use X' or asks for the API for Y.

Quick Start

  1. Step 1: Decide whether to search or fetch docs using Context7.
  2. Step 2: Run python3 scripts/context7.py docs <library-id> [topic] [mode] or python3 scripts/context7.py search <query>.
  3. Step 3: Read the returned docs and apply version-aware guidance, citing the source URL if provided.

Best Practices

  • Prioritize official patterns over recall when docs exist.
  • Attach a version to the library ID for precise results.
  • Use code mode for API references and function signatures.
  • Broaden the topic or switch mode if results are empty or off-target.
  • Cite the returned source URL when the script provides one.

Example Use Cases

  • User asks for the API for React useState.
  • User requests Next.js routing or data-fetching patterns for a specific version.
  • User seeks Prisma migration notes for a major version.
  • User needs Express error-handling middleware examples.
  • User wants a Vue 3 Composition API code sample from official docs.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers