edxeth

context7

0
0
# Install this skill:
npx skills add edxeth/superlight-context7-skill

Or install specific skill: npx add-skill https://github.com/edxeth/superlight-context7-skill

# Description

Fetches up-to-date third-party library documentation via the Context7 v2 REST API. Use when working with external packages and needing current API references, code examples, migration guides, or resolving package errors (stack traces, version mismatches, deprecated methods).

# SKILL.md


name: context7
description: Fetches up-to-date third-party library documentation via the Context7 v2 REST API. Use when working with external packages and needing current API references, code examples, migration guides, or resolving package errors (stack traces, version mismatches, deprecated methods).


Context7 Documentation Lookup

Retrieves current, version-specific documentation for third-party libraries directly from official sources.

When to Use

ALWAYS invoke before writing code for external libraries when:
- Implementing unfamiliar library APIs
- Debugging errors from external packages (stack traces, "method not found")
- Checking version-specific syntax or breaking changes
- Verifying deprecated/removed APIs
- Encountering unfamiliar import/require statements

Protocol

Step 1: Search for Library ID

scripts/context7.sh search "<library>" "<intent>"

Example:

scripts/context7.sh search "tanstack-query" "optimistic updates"

Output: Library IDs like /tanstack/query, /vercel/next.js

Disambiguation: If multiple similar results appear, ask user which library they meant.

Step 2: Fetch Documentation

scripts/context7.sh docs "<library-id>" "<specific-question>"

Examples:

scripts/context7.sh docs "/vercel/next.js" "middleware redirect authentication"
scripts/context7.sh docs "/tanstack/query" "useMutation optimistic update pattern v5"

Step 3: Apply Context

Uses returned documentation to generate accurate, version-correct code.

Critical Rules

  1. Specific queries win - "useState hook array destructuring" beats "react hooks"
  2. Include version - Append version to query if user mentions one
  3. No guessing - If search returns nothing, ask user before proceeding
  4. Only run context7.sh - Do not run other bash commands with this skill

Resources

See reference/troubleshooting.md for error handling, configuration, and common issues.

# README.md

Superlight Context7 Skill

Fetch real-time library documentation via the Context7 v2 REST API. A superlight agent skill for AI coding assistants — minimal tokens, maximum docs. Supports multiple API keys with round-robin rotation for higher rate limits.

Features

  • Real-time docs — Fetches current documentation from Context7's indexed library database
  • Version-aware — Query specific versions or get latest API references
  • Token-efficient — Minimal context overhead with progressive disclosure
  • Agent-agnostic — Works with Claude Code, Cursor, and other skill-compatible agents
  • No MCP required — Direct REST API integration via bash script
  • Multi-key rotation — Distribute requests across multiple API keys with automatic 429 failover

Why Use This Over Context7 MCP?

Aspect MCP Server This Skill
Context cost ~1,700 tokens always¹ ~63 tokens always + ~424 on-demand
Tool schemas Always in context None (progressive disclosure)
Setup Requires MCP configuration Drop-in skill directory
Dependencies Node.js runtime bash, curl, jq (Linux/macOS)

¹ Measured Nov 2025 via /context command. Source

Best for: Users who need library docs on-demand without persistent context overhead.

Token Budget

Uses Claude's progressive disclosure architecture:

Level When Loaded Content Tokens
Metadata Always (startup) Skill description ~63
Instructions When triggered SKILL.md protocol ~424
Resources As needed troubleshooting.md ~521

Token counts measured with claudetokenizer.com (Claude Sonnet 4.5)

Installation

npx skills add edxeth/superlight-context7-skill

The installer will prompt you to select which agents to install to (Claude Code, Cursor, OpenCode, Codex, Antigravity, etc.).

Manual Installation

Clone directly to your agent's skills directory:

# Claude Code
git clone https://github.com/edxeth/superlight-context7-skill.git ~/.claude/skills/context7

# OpenCode
git clone https://github.com/edxeth/superlight-context7-skill.git ~/.opencode/skill/context7

Directory structure:

context7/
├── SKILL.md
├── reference/
│   └── troubleshooting.md
└── scripts/
    └── context7.sh

Usage

The skill triggers automatically when working with external packages:

"How do I use React Query's optimistic updates?"
"Debug this Next.js middleware error"
"What's the Prisma syntax for nested filters?"
"Check if this API is deprecated in v5"

Manual Invocation

# Search for a library
./scripts/context7.sh search "tanstack-query" "mutations"

# Fetch documentation
./scripts/context7.sh docs "/tanstack/query" "useMutation optimistic update"

API Endpoints

Uses Context7 v2 REST API:

Endpoint Purpose
GET /api/v2/libs/search Find library IDs by name
GET /api/v2/context Fetch documentation context

Configuration

An API key is optional but recommended for higher rate limits.

# Single API key
export CONTEXT7_API_KEY="ctx7sk_..."

# Multiple API keys for load distribution
export CONTEXT7_API_KEY="ctx7sk_key1,ctx7sk_key2,ctx7sk_key3"

When multiple keys are provided (comma-separated), the script rotates through them in round-robin order, ensuring even distribution of requests. If a key hits rate limits (429), the script automatically fails over to the next key and retries, only failing after all keys are exhausted across multiple retry rounds.

Get an API key at context7.com/dashboard.

Requirements

  • Platforms: Linux, macOS
  • Dependencies: bash, curl, jq

Skill Metadata

name: context7
description: Fetches up-to-date third-party library documentation via the Context7 v2 REST API. Use when working with external packages and needing current API references, code examples, migration guides, or resolving package errors (stack traces, version mismatches, deprecated methods).
allowed-tools: [bash]
user-invocable: true

License

MIT License — See LICENSE for details.

Credits

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.