返回 Skill 列表
extension
分类: 开发与工程无需 API Key

fetch-library-docs

通过内容类型过滤,以60-90%的标记节省来获取外部库和框架(如React、Next.js、Prisma、FastAPI、Express、Tailwind、MongoDB等)的官方文档。在使用库API实现功能、调试特定于库的错误、解决配置问题、安装或设置框架、集成第三方包、升级库版本或查找正确的API模式和最佳实践时,请使用此技能。在编码工作期间自动触发——在编写库代码之前获取文档以获得正确的模式,而不是在猜测错误之后。

person作者: jakexiaohubgithub

Library Documentation Skill

Fetches official library documentation with 60-90% token savings.


WHEN TO INVOKE (Auto-Detection)

INVOKE AUTOMATICALLY when:

| Context | Detection Signal | Content Type | |---------|------------------|--------------| | Implementing | About to write code using library API | examples,api-ref | | Debugging | Error contains library name (e.g., PrismaClientError) | troubleshooting | | Installing | Adding new package, npm install, setup task | setup | | Integrating | Connecting libraries ("use X with Y") | examples,setup | | Upgrading | Version migration, breaking changes | migration | | Uncertain | First use of library feature, unsure of pattern | examples |

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)

DECISION LOGIC

1. Identify Library

Priority: User mention → Error message → File imports → package.json → Ask user

Examples:

  • PrismaClientKnownRequestError → library = "prisma"
  • import { useState } from 'react' → library = "react"
  • from fastapi import FastAPI → library = "fastapi"

2. Identify Topic

Priority: User specifies → Error message → Feature being implemented → "getting started"

3. Select Content Type

| Task | Content Type | |------|--------------| | Implementing code | examples,api-ref | | Debugging error | troubleshooting,examples | | Installing/setup | setup | | Integrating libs | examples,setup | | Upgrading version | migration | | Understanding why | concepts | | Best practices | patterns |


EXECUTION

# With known library ID (faster - saves 1 API call)
bash scripts/fetch-docs.sh --library-id <id> --topic "<topic>" --content-type <types>

# With library name (auto-resolves)
bash scripts/fetch-docs.sh --library <name> --topic "<topic>" --content-type <types>

Quick Library IDs

| Library | ID | |---------|----| | React | /reactjs/react.dev | | Next.js | /vercel/next.js | | Prisma | /prisma/docs | | Tailwind | /tailwindlabs/tailwindcss.com | | FastAPI | /tiangolo/fastapi |

See references/library-ids.md for complete list.


ERROR HANDLING (Quick Reference)

| Error | Action | |-------|--------| | [LIBRARY_NOT_FOUND] | Try spelling variations | | [LIBRARY_MISMATCH] | Use --library-id directly | | [EMPTY_RESULTS] | Broaden topic or use --content-type all | | [RATE_LIMIT_ERROR] | Check API key setup |

Call Budget: Context7 allows 3 calls/question. Use --library-id to save 1 call.

See references/context7-tools.md for full error handling.


REFERENCES