Skip to main content
skill CX Codex

lsp-local-symbols — Claude Code skill: per-file symbol analysis

Lists the functions and types a file declares, finds every use of a symbol inside it, and reports the type. Handy before you edit a single file.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add blackwell-systems/agent-lsp --skill lsp-local-symbols -a claude-code
Open on GitHub

What lsp-local-symbols does

The skill talks to the agent-lsp MCP server and reads from the language server index. Questions about one file come back faster than a project-wide search, since the workspace index stays untouched. Nothing is written: every step is read-only.

Four tools do the work. open_document hands the file to the language server, list_symbols returns the symbol tree with coordinates, get_document_highlights collects occurrences at a position, and inspect_symbol prints the type signature with docs. Coordinates are 1-based, and the highlight and type calls take their input from selectionRange.

Scope is the catch. get_document_highlights only sees the open file, so a symbol used elsewhere stays invisible; cross-file work goes through find_references in /lsp-impact. You also need the agent-lsp MCP server running, and the language server has to provide documentSymbolProvider. documentHighlightProvider and hoverProvider are optional, and without them some steps return less.

What it helps with

  • map a file's structure before touching it
  • list every read and write of a variable
  • check a type signature before renaming
  • count occurrences to decide whether a symbol can be inlined
  • get a symbol map with line numbers

Example prompts for the agent

  • Where is config used in server.go?
  • List the functions and types defined in this file
  • What type does the symbol on line 42 of server.go have?

How to install lsp-local-symbols

1Skills CLI (Vercel)

npx skills add blackwell-systems/agent-lsp --skill lsp-local-symbols -a claude-code

2Manually: put the files in place

~/.claude/skills/lsp-local-symbols/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/lsp-local-symbols/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about lsp-local-symbols

How do I install lsp-local-symbols in Claude Code?

Run npx skills add blackwell-systems/agent-lsp --skill lsp-local-symbols -a claude-code. The skill then lands at ~/.claude/skills/lsp-local-symbols/SKILL.md.

What does lsp-local-symbols do?

It analyses symbols in one file: lists declared functions, types and constants, finds all in-file occurrences of a symbol, and reports its type.

How is it different from /lsp-impact?

get_document_highlights stays inside the open file and misses usages in other files. Reach for /lsp-impact when you need callers across the project, and /lsp-dead-code when auditing exports with no callers.

Source text

SKILL.md · MIT
---
name: lsp-local-symbols
description: Fast file-scoped symbol analysis — find all usages of a symbol within the current file, list all symbols defined in the file, and get type info at a position. Use when you need local-scope analysis without a workspace-wide search.
argument-hint: "[symbol-name] in [file-path]"
user-invocable: true
allowed-tools: mcp__lsp__open_document mcp__lsp__list_symbols mcp__lsp__inspect_symbol mcp__lsp__get_document_highlights
license: MIT
compatibility: Requires the agent-lsp MCP server (github.com/blackwell-systems/agent-lsp)
metadata:
  required-capabilities: documentSymbolProvider
  optional-capabilities: documentHighlightProvider hoverProvider
---

> 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

| Question | Tool |
|----------|------|
| 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"
```

© blackwell-systems · MIT · blackwell-systems/agent-lsp

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set9

lsp-test-correlation Maps an edited source file to the tests that cover it, then runs just those. Useful when one file changed and the full suite is overkill. CX Codex +1 ★ 165repo stars lsp-rename Renames functions, methods, variables and types across a workspace in two phases: it lists every affected site first, then edits after you confirm. CX Codex +1 ★ 165repo stars lsp-impact Maps every caller, supertype and subtype, and reference count for a symbol or file before you touch it. Built for refactors and deletions. CX Codex +1 ★ 165repo stars lsp-fix-all Walks every diagnostic in a file and applies the quick-fixes your language server offers. Handy when errors and warnings have piled up before you start new work. CX Codex +1 ★ 165repo stars lsp-edit-symbol Changes a function, type or variable by name when you don't know the file or position. Runs on the agent-lsp MCP server. CX Codex +1 ★ 165repo stars lsp-dead-code The skill lists exported symbols in a file and checks each one for references across the workspace. Useful when you want to know which exports are safe to drop. CX Codex +1 ★ 165repo stars lsp-architecture Produces a structural overview of a repository: languages, packages, entry points, dependency flow and hotspot files. One call instead of a manual sweep. CX Codex +1 ★ 165repo stars agent-lsp Coordinates language servers into 65 agent tools across 32 languages, keeping project indexes warm and testing edits in memory. CX Codex +1 ★ 165repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor