Confirm successful installation by checking the skill directory location:
.cursor/skills/lsp-code-analysis
Restart Cursor to activate lsp-code-analysis. Access via /lsp-code-analysis in your agent's command palette.
β
Security Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
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).
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). Use 0 for 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 --scope is 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 --find is 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.<|>" - Find self. 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" - Find return result on line 42, position at r of result
lsp doc foo.py --scope 10,20 --find "if <|>condition" - Find if condition in lines 10-20, position at c of condition
lsp doc foo.py --scope MyClass.my_method --find "self.<|>" - Find self. within MyClass.my_method, position after the dot
lsp doc foo.py --scope MyClass - Target the MyClass symbol 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.
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.
# Get main symbols (classes, functions, methods)lsp outline <file_path># Get all symbols including variables and parameterslsp outline <file_path>--all
Agents SHOULD use outline before reading files to avoid unnecessary context consumption.
Definition: Navigate to Source
Navigate to where symbols are defined.
# Jump to where User.get_id is definedlsp definition models.py --scope User.get_id
# Find where an imported variable comes fromlsp definition main.py --scope42--find"<|>config"# Find declaration (e.g., header files, interface declarations)lsp definition models.py --scope25--mode declaration --find"<|>provider"# Find the class definition of a variable's typelsp definition models.py --scope30--find"<|>user"--mode type_definition
Reference: Find All Usages
Find where symbols are used or implemented.
# Find all places where logger is referencedlsp reference main.py --scope MyClass.run --find"<|>logger"# Find all concrete implementations of an interface/abstract classlsp reference api.py --scope"IDataProvider"--mode implementations
# Get more surrounding code context for each referencelsp reference app.py --scope10--find"<|>my_var" --context-lines 5# Limit results for large codebaseslsp reference utils.py --find"<|>helper" --max-items 50 --start-index 0
Doc: Get Documentation
Get documentation and type information without navigating to source.
# Get docstring and type info for symbol at line 42lsp doc main.py --scope42# Get API documentation for process_data functionlsp doc models.py --scope process_data
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.
# Search by name (defaults to current directory)lsp search "MyClassName"# Search in specific projectlsp search "UserModel"--project /path/to/project
# Filter by symbol kind (can specify multiple times)lsp search "init"--kindsfunction--kinds method
# Limit and paginate results for large codebaseslsp search "Config" --max-items 10lsp search "User" --max-items 20 --start-index 0
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.
# Get complete code of the function/class at line 15lsp symbol main.py --scope15# Get full UserClass implementationlsp symbol utils.py --scope UserClass
# Get complete method implementationlsp symbol models.py --scope User.validate
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.
# List running serverslsp server list
# Start server for a projectlsp server start <path># Stop server for a projectlsp server stop <path># Shutdown the background managerlsp server shutdown
Best Practices
General Workflows
Understanding Unfamiliar Code
The RECOMMENDED sequence for exploring new codebases:
# Step 1: Start with outline - Get file structure without reading implementationlsp outline <file_path># Step 2: Inspect signatures - Use doc to understand API contractslsp doc <file_path>--scope<symbol_name># Step 3: Navigate dependencies - Follow definition chainslsp definition <file_path>--scope<symbol_name># Step 4: Map usage - Find where code is called with referencelsp reference <file_path>--scope<symbol_name>
Debugging Unknown Behavior
# Step 1: Locate symbol definition workspace-widelsp search "<symbol_name>"# Step 2: Verify implementation detailslsp definition <file_path>--scope<symbol_name># Step 3: Trace all callers to understand invocation contextlsp reference <file_path>--scope<symbol_name>
# Step 1: Find where data is createdlsp search UserDTO --kinds class
# Step 2: Find where it's usedlsp reference models.py --scope UserDTO
# Step 3: Check transformationslsp doc transform.py --scope map_to_dto
Understanding Type Hierarchies
# Step 1: Get class outlinelsp outline models.py
# Step 2: Find subclasses (references to base)lsp reference models.py --scope BaseModel
# Step 3: Check type definitionslsp definition models.py --scope BaseModel --mode type_definition
Performance Tips
# Use outline instead of reading entire fileslsp outline large_file.py # Better than: read large_file.py# Use symbol paths for nested structures (more precise than line numbers)lsp definition models.py
β
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
βΊAccess to product documentation and roadmap tools (Jira, Notion, etc.)
βΊUnderstanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
βΊStakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Steps
1Install product management skill
2Start with user story generation for known feature
3Progress to competitive analysis: research 2-3 competitors
4Use for roadmap prioritization: apply RICE/ICE scoring
5Draft stakeholder communications and refine based on feedback
6Build template library for recurring PM tasks
7Share effective prompts with product team
Common Pitfalls
β Not validating competitive researchβverify facts before sharing
β Accepting user stories without involving engineering team
β Over-relying on frameworks without qualitative judgment
β Not customizing outputs to company culture and communication style
β Skipping stakeholder validation of generated requirements
Best Practices
β Do
+Validate research and competitive analysis with real data
+Collaborate with engineering when generating technical requirements
+Customize frameworks and templates to your company context
+Use skill for first drafts, refine with stakeholder input
+Document successful prompt patterns for PM tasks
+Combine AI efficiency with human judgment and intuition
β Don't
βDon't publish competitive analysis without fact-checking
βDon't finalize user stories without engineering review
βDon't make prioritization decisions solely on AI scoring
βDon't skip customer validation of generated requirements
βDon't ignore company-specific context and culture
π‘ Pro Tips
β Provide context: company goals, constraints, customer feedback
β Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
β Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
β Use skill for 70% generation + 30% customization to company needs
When to Use This
β Use when
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
β Avoid when
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path
1Basic: user stories, feature specs, status updates