Agent skill
setup-lsp
Help users configure and verify LSP (Language Server Protocol) setup for Python and JavaScript/TypeScript in Claude Code. This skill should be used when users ask about LSP configuration, need to check if LSP servers are properly installed, encounter LSP-related issues, or want to verify LSP functionality before starting development work.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/setup-lsp
SKILL.md
LSP Setup and Verification
Guide for configuring and verifying Language Server Protocol (LSP) servers for Python and JavaScript/TypeScript in Claude Code projects.
When to Use
Use this skill when:
- User asks about LSP configuration or setup
- User needs to verify LSP servers are installed and working
- LSP features are not working (no autocomplete, no diagnostics, etc.)
- Starting a new development session and want to check LSP environment
- User encounters errors related to language servers
Quick Check Commands
Check Python LSP Installation
# Check if pylsp is installed
which pylsp || which python-lsp-server
# Check Python version
python --version
# Test pylsp directly
pylsp --help 2>&1 | head -5
Check JavaScript/TypeScript LSP Installation
# Check if typescript-language-server is installed
which typescript-language-server
# Check Node.js version
node --version
# Test typescript-language-server directly
typescript-language-server --version
Installation Steps
Python LSP Server
Using pip:
pip install python-lsp-server[all]
Using uv (recommended for this project):
uv pip install python-lsp-server[all]
Verify installation:
pylsp --help
TypeScript Language Server
Using npm:
npm install -g typescript-language-server typescript
Using npx (no global install):
npx typescript-language-server --version
Verify installation:
typescript-language-server --version
Configuration Verification
Check LSP Configuration File
The project should have .claude/lsp.json with the following structure:
{
"lspServers": {
"python": {
"command": "pylsp",
...
},
"javascript": {
"command": "typescript-language-server",
...
}
}
}
Verify configuration:
# Check if lsp.json exists
test -f .claude/lsp.json && echo "✓ lsp.json exists" || echo "✗ lsp.json missing"
# Validate JSON syntax
python3 -m json.tool .claude/lsp.json > /dev/null && echo "✓ Valid JSON" || echo "✗ Invalid JSON"
Check Python Environment
For this project (Python 3.12):
# Check Python version matches .python-version
python --version
cat .python-version
# Check if virtual environment is active
echo $VIRTUAL_ENV
# Check PYTHONPATH
echo $PYTHONPATH
Check JavaScript Environment
# Check Node.js version
node --version
# Check if package.json exists (for project-specific config)
test -f package.json && echo "✓ package.json exists" || echo "✗ package.json missing"
Common Issues and Solutions
Issue: "pylsp: command not found"
Solution:
- Install python-lsp-server:
pip install python-lsp-server[all] - Ensure Python environment is in PATH
- For virtual environments, activate the venv before installing
Issue: "typescript-language-server: command not found"
Solution:
- Install globally:
npm install -g typescript-language-server typescript - Or ensure npx is available and use npx
- Check Node.js is installed:
node --version
Issue: LSP server starts but no diagnostics appear
Possible causes:
- LSP server not properly configured in
.claude/lsp.json - File extensions not mapped correctly
- Workspace folder path incorrect
- LSP server crashed (check logs)
Solution:
- Verify
.claude/lsp.jsonsyntax is valid - Check
extensionToLanguagemappings match your file types - Ensure
workspaceFolderuses${CLAUDE_PROJECT_DIR} - Check LSP server logs for errors
Issue: Python LSP can't find project dependencies
Solution:
- Ensure
PYTHONPATHincludes project root - Activate virtual environment if using one
- Install project dependencies:
uv pip install -e .orpip install -r requirements.txt - Check
env.PYTHONPATHin.claude/lsp.jsonis set correctly
Issue: TypeScript LSP shows errors for valid code
Solution:
- Ensure
tsconfig.jsonexists in project root (if using TypeScript) - For JavaScript projects, may need
jsconfig.json - Check TypeScript version compatibility
- Restart LSP server
Verification Checklist
Before starting development, verify:
- Python LSP server (
pylsp) is installed and accessible - TypeScript language server is installed and accessible
-
.claude/lsp.jsonexists and has valid JSON syntax - Python version matches project requirements (check
.python-version) - Node.js is installed (for JavaScript/TypeScript support)
- Project dependencies are installed (if applicable)
- Virtual environment is activated (if using one)
Testing LSP Functionality
Test Python LSP
- Open a
.pyfile - Check for:
- Autocomplete suggestions
- Syntax highlighting
- Error diagnostics
- Go to definition (if supported)
Test JavaScript/TypeScript LSP
- Open a
.js,.jsx,.ts, or.tsxfile - Check for:
- Autocomplete suggestions
- Type checking (for TypeScript)
- Error diagnostics
- Import suggestions
Project-Specific Notes
This project uses:
- Python 3.12 (see
.python-version) - Django/Wagtail framework
- JavaScript/TypeScript for frontend (see
package.json)
Ensure LSP servers are configured to work with these technologies.
Didn't find tool you were looking for?