home / skills / questnova502 / claude-skills-sync / context7

This skill retrieves up-to-date library documentation via Context7 to answer API questions, patterns, and code examples accurately.

npx playbooks add skill questnova502/claude-skills-sync --skill context7

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
2.4 KB
---
name: context7
description: "Fetch up-to-date library documentation via Context7 REST API. Use when needing current API docs, framework patterns, or code examples for any library. Lightweight alternative to Context7 MCP with no persistent context overhead. By Netresearch."
---

# Context7 Documentation Lookup Skill

Fetch current library documentation, API references, and code examples without MCP context overhead.

## When to Use This Skill

When the user asks about library APIs or framework patterns, use this skill to fetch current documentation.

When encountering import statements (`import`, `require`, `from`), use this skill to provide accurate API information.

When the user asks about specific library versions or "How do I use X library?", use this skill to get official patterns.

## Core Workflow

To answer questions about library documentation, follow these steps:

1. Search for the library ID using `scripts/context7.sh search`
2. Fetch documentation using `scripts/context7.sh docs`
3. Apply returned documentation to provide accurate, version-specific answers

## Running Scripts

### Searching for Libraries

To find a library ID for documentation lookup:

```bash
scripts/context7.sh search "library-name"
```

This returns library IDs in the format `/vendor/library` (e.g., `/facebook/react`).

### Fetching Documentation

To fetch documentation for a specific library:

```bash
scripts/context7.sh docs "<library-id>" "[topic]" "[mode]"
```

Parameters:
- `library-id` (required): From search result (e.g., `/facebook/react`)
- `topic` (optional): Focus area (e.g., `hooks`, `routing`, `authentication`)
- `mode` (optional): `code` for API references (default) or `info` for conceptual guides

### Examples

To get React hooks documentation:

```bash
scripts/context7.sh search "react"
scripts/context7.sh docs "/facebook/react" "hooks" "code"
```

To get Next.js routing guide:

```bash
scripts/context7.sh search "nextjs"
scripts/context7.sh docs "/vercel/next.js" "routing" "info"
```

## Documentation Modes

When fetching API references, examples, or code patterns, use `code` mode (default).

When fetching conceptual guides, tutorials, or explanations, use `info` mode.

## Environment Configuration

To use authenticated requests (optional), set the `CONTEXT7_API_KEY` environment variable:

```bash
export CONTEXT7_API_KEY="your-api-key"
```

---

> **Contributing:** https://github.com/netresearch/context7-skill

Overview

This skill fetches up-to-date library documentation, API references, and code examples via the Context7 REST API. It provides a lightweight, on-demand alternative to heavier documentation contexts by returning version-specific docs and patterns with minimal overhead. Use it when you need accurate, current information about a library or framework.

How this skill works

The skill searches for a library ID, then requests documentation for the chosen library and topic through Context7 endpoints. It supports two modes: 'code' for API references and examples, and 'info' for conceptual guides and tutorials. Optional API key support allows authenticated requests for protected or extended content.

When to use it

  • Answering questions about library APIs, functions, or classes that require current docs
  • Explaining framework patterns or recommended usage examples for a specific version
  • Responding to code snippets that include import/require statements and needing accurate references
  • Providing concise, version-specific code examples or migration guidance
  • Looking up specific topics like hooks, routing, authentication, or configuration

Best practices

  • Search first to obtain the canonical library ID (format: /vendor/library) before fetching docs
  • Use 'code' mode for API references and example snippets, 'info' for conceptual guides
  • Specify a topic to narrow results and avoid excessive documentation payloads
  • Pass CONTEXT7_API_KEY in the environment when accessing private or extended content
  • Prefer this skill for targeted, current documentation; combine with other tools for broader research

Example use cases

  • User asks: 'How do I use React useEffect with cleanup?': search 'react', fetch '/facebook/react' hooks in 'code' mode
  • User wants Next.js routing patterns: search 'nextjs', fetch '/vercel/next.js' routing in 'info' mode
  • Clarify API surface for a specific package version when migrating dependencies
  • Resolve questions about missing or renamed exports by pulling the latest reference
  • Provide short, copy-pasteable code examples for common library tasks

FAQ

Do I need an API key to use the skill?

No, many endpoints work without authentication, but set CONTEXT7_API_KEY for private or extended access.

What is the difference between 'code' and 'info' modes?

'Code' returns API references and example snippets; 'info' returns conceptual guides, tutorials, and higher-level explanations.