返回技能列表

lsp-local-symbols

blackwell-systems
更新于 6 days ago
53
2
53
在 GitHub 上查看
其他general

关于

This skill provides fast file-scoped symbol analysis using LSP, allowing developers to find symbol usages within a file, list defined symbols, and get type information at positions. It's ideal for local-scope analysis without workspace-wide searches when using the agent-lsp MCP server. Key capabilities include document symbol lookup, highlighting, and hover information for focused code exploration.

快速安装

Claude Code

推荐
主要方式
npx skills add blackwell-systems/agent-lsp -a claude-code
插件命令备选方式
/plugin add https://github.com/blackwell-systems/agent-lsp
Git 克隆备选方式
git clone https://github.com/blackwell-systems/agent-lsp.git ~/.claude/skills/lsp-local-symbols

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

Requires the agent-lsp MCP server.

lsp-local-symbols

File-scoped symbol analysis using the language server index. Faster than workspace-wide search for questions about a single file: what symbols are defined here, where is this symbol used within the file, and what type does it have.

Read-only — does not modify any files.

When to use

  • "Where is x used in this file?" — use get_document_highlights
  • "What functions and types are defined in this file?" — use list_symbols
  • "What type does this symbol have?" — use inspect_symbol
  • Reviewing a file before editing — get the full symbol map first
  • Local refactor scoping — confirm a symbol is only used in one place before inlining it

Use /lsp-impact instead when you need workspace-wide callers and cross-file references. Use /lsp-dead-code when auditing exported symbols for zero callers.

When NOT to use

get_document_highlights is file-scoped by design — it only finds usages within the open file. If a symbol is used across multiple files, this skill will not find those. Use find_references (via /lsp-impact) for cross-file analysis.


Workflow

Step 1 — Open the file

Open the file so the language server tracks it:

mcp__lsp__open_document
  file_path: "/abs/path/to/file.go"
  language_id: "go"              # go, typescript, python, rust, etc.

Step 2 — List all symbols in the file

Get the full symbol tree for the file:

mcp__lsp__list_symbols
  file_path: "/abs/path/to/file.go"

This returns all functions, types, variables, constants, and methods defined in the file — including nested symbols (methods on types, fields in structs).

Use this to:

  • Understand the file's structure before editing
  • Find the exact position of a named symbol
  • See what a file exposes before reading it in full

Reading the output: Each symbol has a range (full body including braces) and a selectionRange (just the name). Coordinates are 1-based. Use selectionRange.start.line and selectionRange.start.character as inputs to get_document_highlights and inspect_symbol.

Step 3 — Find all usages within the file

Call get_document_highlights at the symbol's position:

mcp__lsp__get_document_highlights
  file_path: "/abs/path/to/file.go"
  line: <selectionRange.start.line from Step 2>
  column: <selectionRange.start.character from Step 2>

Returns every occurrence of the symbol within the file, classified as:

  • read — the symbol is read here
  • write — the symbol is assigned/mutated here
  • text — a text match (fallback when semantic classification isn't available)

Speed note: get_document_highlights is significantly faster than find_references for file-local queries — it does not scan the entire workspace index. Use it first; escalate to find_references only if you need cross-file results.

Step 4 — Get type information (optional)

For any position of interest, get the type signature and docs:

mcp__lsp__inspect_symbol
  file_path: "/abs/path/to/file.go"
  line: <line>
  column: <column>

Returns the hover text: type signature, documentation, and inferred types. Useful for confirming what a symbol is before deciding to rename or inline it.


Output format

Report results in three sections (omit any section with no content):

## Symbols in <filename>

### Functions / Methods
- `FuncName` — line N–M
- `(Type) MethodName` — line N–M

### Types
- `TypeName` (struct/interface/alias) — line N

### Variables / Constants
- `ConstName` = value — line N

---

## Usages of `<symbol>` in <filename>

N occurrences across M lines:
- line 12 [write] — assignment
- line 34 [read]  — passed as argument
- line 67 [read]  — returned

---

## Type info

`<symbol>`: <type signature from inspect_symbol>

Decision guide

QuestionTool
What's in this file?list_symbols
Where is X used in this file?get_document_highlights
What type is X?inspect_symbol
Is X safe to inline (used once)?get_document_highlights — count occurrences
Is X used outside this file?Use /lsp-impact instead
Is X dead code (no callers anywhere)?Use /lsp-dead-code instead

Example

# "Where is the `config` variable used in server.go?"

open_document(file_path="/repo/server.go", language_id="go")
list_symbols(file_path="/repo/server.go")
  → finds `config` at selectionRange line 42, col 2

get_document_highlights(file_path="/repo/server.go", line=42, column=2)
  → returns 7 occurrences: 1 write (line 42), 6 reads

inspect_symbol(file_path="/repo/server.go", line=42, column=2)
  → "config *Config — the parsed server configuration"

GitHub 仓库

blackwell-systems/agent-lsp
路径: skills/lsp-local-symbols
0
agentskillsai-agentsai-toolingclaudeclaude-codecode-intelligence

相关推荐技能

llamaguard

其他

LlamaGuard是Meta推出的7-8B参数内容审核模型,专门用于过滤LLM的输入和输出内容。它能检测六大安全风险类别(暴力/仇恨、性内容、武器、违禁品、自残、犯罪计划),准确率达94-95%。开发者可通过HuggingFace、vLLM或Sagemaker快速部署,并能与NeMo Guardrails集成实现自动化安全防护。

查看技能

cost-optimization

其他

这个Claude Skill帮助开发者优化云成本,通过资源调整、标记策略和预留实例来降低AWS、Azure和GCP的开支。它适用于减少云支出、分析基础设施成本或实施成本治理策略的场景。关键功能包括提供成本可视化、资源规模调整指导和定价模型优化建议。

查看技能

quantizing-models-bitsandbytes

其他

这个Skill使用bitsandbytes库量化大语言模型,能在GPU内存有限时通过8位或4位量化减少50-75%内存占用,同时保持精度损失最小。它支持INT8、NF4、FP4等多种量化格式,可与HuggingFace Transformers无缝集成,适用于需要部署更大模型或加速推理的场景。还提供QLoRA训练和8位优化器支持,让开发者能轻松实现高效模型压缩。

查看技能

dispatching-parallel-agents

其他

该Skill用于并行处理3个以上无依赖关系的独立故障,可为每个问题域分派专属Claude代理同时执行调查修复。它通过并发处理多个独立问题显著提升故障排查效率,特别适用于测试文件、子系统等无共享状态的场景。

查看技能