← 返回 Skills 市场
jaylane

Context7 Documentation Skill

作者 Jay Lane · GitHub ↗ · v1.0.0
cross-platform ✓ 安全检测通过
584
总下载
0
收藏
2
当前安装
1
版本数
在 OpenClaw 中安装
/install context7-docs
功能描述
Fetches up-to-date, version-specific documentation and code examples for any programming library or framework from Context7. Use this skill when the user nee...
使用说明 (SKILL.md)

Context7 Documentation Lookup

Overview

Context7 provides up-to-date, version-specific documentation and code examples for thousands of programming libraries and frameworks. Use this skill whenever you need current documentation that may differ from your training data — especially for fast-moving libraries like Next.js, React, Supabase, LangChain, etc.

When to Use This Skill

  • The user asks about a library's API and you're unsure if your knowledge is current
  • The user requests code examples for a specific library version
  • The user asks for setup, configuration, or migration guides
  • The user mentions "use context7" or asks for up-to-date docs
  • You need to verify whether an API or method still exists in the latest version

Two-Step Workflow

Step 1: Resolve the Library ID

First, find the Context7-compatible library ID for the library the user is asking about.

bash scripts/resolve-library.sh --query "How to set up authentication" --library-name "next.js"

This returns a list of matching libraries with:

  • Library ID — e.g., /vercel/next.js (use this in Step 2)
  • Name and Description
  • Code Snippets — number of available examples (prefer higher counts)
  • Benchmark Score — quality indicator out of 100 (prefer higher)
  • Source Reputation — High, Medium, Low, or Unknown (prefer High/Medium)
  • Versions — available version-specific IDs like /vercel/next.js/v14.3.0

Selection criteria — Pick the library that best matches based on:

  1. Name similarity (exact matches first)
  2. Description relevance to the user's task
  3. Higher Code Snippet count
  4. Higher Benchmark Score
  5. High or Medium Source Reputation

If the user already provides a library ID in /org/project format, skip this step.

Step 2: Query the Documentation

Use the library ID from Step 1 to fetch relevant documentation:

bash scripts/query-docs.sh --library-id "/vercel/next.js" --query "How to set up authentication with JWT"

This returns documentation text with code examples directly relevant to the query.

Shortcut: Direct curl

You can also call the API directly without the scripts:

Search for a library:

curl -s "https://context7.com/api/search" \
  -H "Content-Type: application/json" \
  ${CONTEXT7_API_KEY:+-H "Authorization: Bearer $CONTEXT7_API_KEY"} \
  -d '{"query": "How to set up auth", "libraryName": "next.js"}' | jq .

Query documentation:

curl -s "https://context7.com/api/context" \
  -H "Content-Type: application/json" \
  ${CONTEXT7_API_KEY:+-H "Authorization: Bearer $CONTEXT7_API_KEY"} \
  -d '{"query": "JWT authentication middleware", "libraryId": "/vercel/next.js"}' | jq .

Important Guidelines

  • Call resolve at most 3 times per question. If you can't find what you need, use the best result.
  • Call query-docs at most 3 times per question. Use the best information you have.
  • Be specific with queries. Good: "How to set up authentication with JWT in Express.js". Bad: "auth".
  • Use versions when relevant. If the user specifies a version, look for it in the resolve results and use the versioned library ID (e.g., /vercel/next.js/v14.3.0).
  • Do NOT include sensitive data (API keys, passwords, credentials) in your queries — they are sent to the Context7 API.

Handling Edge Cases

Situation Action
No results from resolve Try a different library name or broader search term
Multiple good matches Pick the one with the best name match + highest snippet count
User specifies a version Look for versioned IDs in resolve results
Empty docs response Try a more specific or different query
Rate limit hit Wait a moment and retry, or suggest the user set CONTEXT7_API_KEY

Environment Setup

For higher rate limits, set a free API key:

export CONTEXT7_API_KEY="your-key-here"

Get a free key at: https://context7.com/dashboard

Next Steps

安全使用建议
This skill appears coherent and limited to calling Context7's API for documentation. Before installing, confirm you trust the Context7 domain and the skill owner; avoid sending any secrets or private code in queries (the SKILL.md already warns about this). If you plan to use sensitive or proprietary code, do not include it in queries to external services. Optionally set a CONTEXT7_API_KEY for higher rate limits and review Context7's privacy policy or the upstream GitHub repo if you want additional assurance.
功能分析
Type: OpenClaw Skill Name: context7-docs Version: 1.0.0 The skill is designed to fetch documentation from `context7.com` using `curl` and `jq`. The shell scripts (`scripts/query-docs.sh`, `scripts/resolve-library.sh`) safely construct JSON payloads using `jq --arg` to prevent shell injection from user inputs. The `SKILL.md` provides clear, responsible instructions to the AI agent, including a warning against sending sensitive data to the external API. There is no evidence of malicious intent, data exfiltration, unauthorized execution, or persistence mechanisms. The `allowed-tools` permissions for `curl` and `jq` are broad but used appropriately for the stated purpose.
能力评估
Purpose & Capability
Name/description match the included scripts and API reference: the two shell scripts call https://context7.com/api/search and /context to resolve library IDs and fetch docs. Required tools (curl, jq) and the optional CONTEXT7_API_KEY are exactly what a docs-lookup integration would need.
Instruction Scope
SKILL.md and the scripts only instruct the agent to make HTTP POST requests to Context7 endpoints with user queries/library IDs. They do not read local files, other environment variables, or system configuration, and they explicitly warn not to include secrets in queries.
Install Mechanism
No install spec — instruction-only with included shell scripts. No downloads or archive extraction; nothing is written to disk beyond using the provided scripts. Risk from installation is low.
Credentials
No required environment variables; a single optional CONTEXT7_API_KEY is declared and clearly justified for rate-limiting. The skill does not request unrelated credentials or access to other config paths.
Persistence & Privilege
The skill does not request persistent/always-on privileges (always: false) and does not modify other skills or system settings. It can be invoked autonomously (platform default), which is appropriate for this kind of integration.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install context7-docs
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /context7-docs 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of context7-docs skill. - Provides up-to-date, version-specific documentation and code examples for any programming library or framework via Context7. - Supports resolving library IDs, querying documentation, and handling version-specific searches. - Includes usage guidelines, recommended workflows, and troubleshooting steps. - Requires curl, jq, and internet access; optional API key for higher rate limits. - Includes best practices for specificity and safe usage.
元数据
Slug context7-docs
版本 1.0.0
许可证
累计安装 2
当前安装数 2
历史版本数 1
常见问题

Context7 Documentation Skill 是什么?

Fetches up-to-date, version-specific documentation and code examples for any programming library or framework from Context7. Use this skill when the user nee... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 584 次。

如何安装 Context7 Documentation Skill?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install context7-docs」即可一键安装,无需额外配置。

Context7 Documentation Skill 是免费的吗?

是的,Context7 Documentation Skill 完全免费(开源免费),可自由下载、安装和使用。

Context7 Documentation Skill 支持哪些平台?

Context7 Documentation Skill 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Context7 Documentation Skill?

由 Jay Lane(@jaylane)开发并维护,当前版本 v1.0.0。

💬 留言讨论