context7
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseContext7
Context7
Base directory for this skill: /home/hazeruno/.config/opencode/skills/context7
Retrieve up-to-date documentation and code examples for any library via the Context7 MCP service.
本Skill的基础目录:/home/hazeruno/.config/opencode/skills/context7
通过Context7 MCP服务获取任意库的最新文档及代码示例。
Quick Start
快速开始
Run the CLI script with bun (use absolute path):
bash
bun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts <command> [options]使用bun运行CLI脚本(使用绝对路径):
bash
bun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts <command> [options]Available Commands
可用命令
resolve-library-id
resolve-library-id
Resolve a package/product name to a Context7-compatible library ID.
bash
bun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts resolve-library-id --library-name "react"
bun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts resolve-library-id --library-name "next.js"Required before unless user provides library ID in format .
get-library-docs/org/project将包/产品名称解析为Context7兼容的库ID。
bash
bun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts resolve-library-id --library-name "react"
bun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts resolve-library-id --library-name "next.js"在使用前必须执行此命令,除非用户提供格式的库ID。
get-library-docs/org/projectget-library-docs
get-library-docs
Fetch documentation for a library.
bash
undefined获取库的文档。
bash
undefinedBasic usage
基础用法
bun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts get-library-docs
--context7-compatible-library-i-d "/vercel/next.js"
--context7-compatible-library-i-d "/vercel/next.js"
bun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts get-library-docs
--context7-compatible-library-i-d "/vercel/next.js"
--context7-compatible-library-i-d "/vercel/next.js"
With topic focus
聚焦特定主题
bun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts get-library-docs
--context7-compatible-library-i-d "/vercel/next.js" --topic "routing"
--context7-compatible-library-i-d "/vercel/next.js" --topic "routing"
bun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts get-library-docs
--context7-compatible-library-i-d "/vercel/next.js" --topic "routing"
--context7-compatible-library-i-d "/vercel/next.js" --topic "routing"
Different modes: code (API refs) or info (conceptual guides)
不同模式:code(API参考)或info(概念指南)
bun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts get-library-docs
--context7-compatible-library-i-d "/mongodb/docs" --mode "info"
--context7-compatible-library-i-d "/mongodb/docs" --mode "info"
**Parameters:**
- `--context7-compatible-library-i-d`: Library ID (e.g., `/mongodb/docs`, `/vercel/next.js`)
- `--mode`: `code` (default) for API/examples, `info` for conceptual guides
- `--topic`: Focus on specific topic (e.g., `hooks`, `routing`, `authentication`)
- `--page`: Pagination (1-10), use higher pages if context insufficientbun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts get-library-docs
--context7-compatible-library-i-d "/mongodb/docs" --mode "info"
--context7-compatible-library-i-d "/mongodb/docs" --mode "info"
**参数:**
- `--context7-compatible-library-i-d`:库ID(例如:`/mongodb/docs`, `/vercel/next.js`)
- `--mode`:`code`(默认)用于API/示例,`info`用于概念指南
- `--topic`:聚焦特定主题(例如:`hooks`, `routing`, `authentication`)
- `--page`:分页(1-10),如果内容不足可使用更高页码Global Options
全局选项
- : Call timeout (default: 30000)
-t, --timeout <ms> - : Output format:
-o, --output <format>|text|markdown|jsonraw
- :调用超时时间(默认:30000)
-t, --timeout <ms> - :输出格式:
-o, --output <format>|text|markdown|jsonraw
Common Library IDs
常用库ID
| Library | ID |
|---|---|
| React | |
| Next.js | |
| MongoDB | |
| Supabase | |
| Prisma | |
| 库 | ID |
|---|---|
| React | |
| Next.js | |
| MongoDB | |
| Supabase | |
| Prisma | |