agentleFS
axiomanticaxiomantic/spellbook/skills/using-lsp-tools/SKILL.md

using-lsp-tools

Skill11 starsChanged 3 months agoMITView on GitHub

Use when mcp-language-server tools are available and you need semantic code intelligence. Triggers: 'find definition', 'find references', 'who calls this', 'rename symbol', 'type hierarchy', 'go to definition', 'where is this used', 'where is this defined', 'what type is this'. Provides navigation, refactoring, and type analysis via LSP.

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If ANY unchecked: STOP and reconsider approach.

    line 124

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Using LSP Tools

<ROLE> Language Tooling Expert. Reputation depends on leveraging semantic analysis over text matching for accurate, complete code navigation and refactoring. </ROLE>

Invariant Principles

  1. Semantic > Lexical: LSP understands scope, types, inheritance. Grep sees text.
  2. LSP for Symbols, Grep for Strings: Symbols = definitions, references, types. Strings = TODOs, comments, literals.
  3. Verify Before Fallback: Empty LSP result? Check file saved. Then try text-based.
  4. Atomic Operations Preferred: rename_symbol handles all files. Manual Edit misses references.

Reasoning Schema

<analysis> - Is target a symbol (function, class, variable) or literal text? - Is LSP server active for this language? - Does task need semantic understanding (types, scope, inheritance)? </analysis><reflection> - Did LSP return expected results? If empty: file saved? Feature supported? - Did fallback find matches LSP missed? Indicates LSP limitation vs. saved state. </reflection>

Inputs

InputRequiredDescription
filePathYesAbsolute path to file being analyzed
lineContext1-indexed line number for position-based queries
columnContext1-indexed column for position-based queries
symbolNameContextFully-qualified name for definition/references
languageNoLanguage identifier if ambiguous

Outputs

OutputTypeDescription
Symbol locationsInlineFile paths and positions from navigation queries
Type informationInlineHover/signature data for understanding
Refactoring editsAppliedDirect code modifications from rename/actions
DiagnosticsInlineErrors and warnings for debugging

Tool Priority Matrix

TaskLSP ToolFallback
Find definitiondefinitionGrep func X|class X|def X
Find usagesreferencesGrep symbol name
Understand symbolhoverRead + infer
Renamerename_symbolMulti-file Edit (risky)
File outlinedocument_symbolsGrep definitions
Callerscall_hierarchy incomingGrep + analyze
Calleescall_hierarchy outgoingRead function
Type hierarchytype_hierarchyGrep extends/implements
Workspace searchworkspace_symbol_resolveGlob + Grep
Refactoringscode_actionsManual
Signaturesignature_helpHover or read
DiagnosticsdiagnosticsBuild command
Formatformat_documentFormatter CLI
Edit by lineedit_fileBuilt-in Edit

Parameters

Required: filePath (absolute), line/column (1-indexed), symbolName (fully-qualified for definition/references).

Decision Rules

Use LSP when:

  • Finding true definition (not text match)
  • Refactoring (rename, extract, inline)
  • Understanding type relationships
  • Finding semantic usages
  • Cross-file navigation via imports

Use Grep/Glob when:

  • Literal strings, comments, non-code text
  • Regex patterns
  • LSP returns empty but code exists
  • Unsupported languages
  • Non-symbols (TODOs, URLs, magic strings)

Workflows

Exploration: document_symbols (structure) -> hover (types) -> definition (jump) -> references (usage)

Refactoring: code_actions (discover) -> rename_symbol (execute) OR references (assess impact) -> manual

Type debugging: hover (inferred) -> type_hierarchy (inheritance) -> diagnostics (errors)

Call analysis: call_hierarchy incoming = "who calls?" | outgoing = "what calls?"

Anti-Patterns

<FORBIDDEN> - Using Grep for symbol rename (misses scoped references, hits false positives) - Skipping LSP for "simple" refactors (simple becomes complex with inheritance) - Trusting empty LSP results without checking file saved state - Manual multi-file edits when `rename_symbol` available - Ignoring `diagnostics` output when debugging type errors </FORBIDDEN>

Fallback Protocol

  1. LSP error/empty -> Check file saved (LSP reads disk)
  2. Try table fallback
  3. Persistent failure -> Feature unsupported by server

Self-Check

Before completing:

  • Used semantic LSP tool for symbol-based queries (not text search)
  • Verified file saved if LSP returned empty/unexpected results
  • Applied atomic refactoring operations where available
  • Documented fallback rationale if LSP bypassed

If ANY unchecked: STOP and reconsider approach.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.