context-hub

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Context Hub

上下文中心

Use
chub
as the default source of truth for third-party API/SDK behavior.
chub
作为第三方API/SDK行为的默认可信来源。

When to Use

使用场景

Trigger this skill whenever a task involves:
  • Writing or reviewing code that calls an external API or SDK (OpenAI, Stripe, Anthropic, Pinecone, Twilio, etc.)
  • Implementing webhooks, auth flows (OAuth, API keys, JWTs), or library-specific method calls
  • Debugging integration errors where the root cause may be an outdated API contract
  • Migrating to a new version of an SDK or third-party library
Even if the user does not explicitly ask for documentation — fetch first, code second.
当任务涉及以下内容时,触发此技能:
  • 编写或审查调用外部API或SDK(OpenAI、Stripe、Anthropic、Pinecone、Twilio等)的代码
  • 实现Webhook、认证流程(OAuth、API密钥、JWT)或库特定方法调用
  • 调试可能由过时API契约导致的集成错误
  • 迁移至SDK或第三方库的新版本
即使用户未明确要求文档——先获取文档,再编写代码。

Repo Sync Before Edits (mandatory)

编辑前的仓库同步(必填)

Before creating/updating/deleting files in an existing repository, sync the current branch with remote:
bash
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin
git pull --rebase origin "$branch"
If the working tree is not clean, stash first, sync, then restore:
bash
git stash push -u -m "pre-sync"
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin && git pull --rebase origin "$branch"
git stash pop
If
origin
is missing, pull is unavailable, or rebase/stash conflicts occur, stop and ask the user before continuing.
在现有仓库中创建/更新/删除文件前,将当前分支与远程同步:
bash
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin
git pull --rebase origin "$branch"
如果工作树未清理,先暂存,同步后再恢复:
bash
git stash push -u -m "pre-sync"
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin && git pull --rebase origin "$branch"
git stash pop
如果
origin
缺失、无法拉取,或出现变基/暂存冲突,请停止操作并询问用户后再继续。

1) Ensure
chub
is ready

1) 确保
chub
已就绪

Run:
bash
chub help
chub update
If
chub
is not installed and installation is allowed, run:
bash
npm install -g @aisuite/chub
If installation is blocked, tell the user and use official docs directly.
运行:
bash
chub help
chub update
如果未安装
chub
且允许安装,运行:
bash
npm install -g @aisuite/chub
如果安装被阻止,请告知用户并直接使用官方文档。

2) Identify target docs

2) 确定目标文档

Run:
bash
chub search "<library or API name>" --json
Choose the best
id
(
<author>/<name>
, for example
openai/chat
,
stripe/api
). If results are weak, retry with broader keywords.
运行:
bash
chub search "<library or API name>" --json
选择最佳的
id
(格式为
<author>/<name>
,例如
openai/chat
stripe/api
)。如果搜索结果不佳,使用更宽泛的关键词重试。

3) Fetch language-specific docs

3) 获取特定语言的文档

Run:
bash
chub get <id> --lang py
Use the project language (
py
,
js
,
ts
) when variants exist. Omit
--lang
when only one variant is available.
Prefer focused fetches when possible:
bash
chub get <id> --file <reference-file>
Use
--full
only when full package context is required.
运行:
bash
chub get <id> --lang py
当存在多种变体时,使用项目对应的语言(
py
js
ts
)。仅有一种变体时可省略
--lang
尽可能优先选择针对性的获取方式:
bash
chub get <id> --file <reference-file>
仅在需要完整包上下文时使用
--full

4) Implement from fetched docs only

4) 仅基于获取的文档实现

Write code and explanations from fetched docs. Do not guess method names, payload fields, endpoint paths, or auth headers. When uncertain, fetch again instead of inferring.
完全根据获取的文档编写代码和说明。请勿猜测方法名、负载字段、端点路径或认证头。如有疑问,再次获取文档而非自行推断。

5) Capture durable learnings

5) 留存实用经验

If you discover a real gap (gotcha, workaround, version quirk), store it:
bash
chub annotate <id> "<concise actionable note>"
Keep notes short, concrete, and non-duplicative.
如果发现实际存在的漏洞(陷阱、解决方案、版本特性),将其保存:
bash
chub annotate <id> "<concise actionable note>"
笔记需简短、具体且不重复。

6) Submit doc feedback only with user approval

6) 仅在用户批准后提交文档反馈

Ask the user before sending feedback.
bash
chub feedback <id> up
chub feedback <id> down --label outdated
Common labels:
outdated
,
inaccurate
,
incomplete
,
wrong-examples
,
wrong-version
,
poorly-structured
,
accurate
,
well-structured
,
helpful
,
good-examples
.
发送反馈前需询问用户。
bash
chub feedback <id> up
chub feedback <id> down --label outdated
常见标签:
outdated
,
inaccurate
,
incomplete
,
wrong-examples
,
wrong-version
,
poorly-structured
,
accurate
,
well-structured
,
helpful
,
good-examples
.

Quick commands

快速命令

bash
chub search "stripe"
chub get stripe/api --lang js
chub annotate stripe/api "Webhook verification requires raw body"
chub annotate --list
bash
chub search "stripe"
chub get stripe/api --lang js
chub annotate stripe/api "Webhook verification requires raw body"
chub annotate --list

Expected Output

预期输出

After a successful doc fetch, the skill provides:
  1. Confirmation of which doc ID was fetched, e.g.:
    Fetched: stripe/api (Python) — 42 KB, last updated 2025-03-14
  2. Implementation — code written strictly from the fetched docs, with no guessed fields or method names
  3. Annotation (when a new gotcha is discovered):
    Annotated stripe/api: "Webhook verification requires raw request body, not parsed JSON"
If
chub
is unavailable and installation is blocked, the skill falls back to the official docs URL and states this explicitly.
成功获取文档后,该技能将提供:
  1. 确认信息:显示获取的文档ID,例如:
    Fetched: stripe/api (Python) — 42 KB, last updated 2025-03-14
  2. 实现代码:严格根据获取的文档编写的代码,无猜测的字段或方法名
  3. 注释信息(当发现新陷阱时):
    Annotated stripe/api: "Webhook verification requires raw request body, not parsed JSON"
如果
chub
不可用且安装被阻止,该技能将回退到官方文档URL,并明确说明这一点。

Edge Cases

边缘情况

ScenarioHandling
chub
not installed, installation blocked
Inform user; fetch docs directly from the official library website via
/browse
chub search
returns no results
Retry with broader keywords; if still empty, use official docs URL directly
Fetched docs are clearly outdatedAnnotate the issue; cross-reference with official changelog before coding
Multiple language variants availableAsk the user which language to fetch if not determinable from project context
chub annotate
or
feedback
commands fail
Log the failure; continue with implementation; do not block on annotation errors
chub update
hangs or errors
Skip update, use cached docs, and note that docs may not be the latest version
场景处理方式
chub
未安装且安装被阻止
告知用户;通过
/browse
直接从官方库网站获取文档
chub search
无结果
使用更宽泛的关键词重试;若仍无结果,直接使用官方文档URL
获取的文档明显过时注释该问题;编码前交叉参考官方变更日志
存在多种语言变体若无法从项目上下文确定,询问用户获取哪种语言的文档
chub annotate
feedback
命令失败
记录失败;继续实现;不因注释错误而阻塞流程
chub update
挂起或出错
跳过更新,使用缓存文档,并注明文档可能不是最新版本

Step Completion Reports

步骤完成报告

After completing each major step, output a status report in this format:
◆ [Step Name] ([step N of M] — [context])
··································································
  [Check 1]:          √ pass
  [Check 2]:          √ pass (note if relevant)
  [Check 3]:          × fail — [reason]
  [Check 4]:          √ pass
  [Criteria]:         √ N/M met
  ____________________________
  Result:             PASS | FAIL | PARTIAL
Adapt the check names to match what the step actually validates. Use
for pass,
×
for fail, and
to add brief context. The "Criteria" line summarizes how many acceptance criteria were met. The "Result" line gives the overall verdict.
完成每个主要步骤后,按以下格式输出状态报告:
◆ [步骤名称] ([第N步/共M步] — [上下文])
··································································
  [检查项1]:          √ 通过
  [检查项2]:          √ 通过(如有相关说明可补充)
  [检查项3]:          × 未通过 — [原因]
  [检查项4]:          √ 通过
  [达标情况]:         √ 已满足N/M项标准
  ____________________________
  结果:             通过 | 未通过 | 部分通过
根据步骤实际验证的内容调整检查项名称。用
表示通过,
×
表示未通过,
后可添加简短上下文。“达标情况”行总结已满足的验收标准数量。“结果”行给出整体结论。

Skill-specific checks per phase

各阶段的技能特定检查项

Phase: Tool Readiness — checks:
chub availability
,
chub updated
Phase: Documentation Fetch — checks:
Doc identification
,
Doc fetch success
Phase: Implementation — checks:
Implementation accuracy
,
No guessed fields
Phase: Learning Capture — checks:
Annotation saved
,
Note non-duplicative
阶段:工具就绪 — 检查项:
chub可用性
chub已更新
阶段:文档获取 — 检查项:
文档识别
文档获取成功
阶段:实现 — 检查项:
实现准确性
无猜测字段
阶段:经验留存 — 检查项:
注释已保存
笔记无重复