About rust-lsp
rust-lsp is an agent skill for using Rust LSP tools to navigate and analyze Rust workspaces. It guides semantic tasks such as finding definitions, inspecting types, and renaming symbols.
Key features
- 01Find symbol definitions and references
- 02Inspect inferred and declared types
- 03Search workspace symbols
- 04Rename symbols across usages
- 05Manage in-memory documents and workspaces
Use cases
- 01Trace a Rust symbol across crates
- 02Review callers of a function
- 03Check inferred types or trait implementations
- 04Safely rename a symbol across a workspace
MCP support
Uses Rust LSP MCP tools for semantic analysis and workspace operations. If the tools are unavailable, the skill directs users to run its installation script first.
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ fedemagnani/ rust-lsp-plugin --skill rust-lspAfter installing, type/rust-lspin Claude Code to confirm it loaded.
Bundled filesscripts/install.sh
Details
From the project READMERust Analyzer Agent Skill
When to use
MUST use the MCP tools when the task involves:
- Resolving where a symbol is defined, including across crate boundaries
- Finding all references to a function, type, field, or trait method
- Inspecting type signatures, inferred types, or trait implementations
- Searching for symbols by name across a workspace
- Renaming a symbol across all usage sites
SHOULD prefer the MCP tools over grep or file reads when the task requires Rust-aware semantic understanding (scoping, imports, trait dispatch, macro expansion).
Fall back to grep or file reads when the task is not Rust-specific, targets string literals or comments, or covers files outside the Rust compilation.
Installation
If the Rust LSP tools are not available yet, run scripts/install.sh from this skill before using the MCP tools. Treat the tools as "not available yet" whenever the current session does not expose the Rust LSP MCP tool APIs: attempt the install/setup path first, then verify whether the tools become usable.
Common workflows
Navigate to a definition
definitionsat the symbol position- Read the target file at the returned location
Find all callers
referencesat the function name position- Review the returned locations
Inspect a type
hoverat the position — returns the resolved type even for inferred types, trait objects, and generic instantiations
Find a symbol by name
workspace_symbolswith the name as query- Read the returned location if needed
Rename a symbol safely
open_documentwith the file contentsrename_symbolat the position with the new name- Apply the returned workspace edits to disk
close_documentwhen done
Update in-memory content for analysis
Position-based tools work on saved files without open_document. Use the document
lifecycle only when analyzing unsaved or in-memory content:
open_documentto synchronize contents with rust-analyzerreplace_documentto update contents (version auto-increments)close_documentwhen done (idempotent)
React to project structure changes
reload_workspaceafter editingCargo.tomlor adding/removing cratesrebuild_proc_macrosif proc-macro source changed