lsp-client/lsp-skill/lsp-code-analysis
Claude Code and agent skill by lsp-client/lsp-skill
- community
Checking that the SKILL.md file is still in the repository.
Semantic code analysis via LSP. Navigate code (definitions, references, implementations), search symbols, preview refactorings, and get file outlines. Use for exploring unfamiliar codebases or performing safe refactoring.
Install
npx vskill@latest install lsp-client/lsp-skill/lsp-code-analysisSKILL.md
LSP Code Analysis
IMPORTANT: PREREQUISITE
To use this skill, you MUST follow these steps:
- Check for updates: Run the update script to ensure you are using the latest version of the tool.
- Verify project support: Run
lsp server start <project_path>to start the LSP server and confirm the project is supported.
IF YOU DO NOT PERFORM THESE STEPS, YOU ARE NOT ALLOWED TO USE THIS SKILL.
Abstract
This document specifies the operational requirements and best practices for the lsp-code-analysis skill. It provides a semantic interface to codebase navigation, analysis and refactoring via the Language Server Protocol (LSP).
Overview
You are provided with lsp CLI tool for semantic code navigation and analysis. It SHOULD be preferred over read or grep for most code understanding tasks.
Usages:
- Semantic navigation: Jump to definitions, find references, locate implementations - understands code structure, not just text patterns.
- Language-aware: Distinguishes between variables, functions, classes, types - eliminates false positives from text search.
- Cross-file intelligence: Trace dependencies, refactor safely across entire codebase - knows what imports what.
- Type-aware: Get precise type information, signatures, documentation - without reading implementation code.
Tool Selection
Guideline: You SHOULD prioritize LSP commands for code navigation and analysis. Agents MAY use read or grep ONLY when semantic analysis is not applicable (e.g., searching for comments or literal strings).
| Task | Traditional Tool | Recommended LSP Command | |
|---|---|---|---|
| Find Definition | grep, read | `definition` | |
| Find Usages | grep -r | `reference` | |
| Understand File | read | `outline` | |
| View Docs/Types | read | `doc` | |
| Refactor | sed | See Refactoring Guide |
Commands
All commands support -h or --help.
Locating Symbols
Most commands use a unified locating syntax via the --scope and --find options.
Arguments: <file_path>
Options:
--scope: Narrow search to a symbol body or line range.--find: Text pattern to find within the scope.
Scope Formats:
<line>: Single line number (e.g.,42).<start>,<end>: Line range (e.g.,10,20). Use0for end to mean till EOF (e.g.,10,0).<symbol_path>: Symbol path with dots (e.g.,MyClass.my_method).
Find Pattern (`--find`):
The --find option narrows the target to a text pattern within the selected scope:
- The scope is determined by
--scope(line/range/symbol). If no--scopeis given, the entire file is the scope. - Pattern matching is whitespace-insensitive: differences in spaces, tabs, and newlines are ignored.
- You MAY include the cursor marker
<|>inside the pattern to specify the exact position of interest within the match (for example, on a variable name, keyword, or operator). - If
--findis omitted, the command uses the start of the scope (or a tool-specific default) as the navigation target.
Cursor Marker (`<|>`):
The <|> marker indicates the exact position for symbol resolution. It represents the character immediately to its right. Use it within the find pattern to point to a specific element (e.g., user.<|>name to target the name property).
Examples:
lsp doc foo.py --find "self.<|>"- Findself.in entire file, position at the character after the dot (typically for completion or member access)lsp doc foo.py --scope 42 --find "return <|>result"- Findreturn resulton line 42, position atrofresultlsp doc foo.py --scope 10,20 --find "if <|>condition"- Findif conditionin lines 10-20, position atcofconditionlsp doc foo.py --scope MyClass.my_method --find "self.<|>"- Findself.withinMyClass.my_method, position after the dotlsp doc foo.py --scope MyClass- Target theMyClasssymbol directly
Guideline for Scope vs. Find:
- Use
--scope <symbol_path>(e.g.,--scope MyClass,--scope MyClass.my_method) to target classes, functions, or methods. This is the most robust and preferred way to target symbol. - Use
--find(often combined with--scope) to target variables or specific positions. Use this when the target is not a uniquely named symbol or when you need to pinpoint a specific usage within a code block.
Agents MAY use lsp locate <file_path> --scope <scope> --find <find> to verify if the target exists in the file and view its context before running other commands.
Pagination
Use pagination for large result sets like reference or search.
--pagination-id <ID>: (Required) Unique session ID for consistent paging.--max-items <N>: Page size.--start-index <N>: Offset (0-based).
Example:
Guideline: Use pagination with a unique ID for common symbols to fetch results in manageable chunks. Increment --start-index using the same ID to browse.
Outline: File Structure
Get hierarchical symbol structure without reading implementation.
Agents SHOULD use outline before reading files to avoid unnecessary context consumption.
Definition: Navigate to Source
Navigate to where symbols are defined.
Reference: Find All Usages
Find where symbols are used or implemented.
Doc: Get Documentation
Get documentation and type information without navigating to source.
Agents SHOULD prefer doc over read when only documentation or type information is needed.
Search: Global Symbol Search
Search for symbols across the workspace when location is unknown.
Agents SHOULD use --kinds to filter results and reduce noise.
Symbol: Get Complete Symbol Code
Get the full source code of the symbol containing a location.
Response includes: symbol name, kind (class/function/method), range, and complete source code.
Agents SHOULD use symbol to read targeted code blocks instead of using read on entire files.
Refactoring Operations
Read Refactoring Guide for rename, extract, and other safe refactoring operations.
Server: Manage Background Servers
The background manager starts automatically. Manual control is OPTIONAL.
Best Practices
General Workflows
Understanding Unfamiliar Code
The RECOMMENDED sequence for exploring new codebases:
Debugging Unknown Behavior
Finding Interface Implementations
Tracing Data Flow
Understanding Type Hierarchies
Performance Tips
Domain-Specific Guides
For specialized scenarios, see:
- Monorepo: monorepo.md
- Frontend: bp_frontend.md
- Backend: bp_backend.md
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/lsp-code-analysis/SKILL.md
Popularity
- Repository stars
- 83
- Repository forks
- 5
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 4 Apr 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/lsp-client/lsp-skill/lsp-code-analysis)