重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
context7 by trancong12102/agentskills
npx skills add https://github.com/trancong12102/agentskills --skill context7通过查询 Context7 API 检索软件库的当前文档。这在你不确定某个 API 的当前接口时特别有用——库文档经常更新,而你的训练数据可能已经过时。
需要设置 CONTEXT7_API_KEY 环境变量。
useEffect 的清理工作是如何进行的?”)请勿阅读脚本源代码。 直接运行脚本并使用 --help 查看用法。
python3 scripts/context7.py search <library> <topic>
返回包含前 5 个匹配项的 TSV:id、title、。使用最佳匹配行的 进行获取步骤。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
snippetsidpython3 scripts/context7.py fetch <library_id> <topic> [--max-tokens N]
获取与主题相关的文档片段,截断至指定的令牌预算(默认:5000)。
选择 --max-tokens:
| 场景 | 令牌数 | 原因 |
|---|---|---|
| 快速查找(单个函数签名) | 2000 | 保持输出聚焦,响应更快 |
| 典型用法(API 模式、示例) | 5000(默认) | 深度与简洁性的良好平衡 |
| 广泛探索(迁移指南、完整 API 概览) | 8000–10000 | 当主题涉及多个部分时需要 |
运行 python3 scripts/context7.py --help 查看完整用法。
# 查找 React 库 ID,然后获取 useState 文档
python3 scripts/context7.py search react "useState hook"
python3 scripts/context7.py fetch /websites/react_dev "useState hook with objects"
# 快速查找使用较小的预算
python3 scripts/context7.py fetch /vercel/next.js "middleware redirect" --max-tokens 2000
# 更广泛的探索
python3 scripts/context7.py fetch /langchain-ai/langchainjs "retrieval chain setup" --max-tokens 8000
"useState hook with objects" 比 "hooks" 能获得更好的结果,因为 API 会根据片段与查询的相关性进行排序。/websites/react_dev),因此需要通过搜索步骤来找到正确的 ID。--max-tokens — 使用上表。超出会浪费上下文窗口;不足可能会遗漏答案。每周安装次数
69
代码仓库
GitHub 星标数
3
首次出现
2026年2月4日
安全审计
安装于
claude-code64
amp31
gemini-cli30
github-copilot30
codex30
cline30
Retrieve current documentation for software libraries by querying the Context7 API. This is especially useful when you're unsure about an API's current interface — library docs change frequently and your training data may be outdated.
Requires CONTEXT7_API_KEY environment variable.
useEffect cleanup work?")DO NOT read script source code. Run scripts directly and use --help for usage.
python3 scripts/context7.py search <library> <topic>
Returns TSV with top 5 matches: id, title, snippets. Use the id from the best-matching row for the fetch step.
python3 scripts/context7.py fetch <library_id> <topic> [--max-tokens N]
Fetches documentation snippets relevant to the topic, truncated to a token budget (default: 5000).
Choosing--max-tokens:
| Scenario | Tokens | Why |
|---|---|---|
| Quick lookup (one function signature) | 2000 | Keeps output focused, faster response |
| Typical usage (API patterns, examples) | 5000 (default) | Good balance of depth and brevity |
| Broad exploration (migration guide, full API surface) | 8000–10000 | Needed when topic spans multiple sections |
Run python3 scripts/context7.py --help for full usage.
# Find React library ID, then fetch useState docs
python3 scripts/context7.py search react "useState hook"
python3 scripts/context7.py fetch /websites/react_dev "useState hook with objects"
# Smaller budget for a quick lookup
python3 scripts/context7.py fetch /vercel/next.js "middleware redirect" --max-tokens 2000
# Broader exploration
python3 scripts/context7.py fetch /langchain-ai/langchainjs "retrieval chain setup" --max-tokens 8000
"useState hook with objects" retrieves much better results than "hooks", because the API ranks snippets by relevance to your query./websites/react_dev), so you need the search step to find the right one.--max-tokens to the task — Use the table above. Overshooting wastes context window; undershooting may miss the answer.Weekly Installs
69
Repository
GitHub Stars
3
First Seen
Feb 4, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
claude-code64
amp31
gemini-cli30
github-copilot30
codex30
cline30
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
166,500 周安装