context-hub
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseContext Hub
上下文中心
Use as the default source of truth for third-party API/SDK behavior.
chub将作为第三方API/SDK行为的默认可信来源。
chubWhen 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 popIf is missing, pull is unavailable, or rebase/stash conflicts occur, stop and ask the user before continuing.
origin在现有仓库中创建/更新/删除文件前,将当前分支与远程同步:
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如果缺失、无法拉取,或出现变基/暂存冲突,请停止操作并询问用户后再继续。
origin1) Ensure chub
is ready
chub1) 确保chub
已就绪
chubRun:
bash
chub help
chub updateIf is not installed and installation is allowed, run:
chubbash
npm install -g @aisuite/chubIf installation is blocked, tell the user and use official docs directly.
运行:
bash
chub help
chub update如果未安装且允许安装,运行:
chubbash
npm install -g @aisuite/chub如果安装被阻止,请告知用户并直接使用官方文档。
2) Identify target docs
2) 确定目标文档
Run:
bash
chub search "<library or API name>" --jsonChoose the best (, for example , ).
If results are weak, retry with broader keywords.
id<author>/<name>openai/chatstripe/api运行:
bash
chub search "<library or API name>" --json选择最佳的(格式为,例如、)。如果搜索结果不佳,使用更宽泛的关键词重试。
id<author>/<name>openai/chatstripe/api3) Fetch language-specific docs
3) 获取特定语言的文档
Run:
bash
chub get <id> --lang pyUse the project language (, , ) when variants exist.
Omit when only one variant is available.
pyjsts--langPrefer focused fetches when possible:
bash
chub get <id> --file <reference-file>Use only when full package context is required.
--full运行:
bash
chub get <id> --lang py当存在多种变体时,使用项目对应的语言(、、)。仅有一种变体时可省略。
pyjsts--lang尽可能优先选择针对性的获取方式:
bash
chub get <id> --file <reference-file>仅在需要完整包上下文时使用。
--full4) 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 outdatedCommon labels:
, , , , , , , , , .
outdatedinaccurateincompletewrong-exampleswrong-versionpoorly-structuredaccuratewell-structuredhelpfulgood-examples发送反馈前需询问用户。
bash
chub feedback <id> up
chub feedback <id> down --label outdated常见标签:
, , , , , , , , , .
outdatedinaccurateincompletewrong-exampleswrong-versionpoorly-structuredaccuratewell-structuredhelpfulgood-examplesQuick commands
快速命令
bash
chub search "stripe"
chub get stripe/api --lang js
chub annotate stripe/api "Webhook verification requires raw body"
chub annotate --listbash
chub search "stripe"
chub get stripe/api --lang js
chub annotate stripe/api "Webhook verification requires raw body"
chub annotate --listExpected Output
预期输出
After a successful doc fetch, the skill provides:
- Confirmation of which doc ID was fetched, e.g.:
Fetched: stripe/api (Python) — 42 KB, last updated 2025-03-14 - Implementation — code written strictly from the fetched docs, with no guessed fields or method names
- Annotation (when a new gotcha is discovered):
Annotated stripe/api: "Webhook verification requires raw request body, not parsed JSON"
If is unavailable and installation is blocked, the skill falls back to the official docs URL and states this explicitly.
chub成功获取文档后,该技能将提供:
- 确认信息:显示获取的文档ID,例如:
Fetched: stripe/api (Python) — 42 KB, last updated 2025-03-14 - 实现代码:严格根据获取的文档编写的代码,无猜测的字段或方法名
- 注释信息(当发现新陷阱时):
Annotated stripe/api: "Webhook verification requires raw request body, not parsed JSON"
如果不可用且安装被阻止,该技能将回退到官方文档URL,并明确说明这一点。
chubEdge Cases
边缘情况
| Scenario | Handling |
|---|---|
| Inform user; fetch docs directly from the official library website via |
| Retry with broader keywords; if still empty, use official docs URL directly |
| Fetched docs are clearly outdated | Annotate the issue; cross-reference with official changelog before coding |
| Multiple language variants available | Ask the user which language to fetch if not determinable from project context |
| Log the failure; continue with implementation; do not block on annotation errors |
| Skip update, use cached docs, and note that docs may not be the latest version |
| 场景 | 处理方式 |
|---|---|
| 告知用户;通过 |
| 使用更宽泛的关键词重试;若仍无结果,直接使用官方文档URL |
| 获取的文档明显过时 | 注释该问题;编码前交叉参考官方变更日志 |
| 存在多种语言变体 | 若无法从项目上下文确定,询问用户获取哪种语言的文档 |
| 记录失败;继续实现;不因注释错误而阻塞流程 |
| 跳过更新,使用缓存文档,并注明文档可能不是最新版本 |
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 | PARTIALAdapt 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 availabilitychub updatedPhase: Documentation Fetch — checks: ,
Doc identificationDoc fetch successPhase: Implementation — checks: ,
Implementation accuracyNo guessed fieldsPhase: Learning Capture — checks: ,
Annotation savedNote non-duplicative阶段:工具就绪 — 检查项:、
chub可用性chub已更新阶段:文档获取 — 检查项:、
文档识别文档获取成功阶段:实现 — 检查项:、
实现准确性无猜测字段阶段:经验留存 — 检查项:、
注释已保存笔记无重复