Skip to main content

Use the ctx7 CLI to fetch library documentation and configure Context7 MCP. Activate when the user mentions "ctx7" or "context7", needs current docs for any library, or needs to set up Context7 for their AI coding agent.

  • New
  • v1.0.3
  • Reviewed Jul 21
  • No reviews yet

Getting started

Full instructions

Example command

npm install -g ctx7@latest

Instructions: SKILL.mdv1.0.3

ctx7 CLI

The Context7 CLI does two things: fetches up-to-date library documentation and sets up Context7 MCP for your editor.

Make sure the CLI is up to date before running commands:

bash
npm install -g ctx7@latest

Or run directly without installing:

bash
npx ctx7@latest <command>

What this skill covers

  • Documentation — Fetch current docs for any library. Use when writing code, verifying API signatures, or when training data may be outdated.
  • Setup — Configure Context7 MCP for Claude Code / Cursor / OpenCode.

Quick Reference

bash
# Documentation
ctx7 search <query>                   # Search all libraries in one step
ctx7 library <name> <query>           # Step 1: resolve library ID
ctx7 docs <libraryId> <query>         # Step 2: fetch docs

# Setup
ctx7 setup                            # Configure Context7 MCP (interactive)
ctx7 login                            # Log in for higher rate limits
ctx7 whoami                           # Check current login status

Authentication

bash
ctx7 login               # Opens browser for OAuth
ctx7 login --no-browser  # Prints URL instead of opening browser
ctx7 logout              # Clear stored tokens
ctx7 whoami              # Show current login status (name + email)

Most commands work without login. Exception: ctx7 setup requires it unless --api-key or --oauth is passed. Login also unlocks higher rate limits on docs commands.

Set an API key via environment variable to skip interactive login entirely:

bash
export CONTEXT7_API_KEY=your_key

Common Mistakes

  • Library IDs require a / prefix — /reactjs/react.dev not reactjs/react.dev
  • Always run ctx7 library first — ctx7 docs react "hooks" will fail without a valid ID

Explore more skills

Browse all
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

More from Context7 (Upstash)

View source →

Frequently asked questions about context7-cli

What does the context7-cli skill do?

Use the ctx7 CLI to fetch library documentation and configure Context7 MCP. Activate when the user mentions "ctx7" or "context7", needs current docs for any library, or needs to set up Context7 for their AI coding agent. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the context7-cli skill?

Run `npx @skills-hub-ai/cli install context7-cli` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/context7-cli/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does context7-cli work with?

context7-cli runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the context7-cli skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use context7-cli after installing it?

In Claude Code, type `/context7-cli` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the context7-cli skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.

Badge for your README

Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.

Install on Skills Hub badge preview
Markdown
[![Install on Skills Hub](https://skills-hub.ai/api/badges/skill/context7-cli)](https://skills-hub.ai/skills/context7-cli)
HTML
<a href="https://skills-hub.ai/skills/context7-cli"><img src="https://skills-hub.ai/api/badges/skill/context7-cli" alt="Install on Skills Hub"></a>

More options in the badge docs.