Skip to content
lsp-integration logo

LSP Integration Skill

lsp-integration

LSP (Language Server Protocol) expert for 100x faster semantic code understanding than text-based grep. Use when navigating large codebases, finding symbol definitions and references, or exploring type hierarchies. Supports TypeScript, Python, Go, Rust, and other LSP-enabled languages.

SKILL.md

Full skill instructions

LSP Integration Skill

You are an expert in leveraging Language Server Protocol (LSP) for semantic code understanding. LSP provides 100x faster and more accurate code exploration than text-based grep searches.

Overview

LSP servers understand code semantically - they know about types, symbols, references, and relationships between code elements. This enables precise navigation and refactoring that text search cannot achieve.

Supported Languages

LanguageLSP ServerInstall
TypeScript/​JavaScripttypescript-language-servernpm install -g typescript-language-server typescript
Pythonpython-lsp-server (pylsp)pip install python-lsp-server
Gogoplsgo install golang.org/​x/​tools/​gopls@latest
Rustrust-analyzerVia rustup or standalone
JavajdtlsEclipse JDT Language Server
C#omnisharp.NET SDK

Key Operations

1. Go to Definition

Navigate to where a symbol is defined.

# Using TypeScript language server
npx ts-node --eval "
const ts = require('typescript');
// Find definition of symbol at position
"

Use case: "Where is this function defined?" → Find exact location in codebase.

2. Find All References

Find every place a symbol is used.

Critical for refactoring: Before renaming or changing a function, ALWAYS find all references to understand impact.

# Find all usages of a function/​variable/​class
# LSP tracks semantic references, not just text matches

Use case: "What will break if I change this interface?" → Find all implementations and usages.

3. Document Symbols

Get structured view of all symbols in a file.

Use case: "What functions/​classes are in this file?" → Get hierarchy without parsing.

4. Hover Information

Get type information and documentation for any symbol.

Use case: "What type does this variable have?" → Get inferred or declared type.

5. Diagnostics

Get compilation errors and warnings.

Use case: "Are there any type errors?" → Real-time error checking.

When to Use LSP vs Grep

TaskUse LSPUse Grep
Find function definition✅ Precise⚠️ May find wrong match
Find all references✅ Semantic⚠️ Misses renamed imports
Search for text pattern❌ Not designed for this✅ Fast text search
Understand type hierarchy✅ Full inheritance chain❌ Cannot determine
Check for type errors✅ Compiler-accurate❌ Impossible
Find files by name❌ Overkill✅ Use Glob

Best Practices

1. Always Use findReferences Before Refactoring

❌ WRONG: Grep for function name → rename → hope nothing breaks
✅ RIGHT: LSP findReferences → understand all usages → safe rename

2. Use goToDefinition Instead of Grep

❌ WRONG: grep -r "function processOrder" .
✅ RIGHT: LSP goToDefinition → exact location, handles imports/​exports

3. Combine with Explore Agent

For complex exploration tasks, combine LSP operations with the Explore agent:

1. LSP: Find all references to deprecated function
2. Explore: Understand migration patterns in codebase
3. LSP: Navigate to each usage for refactoring

TypeScript/​JavaScript Specific

Setup

# Install globally
npm install -g typescript-language-server typescript

# Verify installation
typescript-language-server --version

Common Operations

Find where interface is implemented:

// LSP findReferences on interface → shows all implementing classes

Check type at position:

// LSP hover → shows inferred type, even for complex generics

Find unused exports:

// LSP diagnostics + findReferences → exports with 0 references

Python Specific

Setup

pip install python-lsp-server
# Optional: Add type checking
pip install pylsp-mypy

Common Operations

Find class hierarchy:

# LSP can show base classes and subclasses

Check import resolution:

# LSP resolves imports even with complex __init__.py structures

Integration with SpecWeave

In CLAUDE.md (already documented)

LSP operations are recommended in the SpecWeave workflow:

  • Use findReferences before any refactoring
  • Use goToDefinition for code navigation
  • Use getDiagnostics to check for errors

Workflow Example

  1. Before implementing: Use LSP to understand existing code structure
  2. During implementation: Use diagnostics to catch errors early
  3. Before commit: Use findReferences to verify no broken usages
  4. Code review: Use LSP to trace data flow through system

Troubleshooting

LSP Server Not Starting

# Check if server is installed
which typescript-language-server
which pylsp
which gopls

# Check for initialization errors
typescript-language-server --stdio 2>&1 | head -20

Slow Performance

  • Exclude node_modules and build directories
  • Ensure tsconfig.json or equivalent is properly configured
  • Increase memory limits for large projects

Missing References

  • Ensure project is properly typed
  • Check that all dependencies have type definitions
  • Verify language server has indexed the project

Token Budget

  • LSP setup instructions: 200-300 tokens
  • Single operation explanation: 100-200 tokens
  • Full workflow: 400-600 tokens

NEVER exceed 2000 tokens per response!

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View