context7
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseContext7 Documentation Fetcher
Context7 文档获取工具
Retrieve current library documentation via Context7 API.
通过Context7 API获取最新的库文档。
Authentication
认证
This skill requires a Context7 API key in .
CONTEXT7_API_KEYRecommended setup options:
- Export it in your shell profile (global):
bash
export CONTEXT7_API_KEY="your-context7-key"- Use a local file (per-repo):
.env
bash
cp skills/context7/.env.example .env
set -a; source .env; set +a此技能需要在中配置Context7 API密钥。
CONTEXT7_API_KEY推荐的设置选项:
- 在shell配置文件中全局导出:
bash
export CONTEXT7_API_KEY="your-context7-key"- 使用本地文件(按仓库配置):
.env
bash
cp skills/context7/.env.example .env
set -a; source .env; set +aWorkflow
工作流程
1. Search for the library
1. 搜索库
bash
python3 ~/.codex/skills/context7/scripts/context7.py search "<library-name>"Example:
bash
python3 ~/.codex/skills/context7/scripts/context7.py search "next.js"Returns library metadata including the field needed for step 2.
idbash
python3 ~/.codex/skills/context7/scripts/context7.py search "<library-name>"示例:
bash
python3 ~/.codex/skills/context7/scripts/context7.py search "next.js"返回库的元数据,包括步骤2所需的字段。
id2. Fetch documentation context
2. 获取文档上下文
bash
python3 ~/.codex/skills/context7/scripts/context7.py context "<library-id>" "<query>"Example:
bash
python3 ~/.codex/skills/context7/scripts/context7.py context "/vercel/next.js" "app router middleware"Options:
- - Output format (default: txt)
--type txt|md - - Limit response tokens
--tokens N
bash
python3 ~/.codex/skills/context7/scripts/context7.py context "<library-id>" "<query>"示例:
bash
python3 ~/.codex/skills/context7/scripts/context7.py context "/vercel/next.js" "app router middleware"选项:
- - 输出格式(默认:txt)
--type txt|md - - 限制响应的token数量
--tokens N
Quick Reference
快速参考
| Task | Command |
|---|---|
| Find React docs | |
| Get React hooks info | |
| Find Supabase | |
| Get Supabase auth | |
| 任务 | 命令 |
|---|---|
| 查找React文档 | |
| 获取React Hooks信息 | |
| 查找Supabase | |
| 获取Supabase认证信息 | |
When to Use
使用场景
- Before implementing any library-dependent feature
- When unsure about current API signatures
- For library version-specific behavior
- To verify best practices and patterns
- 在实现任何依赖库的功能之前
- 不确定当前API签名时
- 需要了解库特定版本的行为时
- 验证最佳实践和模式时