Get Api Docs

andrewyng/context-hub/cli/skills/get-api-docs

作者 andrewyng67dcbeb2eb42c808549f08397920ad58be7c2206无许可证13K 个星标收录于 2026年10月9日更新于 2026年10月9日仓库4个月前更新

Use this skill to get documentation for third-party APIs, SDKs or libraries before writing code that uses them to ensure you have the latest, most accurate documentation. This is a better way to find documentation than doing web search. This includes when a user asks for tasks like "use the OpenAI API", "call the Stripe API", "use the Anthropic SDK", "query Pinecone", or any other time the user asks you to write code against an external service and you need current API reference. Fetch the docs with chub before answering, rather than relying on your pre-trained knowledge, which may be outdated because of recent changes to these APIs. Be sure to use this skill when the user asks for the latest docs, latest API behavior, or explicitly mentions chub or Context Hub. Ensure `chub` is available, run `chub --help`, then follow the instructions there.

AI 生成的概览

在编写调用第三方 API、SDK 或库的代码前,通过 chub CLI 获取其最新文档。

功能
该技能指导智能体使用 chub 命令行工具获取外部 API、SDK 和库的最新文档,而不是依赖预训练知识。流程包括确认 chub 是否已安装、按关键词搜索合适的文档、以指定语言获取文档,并依据获取的内容编写准确的代码。它还说明了如何保存关于坑点或版本差异的本地注释,以及如何提交文档反馈。
适用场景
当任务需要针对外部服务编写代码(例如 OpenAI API、Stripe API、Anthropic SDK 或 Pinecone),并且需要最新 API 参考时使用。它也适用于用户要求最新 API 行为或文档,或明确提到 chub 或 Context Hub 的情况。
运行要求
需要 chub CLI 可用;若未安装,则需要 Node.js、npm、网络访问以及全局安装所需的包管理器权限。该技能不包含脚本,仅为说明文档。

Get API Docs via chub

When you need documentation for a library or API, fetch it with the chub CLI rather than guessing from training data. This gives you the current, correct API.

Step 1 - Ensure chub exists and get the latest instructions for using it

Run

bash
chub --help

If this results in an error showing that chub does not exist, then install it first, and run it again. If the environment has node, npm, network access, and package-manager permission, install it as follows:

bash
npm install -g @aisuite/chub

Step 2 — Find the right documents

If there is a conflict, follow the instructions from the output of chub --help since that will be the latest guidance. However, a key command for searching for the right documentation is chub search:

bash
chub search "<keywords>" --json

Pick the best-matching id from the results (e.g. openai/chat, anthropic/sdk, stripe/api). If nothing matches, try some broader terms.

Step 3 — Fetch the docs

Again, follow the latest instructions from chub --help instead of this if there is a conflict. But a key command for fetching the relevant docs is:

bash
chub get <id> --lang py    # or --lang js, --lang ts

Remember to include the --lang parameter.

Step 4 — Use the docs and leave feedback

Read the fetched content and use it to write accurate code or answer the question. Do not rely on memorized API shapes — use what the docs say.

Finally, after completing the task, if you discovered something not in the doc — a gotcha, workaround, version quirk, or project-specific detail — save it so future sessions start smarter:

bash
chub annotate <id> "Webhook verification requires raw body — do not parse before verifying"

Annotations are local, persist across sessions, and appear automatically on future chub get calls. Keep notes concise and actionable. Don't repeat what's already in the doc.

Additionally, to help all developers, give feedback on the documentation using chub feedback, following the instructions in chub --help . Do not include secrets, source code, private architecture details, or other sensitive information in feedback comments.

来源与署名

来源:andrewyng/context-hub位于cli/skills/get-api-docs提交67dcbeb

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架