context7

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Context7

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
get-library-docs
unless user provides library ID in format
/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"
在使用
get-library-docs
前必须执行此命令
,除非用户提供
/org/project
格式的库ID。

get-library-docs

get-library-docs

Fetch documentation for a library.
bash
undefined
获取库的文档。
bash
undefined

Basic usage

基础用法

bun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts get-library-docs
--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"

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"
bun /home/hazeruno/.config/opencode/skills/context7/scripts/context7.ts get-library-docs
--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"

**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 insufficient
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`:库ID(例如:`/mongodb/docs`, `/vercel/next.js`)
- `--mode`:`code`(默认)用于API/示例,`info`用于概念指南
- `--topic`:聚焦特定主题(例如:`hooks`, `routing`, `authentication`)
- `--page`:分页(1-10),如果内容不足可使用更高页码

Global Options

全局选项

  • -t, --timeout <ms>
    : Call timeout (default: 30000)
  • -o, --output <format>
    : Output format:
    text
    |
    markdown
    |
    json
    |
    raw
  • -t, --timeout <ms>
    :调用超时时间(默认:30000)
  • -o, --output <format>
    :输出格式:
    text
    |
    markdown
    |
    json
    |
    raw

Common Library IDs

常用库ID

LibraryID
React
/facebook/react
Next.js
/vercel/next.js
MongoDB
/mongodb/docs
Supabase
/supabase/supabase
Prisma
/prisma/prisma
ID
React
/facebook/react
Next.js
/vercel/next.js
MongoDB
/mongodb/docs
Supabase
/supabase/supabase
Prisma
/prisma/prisma

Requirements

要求

  • Bun runtime
  • mcporter
    package (embedded in script)
  • Bun 运行时
  • mcporter
    包(已嵌入脚本中)