57 lines
1.6 KiB
Markdown
57 lines
1.6 KiB
Markdown
# Sourcegraph 代码库搜索技能
|
||
|
||
`AI代理` `代码搜索` `Sourcegraph` `Claude Code`
|
||
|
||
# Sourcegraph 技能
|
||
|
||
用于通过 Sourcegraph 搜索和理解代码库的 AI 代理技能。
|
||
|
||
## 安装
|
||
|
||
### Claude Code
|
||
|
||
```bash
|
||
npx skills add sourcegraph-community/sourcegraph-skill --skill "searching-sourcegraph"
|
||
```
|
||
|
||
或手动将 `.claude/skills/` 目录复制到你的项目或 `~/.claude/skills/`。
|
||
|
||
### 任意代理
|
||
|
||
这些技能遵循 [Agent Skills](https://agentskills.io) 开放标准,可与任何兼容的 AI 代理配合使用。
|
||
|
||
## 可用技能
|
||
|
||
### searching-sourcegraph
|
||
|
||
在 Sourcegraph 索引的代码库中搜索模式、示例,并理解系统结构。
|
||
|
||
**适用场景:**
|
||
- 实现新功能时(先查找类似模式)
|
||
- 理解陌生代码("X 是如何工作的")
|
||
- 调试问题(追踪错误和近期变更)
|
||
- 查找 API 使用示例
|
||
|
||
**使用的工具:**
|
||
- `keyword_search` - 精确模式匹配
|
||
- `nls_search` - 语义/概念搜索
|
||
- `deepsearch_read` - 架构层面理解
|
||
- `find_references` - 追踪符号用法
|
||
- `go_to_definition` - 跳转到实现处
|
||
- `read_file` - 读取文件内容
|
||
- `diff_search` - 查找代码变更
|
||
- `commit_search` - 搜索提交历史
|
||
|
||
## 目录结构
|
||
|
||
```
|
||
.claude/skills/searching-sourcegraph/
|
||
├── SKILL.md # 技能主说明文件
|
||
├── query-patterns.md # 正则表达式模式参考
|
||
├── examples/
|
||
│ └── common-searches.md # 实际使用示例
|
||
└── workflows/
|
||
├── implementing-feature.md
|
||
├── understanding-code.md
|
||
└── debugging-issue.md
|
||
``` |