librarian
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLibrarian Skill
Librarian Skill
Deep codebase exploration across remote repositories.
跨远程代码仓库的深度代码库探索工具。
How to Use This Skill
如何使用该Skill
Reference Structure
参考文档结构
| File | Purpose | When to Read |
|---|---|---|
| Tool selection decision trees | Always read first |
| API reference, types | Writing opensrc code |
| JavaScript patterns, workflows | Implementation examples |
| GitHub URL patterns | Formatting responses |
| Mermaid patterns | Visualizing architecture |
| 文件 | 用途 | 阅读时机 |
|---|---|---|
| 工具选择决策树 | 务必首先阅读 |
| API参考文档、类型定义 | 编写opensrc相关代码时 |
| JavaScript代码模式、工作流 | 实现示例参考 |
| GitHub URL格式规范 | 格式化响应内容时 |
| Mermaid图表语法 | 可视化架构设计时 |
Reading Order
阅读顺序
- Start with → choose tool strategy
tool-routing.md - If using opensrc:
- Read for API details
opensrc-api.md - Read for patterns
opensrc-examples.md
- Read
- Before responding: +
linking.mdfor output formattingdiagrams.md
- 第一步 阅读→ 确定工具使用策略
tool-routing.md - 若使用opensrc工具:
- 阅读了解API细节
opensrc-api.md - 阅读参考代码模式
opensrc-examples.md
- 阅读
- 生成响应前: 参考+
linking.md进行输出格式化diagrams.md
Tool Arsenal
工具库
| Tool | Best For | Limitations |
|---|---|---|
| grep_app | Find patterns across ALL public GitHub | Literal search only |
| context7 | Library docs, API examples, usage | Known libraries only |
| opensrc | Fetch full source for deep exploration | Must 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 differences1. opensrc.fetch(["X", "Y"])
2. 使用返回结果中的source.name进行后续调用
3. opensrc.grep(pattern, { sources: [nameX, nameY] })
4. 阅读可对比文件,归纳差异Critical: Source Naming Convention
重要:源码命名规范
After fetching, always use for subsequent calls:
source.namejavascript
const [{ source }] = await opensrc.fetch("vercel/ai");
const files = await opensrc.files(source.name, "**/*.ts");| Type | Fetch Spec | Source Name |
|---|---|---|
| npm | | |
| npm scoped | | |
| pypi | | |
| crates | | |
| GitHub | | |
| GitLab | | |
获取源码后,后续调用必须使用:
source.namejavascript
const [{ source }] = await opensrc.fetch("vercel/ai");
const files = await opensrc.files(source.name, "**/*.ts");| 类型 | 获取标识 | 源码名称 |
|---|---|---|
| npm | | |
| npm 作用域包 | | |
| pypi | | |
| crates | | |
| GitHub | | |
| GitLab | | |
When NOT to Use opensrc
不建议使用opensrc的场景
| Scenario | Use Instead |
|---|---|
| Simple library API questions | context7 |
| Finding examples across many repos | grep_app |
| Very large monorepos (>10GB) | Clone locally |
| Private repositories | Direct access |
| 场景 | 替代方案 |
|---|---|
| 简单的类库API问题 | context7 |
| 在大量仓库中查找示例 | grep_app |
| 超大型单体仓库(>10GB) | 本地克隆 |
| 私有仓库 | 直接访问 |
Output Guidelines
输出规范
- Comprehensive final message - only last message returns to main agent
- Parallel tool calls - maximize efficiency
- Link every file reference - see
linking.md - Diagram complex relationships - see
diagrams.md - Never mention tool names - say "I'll search" not "I'll use opensrc"
- 最终消息需全面 - 仅最后一条消息返回给主Agent
- 并行调用工具 - 最大化效率
- 所有文件引用需添加链接 - 参考
linking.md - 复杂关系需生成图表 - 参考
diagrams.md - 切勿提及工具名称 - 说“我将进行搜索”而非“我将使用opensrc”
References
参考链接
- Tool Routing Decision Trees
- opensrc API Reference
- opensrc Code Examples
- GitHub Linking Patterns
- Mermaid Diagram Patterns
- 工具选择决策树
- opensrc API参考文档
- opensrc代码示例
- GitHub链接格式规范
- Mermaid图表语法