librarian

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Librarian Skill

Librarian Skill

Deep codebase exploration across remote repositories.
跨远程代码仓库的深度代码库探索工具。

How to Use This Skill

如何使用该Skill

Reference Structure

参考文档结构

FilePurposeWhen to Read
tool-routing.md
Tool selection decision treesAlways read first
opensrc-api.md
API reference, typesWriting opensrc code
opensrc-examples.md
JavaScript patterns, workflowsImplementation examples
linking.md
GitHub URL patternsFormatting responses
diagrams.md
Mermaid patternsVisualizing architecture
文件用途阅读时机
tool-routing.md
工具选择决策树务必首先阅读
opensrc-api.md
API参考文档、类型定义编写opensrc相关代码时
opensrc-examples.md
JavaScript代码模式、工作流实现示例参考
linking.md
GitHub URL格式规范格式化响应内容时
diagrams.md
Mermaid图表语法可视化架构设计时

Reading Order

阅读顺序

  1. Start with
    tool-routing.md
    → choose tool strategy
  2. If using opensrc:
    • Read
      opensrc-api.md
      for API details
    • Read
      opensrc-examples.md
      for patterns
  3. Before responding:
    linking.md
    +
    diagrams.md
    for output formatting
  1. 第一步 阅读
    tool-routing.md
    → 确定工具使用策略
  2. 若使用opensrc工具:
    • 阅读
      opensrc-api.md
      了解API细节
    • 阅读
      opensrc-examples.md
      参考代码模式
  3. 生成响应前: 参考
    linking.md
    +
    diagrams.md
    进行输出格式化

Tool Arsenal

工具库

ToolBest ForLimitations
grep_appFind patterns across ALL public GitHubLiteral search only
context7Library docs, API examples, usageKnown libraries only
opensrcFetch full source for deep explorationMust fetch before read
工具最佳适用场景局限性
grep_app在所有公开GitHub仓库中查找代码模式仅支持字面量搜索
context7类库文档、API示例、使用方法查询仅支持已知类库
opensrc获取完整源码进行深度探索必须先获取源码才能阅读

Quick Decision Trees

快速决策树

"How does X work?"

"X的工作原理是什么?"

Known library?
├─ Yes → context7.resolve-library-id → context7.query-docs
│        └─ Need internals? → opensrc.fetch → read source
└─ No  → grep_app search → opensrc.fetch top result
已知该类库?
├─ 是 → context7.resolve-library-id → context7.query-docs
│        └─ 需要了解内部实现? → opensrc.fetch → 阅读源码
└─ 否  → grep_app搜索 → opensrc.fetch搜索结果中的Top项目

"Find pattern X"

"查找代码模式X"

Specific repo?
├─ Yes → opensrc.fetch → opensrc.grep → read matches
└─ No  → grep_app (broad) → opensrc.fetch interesting repos
指定了具体仓库?
├─ 是 → opensrc.fetch → opensrc.grep → 阅读匹配结果
└─ 否  → grep_app(大范围搜索) → opensrc.fetch感兴趣的仓库

"Explore repo structure"

"探索仓库结构"

1. opensrc.fetch(target)
2. opensrc.tree(source.name) → quick overview
3. opensrc.files(source.name, "**/*.ts") → detailed listing
4. Read: README, package.json, src/index.*
5. Create architecture diagram (see diagrams.md)
1. opensrc.fetch(target)
2. opensrc.tree(source.name) → 快速概览
3. opensrc.files(source.name, "**/*.ts") → 详细文件列表
4. 阅读:README、package.json、src/index.*
5. 创建架构图(参考diagrams.md)

"Compare X vs Y"

"对比X和Y"

1. opensrc.fetch(["X", "Y"])
2. Use source.name from results for subsequent calls
3. opensrc.grep(pattern, { sources: [nameX, nameY] })
4. Read comparable files, synthesize differences
1. opensrc.fetch(["X", "Y"])
2. 使用返回结果中的source.name进行后续调用
3. opensrc.grep(pattern, { sources: [nameX, nameY] })
4. 阅读可对比文件,归纳差异

Critical: Source Naming Convention

重要:源码命名规范

After fetching, always use
source.name
for subsequent calls:
javascript
const [{ source }] = await opensrc.fetch("vercel/ai");
const files = await opensrc.files(source.name, "**/*.ts");
TypeFetch SpecSource Name
npm
"zod"
"zod"
npm scoped
"@tanstack/react-query"
"@tanstack/react-query"
pypi
"pypi:requests"
"requests"
crates
"crates:serde"
"serde"
GitHub
"vercel/ai"
"github.com/vercel/ai"
GitLab
"gitlab:org/repo"
"gitlab.com/org/repo"
获取源码后,后续调用必须使用
source.name
javascript
const [{ source }] = await opensrc.fetch("vercel/ai");
const files = await opensrc.files(source.name, "**/*.ts");
类型获取标识源码名称
npm
"zod"
"zod"
npm 作用域包
"@tanstack/react-query"
"@tanstack/react-query"
pypi
"pypi:requests"
"requests"
crates
"crates:serde"
"serde"
GitHub
"vercel/ai"
"github.com/vercel/ai"
GitLab
"gitlab:org/repo"
"gitlab.com/org/repo"

When NOT to Use opensrc

不建议使用opensrc的场景

ScenarioUse Instead
Simple library API questionscontext7
Finding examples across many reposgrep_app
Very large monorepos (>10GB)Clone locally
Private repositoriesDirect access
场景替代方案
简单的类库API问题context7
在大量仓库中查找示例grep_app
超大型单体仓库(>10GB)本地克隆
私有仓库直接访问

Output Guidelines

输出规范

  1. Comprehensive final message - only last message returns to main agent
  2. Parallel tool calls - maximize efficiency
  3. Link every file reference - see
    linking.md
  4. Diagram complex relationships - see
    diagrams.md
  5. Never mention tool names - say "I'll search" not "I'll use opensrc"
  1. 最终消息需全面 - 仅最后一条消息返回给主Agent
  2. 并行调用工具 - 最大化效率
  3. 所有文件引用需添加链接 - 参考
    linking.md
  4. 复杂关系需生成图表 - 参考
    diagrams.md
  5. 切勿提及工具名称 - 说“我将进行搜索”而非“我将使用opensrc”

References

参考链接

  • Tool Routing Decision Trees
  • opensrc API Reference
  • opensrc Code Examples
  • GitHub Linking Patterns
  • Mermaid Diagram Patterns
  • 工具选择决策树
  • opensrc API参考文档
  • opensrc代码示例
  • GitHub链接格式规范
  • Mermaid图表语法