Agent skill

Lsp Dead Code

by blackwell-systems in blackwell-systems/agent-lsp

Enumerate exported symbols in a file and surface those with zero references across the workspace.

MITAuto-check passedDevelopment

Install Lsp Dead Code

skills CLI
$ npx skills add blackwell-systems/agent-lsp --skill lsp-dead-code -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install blackwell-systems/agent-lsp lsp-dead-code --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/blackwell-systems/agent-lsp.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/lsp-dead-code .claude/skills/lsp-dead-code && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
lsp-dead-code
GitHub stars
159
Token cost
~2.4k tokens
SKILL.md length
1,082 words
Files
2 (incl. references)
Skills in repo
24
Repo updated
First seen
Licence
MIT

At a glance

Enumerate exported symbols in a file and surface those with zero references across the workspace.

  • Works in 6 steps: Verify indexing is complete (mandatory) → Open the file and enumerate symbols → Check references for each exported symbol → …
  • Auditing for dead code
  • SKILL.md covers When to Use, What counts as "exported", Prerequisites and Step 0 — Verify indexing is…, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Lsp Dead Code is an agent skill from blackwell-systems/agent-lsp. Enumerate exported symbols in a file and surface those with zero references across the workspace. Use when auditing for dead code, cleaning up APIs, or checking which exports are safe to remove.

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/patterns.md`). Compatibility notes: Requires the agent-lsp MCP server (github.com/blackwell-systems/agent-lsp)

It sits in Development. The repository describes itself as: MCP server that orchestrates language servers into agent-native workflows. 65 tools, 30 CI-verified languages. The licence is MIT.

When your agent uses it

  • Auditing for dead code
  • Cleaning up APIs
  • Checking which exports are safe to remove

Example prompts

  • “/lsp-dead-code”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Requires the agent-lsp MCP server (github.com/blackwell-systems/agent-lsp)
  • Pre-approved tools (allowed-tools): mcp__lsp__list_symbols, mcp__lsp__find_references, mcp__lsp__open_document, mcp__lsp__safe_delete_symbol

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Verify indexing is complete (mandatory)
  2. Open the file and enumerate symbols
  3. Check references for each exported symbol
  4. Classify and report
  5. Next steps
  6. Optional cleanup with safe_delete_symbol

What it can do on your machine

Read from SKILL.md and the folder at commit 6fa5faf. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • mcp__lsp__list_symbols
    • mcp__lsp__find_references
    • mcp__lsp__open_document
    • mcp__lsp__safe_delete_symbol

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Requires the agent-lsp MCP server (github.com/blackwell-systems/agent-lsp)

    From compatibility in the SKILL.md frontmatter.

Context cost

Lsp Dead Code loads about 2.4k tokens when it runs, and up to ~3.7k if it reads all its reference files. Until then it costs about 52 tokens; SKILL.md has 1,082 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~52
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from blackwell-systems/agent-lsp at commit 6fa5faf, republished under its MIT licence (© blackwell-systems). 1,082 words, ~2,364 tokens.

Download SKILL.mdSave it as .claude/skills/lsp-dead-code/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
lsp-dead-code
description
Enumerate exported symbols in a file and surface those with zero references across the workspace. Use when auditing for dead code, cleaning up APIs, or checking which exports are safe to remove.
allowed-tools
mcp__lsp__list_symbols, mcp__lsp__find_references, mcp__lsp__open_document, mcp__lsp__safe_delete_symbol
compatibility
Requires the agent-lsp MCP server (github.com/blackwell-systems/agent-lsp)
argument-hint
[file-path]
user-invocable
true
license
MIT
metadata.required-capabilities
documentSymbolProvider referencesProvider

Requires the agent-lsp MCP server.

lsp-dead-code

Audit an exported symbol list for zero-reference candidates. Calls list_symbols to enumerate symbols, then checks each exported symbol with find_references to find callers. Produces a classified report.

When to Use

Use this skill when you want to identify dead code in a file — exported symbols that are defined but never called anywhere in the workspace. Common use cases:

  • Cleaning up APIs before a release
  • Identifying legacy exports that can be safely removed
  • Auditing a package for unused public surface area

Important: This skill surfaces candidates. Always review results manually before deleting anything. See the Caveats section below.

What counts as "exported"

LanguageExported means...
GoIdentifier starts with an uppercase letter (e.g. MyFunc, MyType)
TypeScriptHas export keyword; or is a public class member (no private)
PythonNot prefixed with _; or explicitly listed in __all__
Java/C#Has public or protected visibility modifier
RustHas pub keyword

Prerequisites

If LSP is not yet initialized, call mcp__lsp__start_lsp with the workspace root first:

mcp__lsp__start_lsp({ "root_dir": "/your/workspace" })

agent-lsp supports auto-inference from file paths, so explicit start is only required when switching workspaces or on a cold session.

Step 0 — Verify indexing is complete (mandatory)

Do not skip this step. An under-indexed workspace returns [] for symbols that ARE referenced, producing false dead-code candidates.

Pick one symbol you know is actively used (e.g. the primary constructor, a widely-called utility function). Call find_references on it:

mcp__lsp__find_references({
  "file_path": "/abs/path/to/file.go",
  "line": <known-active symbol line>,
  "column": <known-active symbol column>,
  "include_declaration": false
})

If this returns []: the workspace is not indexed. Wait 3–5 seconds and retry. Do not proceed until a known-active symbol returns ≥1 reference. If it never returns results after 15 seconds, restart the LSP server with mcp__lsp__restart_lsp_server and re-open the target file.

Step 1 — Open the file and enumerate symbols

Open the file so the language server tracks it, then fetch all symbols:

mcp__lsp__open_document({ "file_path": "/abs/path/to/file.go" })

mcp__lsp__list_symbols({ "file_path": "/abs/path/to/file.go" })

Collect the full symbol list. Filter to exported symbols only using the language-appropriate rule from the table above.

Coordinate note: list_symbols returns 1-based coordinates. Pass selectionRange.start.line and selectionRange.start.character directly to find_references — no conversion needed.

"no identifier found" error: This means the column points to whitespace or a keyword rather than the identifier name. This happens with methods whose receiver prefix shifts the name rightward (e.g. func (c *Client) MethodName — the name starts at column 21, not column 1). Fix: grep the declaration line for the symbol name to find its exact column:

grep -n "MethodName" file.go
# count characters to find the 1-based column of the name

Then retry find_references with the corrected column.

Step 2 — Check references for each exported symbol

For each exported symbol, call find_references with include_declaration: false so the definition site itself is excluded from the count. A count of 0 means no callers, not no occurrences.

mcp__lsp__find_references({
  "file_path": "/abs/path/to/file.go",
  "line": <selectionRange.start.line>,
  "column": <selectionRange.start.character>,
  "include_declaration": false
})

Record the result for each symbol:

{ symbol_name, kind, line, reference_count, locations[] }

Batching note: For files with many exported symbols (>20), process in batches of 5–10 to avoid overwhelming the LSP server.

Zero-reference cross-check (required before classifying as dead): When find_references returns [] for a symbol that looks foundational (a handler, a constructor, a type used as a field), do not trust LSP alone. LSP can miss references made through value-passing, interface satisfaction, or function registration patterns (e.g. server.AddResource(HandleFoo)). Before classifying as dead, run a text search in the primary wiring files:

grep -r "SymbolName" main.go server.go cmd/ internal/

If grep finds the name in a registration or assignment context, the symbol is active — LSP just couldn't resolve the indirect reference. Update your classification accordingly.

Step 3 — Classify and report

Classify each exported symbol by reference count:

  • Zero references (LSP + grep) — confirmed dead candidate. Flag with WARNING.
  • Zero LSP, found by grep — active via registration/value pattern. Mark as ACTIVE.
  • 1–2 references — review manually. May be test-only usage.
  • 3+ references — active symbol. Not dead code.

For test-only references: if all locations are in _test.go files (Go) or files named *.test.* / *.spec.*, mark the symbol as "test-only" in the report rather than "zero-reference".

Produce the Dead Code Report using the format in references/patterns.md.

Show full SKILL.md (455 more words)Show less

Caveats

The following cases produce zero LSP references even though the symbol IS used at runtime. Do not delete any zero-reference candidate without manual review:

  1. Incomplete indexing. find_references only searches files open or indexed by the language server. If the workspace is partially indexed, results may be incomplete. The Step 0 warm-up check catches this.

  2. Registration patterns. Symbols passed as values to registration functions (e.g. server.AddTool(HandleFoo), http.HandleFunc("/", handler)) appear as zero LSP references from the definition site because gopls tracks the call to the registrar, not the handler name. Always grep wiring files for zero-reference handlers before classifying as dead.

  3. Reflection and dynamic dispatch. Symbols used via reflection (reflect.TypeOf in Go, Class.forName in Java) or dynamic dispatch have no static call sites visible to the LSP.

  4. //go:linkname and assembly. Go symbols linked via //go:linkname or referenced from assembly files will show zero LSP references.

  5. Library public API. Exported symbols called from external packages not present in the workspace will show zero references even if consumers exist.

  6. Declaration excluded from count. The definition site is not counted (include_declaration: false). A count of 0 means no callers found, not that the symbol never appears in the source tree.

  7. Always review before deleting. Zero LSP references is a signal to investigate, not a guarantee the symbol is unused.

Step 4 — Next steps

After generating the report:

  • For each zero-reference symbol (confirmed by grep): Run lsp-impact on the symbol to confirm. If lsp-impact also finds zero references, it is safe to consider for removal. Still check the Caveats section above.

  • For symbols with only test-file references: Mark as "test-only" in the report. These may be candidates for removal if the tests themselves are redundant, but should not be deleted without reviewing whether the tests serve a documentation or contract purpose.

  • For symbols with 1–2 references in production code: These are likely active but lightly used. Do not remove without checking whether they are part of a committed public API.

Step 5 — Optional cleanup with safe_delete_symbol

After reviewing the dead code report and confirming candidates with the user, you may offer to remove confirmed zero-reference symbols using safe_delete_symbol:

mcp__lsp__safe_delete_symbol({
  "file_path": "/abs/path/to/file.go",
  "symbol_path": "DeadFunction"
})

This tool performs its own reference check before deleting. If any references exist (even ones missed in the initial scan), the deletion is refused.

Requirements before using this step:

  1. The user has explicitly confirmed they want the symbol removed.
  2. The symbol was classified as a confirmed dead candidate (zero LSP + zero grep references).
  3. You have reviewed the Caveats section above and communicated relevant risks.

Do NOT auto-delete symbols without user confirmation. Present the dead code report first, let the user select which symbols to remove, then execute safe_delete_symbol for each approved removal.

© blackwell-systems, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in skills/lsp-dead-code of blackwell-systems/agent-lsp.

  • SKILL.md
  • references/patterns.md

Open the folder on GitHubat commit 6fa5faf

Compare with similar skills

Lsp Dead Code next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Lsp Dead Code compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Lsp Dead Code this skillblackwell-systems/agent-lsp159—~2.4kAutomated safety check: PassMIT
Vercel Composition Patternssupabase/supabase111k59 repos~726Automated safety check: PassMIT
Finishing a Development Branchobra/superpowers296k5 repos~1.9kAutomated safety check: PassMIT
Typescript Advanced Typesrolling-scopes/rsschool-app10k25 repos~4.2kAutomated safety check: PassMPL-2.0
PR Babysitteropeninterpreter/openinterpreter69k3 repos~4.2kAutomated safety check: PassApache-2.0
Code Review ChecklistshareAI-lab/learn-claude-code78k5 repos~1.1kAutomated safety check: PassMIT

Similar skills

  • Official

    React composition patterns that scale. An agent skill from supabase/supabase.

    111k GitHub starsUsed in 59 repos~726 tokens
    DevelopmentAuto-check passed
  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    296k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Typescript Advanced Types

    rolling-scopes/rsschool-app

    Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.

    10k GitHub starsUsed in 25 repos~4.2k tokens
    DevelopmentAuto-check passed
  • PR Babysitter

    openinterpreter/openinterpreter

    Watches an open GitHub pull request until it merges, handling review comments, diagnosing CI failures and retrying flaky checks along the way.

    69k GitHub starsUsed in 3 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 5 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Greploop

    onyx-dot-app/onyx

    Iteratively improves a PR (GitHub), MR (GitLab), or shelved changelist (Perforce) until Greptile gives it a 5/5 confidence score with zero unresolved comments.

    32k GitHub starsUsed in 4 repos~3.3k tokens
    DevelopmentAuto-check passed

More from blackwell-systems/agent-lsp

All 24 skills in this repo
  • Lsp Edit Export

    blackwell-systems/agent-lsp

    Safe workflow for editing exported symbols or public APIs. An agent skill from blackwell-systems/agent-lsp.

    159 GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Lsp Fix All

    blackwell-systems/agent-lsp

    Apply available quick-fix code actions for all current diagnostics in a file, one at a time with re-collection between each fix.

    159 GitHub stars~1.6k tokensUpdated today
    Auto-check passed
  • Lsp Generate

    blackwell-systems/agent-lsp

    Trigger language server code generation — implement interface stubs, generate test skeletons, add missing methods, generate mock types.

    159 GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Lsp Impact

    blackwell-systems/agent-lsp

    Blast-radius analysis for a symbol or file — shows all callers, type supertypes/subtypes, and reference count before you change it.

    159 GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Lsp Rename

    blackwell-systems/agent-lsp

    Two-phase safe rename across the entire workspace. An agent skill from blackwell-systems/agent-lsp.

    159 GitHub stars~1.9k tokensUpdated today
    Auto-check passed
  • Lsp Simulate

    blackwell-systems/agent-lsp

    Speculative code editing session — simulate changes in memory before touching disk.

    159 GitHub stars~1.8k tokensUpdated today
    Auto-check passed

Categories

Questions about Lsp Dead Code

What does Lsp Dead Code do?

Enumerate exported symbols in a file and surface those with zero references across the workspace. Lsp Dead Code is an agent skill from blackwell-systems/agent-lsp. Enumerate exported symbols in a file and surface those with zero references across the workspace.

When should I use Lsp Dead Code?

Lsp Dead Code fits situations like: auditing for dead code; cleaning up APIs; checking which exports are safe to remove.

How do I install Lsp Dead Code in Claude Code?

Run `npx skills add blackwell-systems/agent-lsp --skill lsp-dead-code -a claude-code`. Or copy the skill folder (skills/lsp-dead-code in blackwell-systems/agent-lsp) into .claude/skills/lsp-dead-code in your project. Claude Code loads it when a task matches its description.

How do I install Lsp Dead Code in Codex?

Run `npx skills add blackwell-systems/agent-lsp --skill lsp-dead-code -a codex`. Or copy the skill folder (skills/lsp-dead-code in blackwell-systems/agent-lsp) into .agents/skills/lsp-dead-code in your project. Codex loads it when a task matches its description.

Can I use Lsp Dead Code in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add blackwell-systems/agent-lsp --skill lsp-dead-code -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/lsp-dead-code, .gemini/skills/lsp-dead-code, .github/skills/lsp-dead-code and .opencode/skills/lsp-dead-code in your project.

What does Lsp Dead Code need to run?

SKILL.md names no scripts, command-line tools or credentials: Lsp Dead Code is instructions for the agent only. Our summary lists: Python 3. Its frontmatter pre-approves these tools: mcp__lsp__list_symbols, mcp__lsp__find_references, mcp__lsp__open_document, mcp__lsp__safe_delete_symbol. Compatibility (from SKILL.md): Requires the agent-lsp MCP server (github.com/blackwell-systems/agent-lsp).

Does Lsp Dead Code access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Lsp Dead Code safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Lsp Dead Code use?

Lsp Dead Code is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Lsp Dead Code use?

About 2.4k tokens (SKILL.md is roughly 9.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.3k tokens, read only when the agent opens those files.

What are the alternatives to Lsp Dead Code?

Skills that share tags, products or a category with Lsp Dead Code: Vercel Composition Patterns (supabase/supabase, 111k stars), Finishing a Development Branch (obra/superpowers, 296k stars), Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars) and PR Babysitter (openinterpreter/openinterpreter, 69k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Lsp Dead Code?

blackwell-systems (a GitHub user) maintains it in blackwell-systems/agent-lsp, which has 159 GitHub stars. The repository holds 24 skills in this directory. The repository was last updated on October 7, 2026.

Source: blackwell-systems/agent-lsp on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.