docs-seeker

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Documentation Discovery via Scripts

基于脚本的文档发现

Overview

概述

Script-first documentation discovery using llms.txt standard.
Execute scripts to handle entire workflow - no manual URL construction needed.
以脚本优先的方式,基于llms.txt标准进行文档发现。
执行脚本即可处理整个工作流——无需手动构建URL。

Primary Workflow

核心工作流

ALWAYS execute scripts in this order:
bash
undefined
请务必按照以下顺序执行脚本:
bash
undefined

1. DETECT query type (topic-specific vs general)

1. 检测查询类型(特定主题 vs 通用)

node scripts/detect-topic.js "<user query>"
node scripts/detect-topic.js "<用户查询>"

2. FETCH documentation using script output

2. 使用脚本输出结果获取文档

node scripts/fetch-docs.js "<user query>"
node scripts/fetch-docs.js "<用户查询>"

3. ANALYZE results (if multiple URLs returned)

3. 分析结果(若返回多个URL)

cat llms.txt | node scripts/analyze-llms-txt.js -

Scripts handle URL construction, fallback chains, and error handling automatically.
cat llms.txt | node scripts/analyze-llms-txt.js -

脚本会自动处理URL构建、回退链和错误处理。

Scripts

脚本说明

detect-topic.js
- Classify query type
  • Identifies topic-specific vs general queries
  • Extracts library name + topic keyword
  • Returns JSON:
    {topic, library, isTopicSpecific}
  • Zero-token execution
fetch-docs.js
- Retrieve documentation
  • Constructs context7.com URLs automatically
  • Handles fallback: topic → general → error
  • Outputs llms.txt content or error message
  • Zero-token execution
analyze-llms-txt.js
- Process llms.txt
  • Categorizes URLs (critical/important/supplementary)
  • Recommends agent distribution (1 agent, 3 agents, 7 agents, phased)
  • Returns JSON with strategy
  • Zero-token execution
detect-topic.js
- 分类查询类型
  • 识别特定主题查询与通用查询
  • 提取库名称 + 主题关键词
  • 返回JSON格式:
    {topic, library, isTopicSpecific}
  • 零Token执行
fetch-docs.js
- 获取文档
  • 自动构建context7.com的URL
  • 处理回退逻辑:主题 → 通用 → 错误
  • 输出llms.txt内容或错误信息
  • 零Token执行
analyze-llms-txt.js
- 处理llms.txt
  • 对URL进行分类(关键/重要/补充)
  • 推荐Agent分发策略(1个Agent、3个Agent、7个Agent、分阶段)
  • 返回包含策略的JSON结果
  • 零Token执行

Workflow References

工作流参考

Topic-Specific Search - Fastest path (10-15s)
General Library Search - Comprehensive coverage (30-60s)
Repository Analysis - Fallback strategy
特定主题搜索 - 最快路径(10-15秒)
通用库搜索 - 全面覆盖(30-60秒)
仓库分析 - 回退策略

References

参考文档

context7-patterns.md - URL patterns, known repositories
errors.md - Error handling, fallback strategies
advanced.md - Edge cases, versioning, multi-language
context7-patterns.md - URL模式、已知仓库
errors.md - 错误处理、回退策略
advanced.md - 边缘情况、版本控制、多语言

Execution Principles

执行原则

  1. Scripts first - Execute scripts instead of manual URL construction
  2. Zero-token overhead - Scripts run without context loading
  3. Automatic fallback - Scripts handle topic → general → error chains
  4. Progressive disclosure - Load workflows/references only when needed
  5. Agent distribution - Scripts recommend parallel agent strategy
  1. 脚本优先 - 执行脚本而非手动构建URL
  2. 零Token开销 - 脚本运行无需加载上下文
  3. 自动回退 - 脚本处理主题→通用→错误的回退链
  4. 渐进式披露 - 仅在需要时加载工作流/参考文档
  5. Agent分发 - 脚本推荐并行Agent策略

Quick Start

快速开始

Topic query: "How do I use date picker in shadcn?"
bash
node scripts/detect-topic.js "<query>"  # → {topic, library, isTopicSpecific}
node scripts/fetch-docs.js "<query>"    # → 2-3 URLs
特定主题查询示例: "如何在shadcn中使用日期选择器?"
bash
node scripts/detect-topic.js "<查询内容>"  # → {topic, library, isTopicSpecific}
node scripts/fetch-docs.js "<查询内容>"    # → 2-3个URL

Read URLs with WebFetch

使用WebFetch读取URL内容


**General query:** "Documentation for Next.js"
```bash
node scripts/detect-topic.js "<query>"         # → {isTopicSpecific: false}
node scripts/fetch-docs.js "<query>"           # → 8+ URLs
cat llms.txt | node scripts/analyze-llms-txt.js -  # → {totalUrls, distribution}

**通用查询示例:** "Next.js的文档"
```bash
node scripts/detect-topic.js "<查询内容>"         # → {isTopicSpecific: false}
node scripts/fetch-docs.js "<查询内容>"           # → 8个以上URL
cat llms.txt | node scripts/analyze-llms-txt.js -  # → {totalUrls, distribution}

Deploy agents per recommendation

根据推荐部署Agent

undefined
undefined

Environment

环境配置

Scripts load
.env
:
process.env
>
.claude/skills/docs-seeker/.env
>
.claude/skills/.env
>
.claude/.env
See
.env.example
for configuration options.
脚本会加载
.env
文件,优先级:
process.env
>
.claude/skills/docs-seeker/.env
>
.claude/skills/.env
>
.claude/.env
配置选项可参考
.env.example