fetch-library-docs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLibrary Documentation Skill
库文档Skill
Fetches official library documentation with 60-90% token savings.
可获取官方库文档,且能节省60-90%的token。
WHEN TO INVOKE (Auto-Detection)
调用时机(自动检测)
INVOKE AUTOMATICALLY when:
| Context | Detection Signal | Content Type |
|---|---|---|
| Implementing | About to write code using library API | |
| Debugging | Error contains library name (e.g., | |
| Installing | Adding new package, | |
| Integrating | Connecting libraries ("use X with Y") | |
| Upgrading | Version migration, breaking changes | |
| Uncertain | First use of library feature, unsure of pattern | |
DO NOT INVOKE when:
- Already have sufficient knowledge from training
- User pasted docs or has them open
- Task is about local/private code (use codebase search)
- Comparing libraries (use web search)
在以下场景自动调用:
| 场景 | 检测信号 | 内容类型 |
|---|---|---|
| 功能实现 | 即将编写使用库API的代码 | |
| 调试 | 错误信息中包含库名称(如 | |
| 安装 | 添加新包、执行 | |
| 集成 | 连接多个库(如“将X与Y配合使用”) | |
| 版本升级 | 版本迁移、破坏性变更 | |
| 不确定用法 | 首次使用库的某项功能、对实现模式存疑 | |
以下场景请勿调用:
- 已从训练中掌握足够相关知识
- 用户已粘贴文档或已打开文档
- 任务针对本地/私有代码(使用代码库搜索)
- 对比不同库(使用网页搜索)
DECISION LOGIC
决策逻辑
1. Identify Library
1. 识别库
Priority: User mention → Error message → File imports → package.json → Ask userExamples:
- → library = "prisma"
PrismaClientKnownRequestError - → library = "react"
import { useState } from 'react' - → library = "fastapi"
from fastapi import FastAPI
优先级:用户提及 → 错误信息 → 文件导入 → package.json → 询问用户示例:
- → 库 = "prisma"
PrismaClientKnownRequestError - → 库 = "react"
import { useState } from 'react' - → 库 = "fastapi"
from fastapi import FastAPI
2. Identify Topic
2. 识别主题
Priority: User specifies → Error message → Feature being implemented → "getting started"优先级:用户指定 → 错误信息 → 正在实现的功能 → "入门指南"3. Select Content Type
3. 选择内容类型
| Task | Content Type |
|---|---|
| Implementing code | |
| Debugging error | |
| Installing/setup | |
| Integrating libs | |
| Upgrading version | |
| Understanding why | |
| Best practices | |
| 任务 | 内容类型 |
|---|---|
| 编写代码实现功能 | |
| 调试错误 | |
| 安装/搭建 | |
| 集成多个库 | |
| 版本升级 | |
| 理解原理 | |
| 最佳实践 | |
EXECUTION
执行方式
bash
undefinedbash
undefinedWith known library ID (faster - saves 1 API call)
使用已知的库ID(更快 - 节省1次API调用)
bash scripts/fetch-docs.sh --library-id <id> --topic "<topic>" --content-type <types>
bash scripts/fetch-docs.sh --library-id <id> --topic "<topic>" --content-type <types>
With library name (auto-resolves)
使用库名称(自动解析ID)
bash scripts/fetch-docs.sh --library <name> --topic "<topic>" --content-type <types>
undefinedbash scripts/fetch-docs.sh --library <name> --topic "<topic>" --content-type <types>
undefinedQuick Library IDs
常用库ID
| Library | ID |
|---|---|
| React | |
| Next.js | |
| Prisma | |
| Tailwind | |
| FastAPI | |
See references/library-ids.md for complete list.
| 库 | ID |
|---|---|
| React | |
| Next.js | |
| Prisma | |
| Tailwind | |
| FastAPI | |
完整列表请查看references/library-ids.md。
ERROR HANDLING (Quick Reference)
错误处理(速查)
| Error | Action |
|---|---|
| Try spelling variations |
| Use --library-id directly |
| Broaden topic or use |
| Check API key setup |
Call Budget: Context7 allows 3 calls/question. Use to save 1 call.
--library-idSee references/context7-tools.md for full error handling.
| 错误 | 操作 |
|---|---|
| 尝试拼写变体 |
| 直接使用--library-id参数 |
| 扩大主题范围或使用 |
| 检查API密钥配置 |
调用配额:Context7允许每个问题调用3次。使用可节省1次调用。
--library-id完整错误处理请查看references/context7-tools.md。
REFERENCES
参考资料
- Library IDs - Complete library ID list
- Usage Patterns - Real-world examples
- Context7 Tools - API details, error codes, setup
- 库ID列表 - 完整的库ID清单
- 使用模式 - 真实场景示例
- Context7工具 - API详情、错误码、搭建说明