A multi-platform agent SKILL.md for fetching up-to-date library documentation via the Context7 API.
Works with OpenCode, Antigravity, and Gemini CLI (personal testing). It should also work with other clients that support the same standard.
-
Get an API key from context7.com/dashboard
-
Set the environment variable:
export CONTEXT7_API_KEY=your-api-key -
Install dependencies and build (this creates a self-contained skill with bundled script):
bun install bun run build
The build step compiles the TypeScript code and copies the built script into
skills/context7-skill/scripts/, creating a self-contained skill directory. -
Install the skill to your preferred platform:
Option A: Project-wide (workspace-specific)
Install in your project's workspace to share with your team (committed to version control):
# OpenCode ln -s $(pwd)/skills/context7-skill /path/to/your/project/.opencode/skills/context7-skill # Antigravity & Gemini CLI ln -s $(pwd)/skills/context7-skill /path/to/your/project/.gemini/skills/context7-skill
Option B: Global (user-wide)
Install globally to use across all your workspaces:
# OpenCode ln -s $(pwd)/skills/context7-skill ~/.config/opencode/skills/context7-skill # Antigravity & Gemini CLI ln -s $(pwd)/skills/context7-skill ~/.gemini/skills/context7-skill
Note: If a skill exists in both locations, the project-wide skill takes precedence.
After installation, the agent can run the skill script directly from the installed location.
The CLI has two primary commands: search and context.
Search for libraries by name. You can optionally provide a query to refine the search.
# Basic search (listing libraries)
node dist/index.js search react
# Search with a specific query (better for finding relevant libraries for a task)
node dist/index.js search react "hooks"Once you have a library ID (e.g., /facebook/react), fetch relevant documentation context.
# Get context for a specific topic
node dist/index.js context /facebook/react "how to use useState"To see all available commands and options:
node dist/index.js --help# Run tests
bun test
# Build for Node.js
bun run buildMIT