context7-cli
它能做什么
这项技能让你的智能体使用 ctx7 命令行工具查阅最新的库文档,并将 Context7 连接到代码编辑器。适用于在终端中工作的开发者。
适用场景
- ✓当你想从命令行查阅某个库的最新文档的时候。
- ✓当你想为 Claude Code、Cursor 或 OpenCode 设置 Context7 的时候。
- ✓当你需要确认自己是否已登录 Context7 的时候。
技能链接
https://github.com/upstash/context7/blob/master/skills/context7-cli/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请为我的 Claude Code 设置 Context7,使其能读取最新的库文档。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能运行 ctx7 工具,它会先搜索某个库,然后获取与你的问题相关的文档。它还可以指导将 Context7 连接到编辑器的设置过程。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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:
npm install -g ctx7@latest
Or run directly without installing:
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
# 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
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:
export CONTEXT7_API_KEY=your_key
Common Mistakes
- Library IDs require a
/prefix —/facebook/reactnotfacebook/react - Always run
ctx7 libraryfirst —ctx7 docs react "hooks"will fail without a valid ID
常见问题
我需要安装什么吗?
这项技能使用 ctx7 工具,可以通过 npx 运行,也可以用 npm 全局安装。
我需要登录吗?
大多数命令无需登录即可使用,但设置命令需要登录。
支持哪些编辑器的设置?
这项技能提到了 Claude Code、Cursor 和 OpenCode。
详情
作者的原始描述
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.
repo: upstash/context7
热度
- GitHub 星标
- 64k
- 排名
- #3166
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …