---
name: lsp
description: Claude Code language-server workflow for diagnostics, definitions, references, rename safety, and post-edit checks.
---

# LSP

Use this skill when edits touch code where language-server feedback is useful.
LazyClaude ships `.lsp.json` to describe plugin-local TypeScript/JavaScript LSP
settings, and this skill uses LazyClaude LSP habit into Claude Code wording.

## First Checks

1. Identify the edited language and whether a configured server exists.
2. Run diagnostics after the edit, preferably on the changed file first.
3. If diagnostics fail because the language server is missing, report the setup
   command or controlled skip rather than inventing a pass.
4. Do not block docs-only work on language-server availability.

## Claude Code Tool Surface

When Claude Code exposes LSP tools, prefer those model-facing tools for:

- diagnostics for one file or directory
- go-to-definition before editing a referenced symbol
- find-references before rename or API removal
- document/workspace symbols for large files
- prepare-rename before rename
- apply rename only when the server validates it

If the LSP tool is not exposed, use project commands such as `npm test`,
`tsc --noEmit`, `biome check`, `eslint`, `pyright`, `ruff`, `cargo check`, or
`go test` according to the repo's stack.

## LazyClaude Defaults

The MVP `.lsp.json` declares TypeScript and JavaScript support through
`typescript-language-server`. `scripts/validate-plugin.mjs` and
`plugins/lazyclaude/bin/lazyclaude-lsp-doctor.js` should explain missing
language-server binaries as actionable setup, not as mysterious failures.

## Editing Rules

- For public API changes, inspect references before editing.
- For rename, prefer LSP rename or a structured search/replace with tests.
- For generated files, avoid direct edits unless the generator is unavailable
  and the handoff marks the file as generated.
- For prompt/markdown-only changes, LSP may not apply; use docs tests instead.

## Evidence

Record the command or tool used and the diagnostic result. Good examples:

- `npm test` passed all Node tests.
- `node scripts/validate-plugin.mjs` reported `VALIDATE_PLUGIN_PASS`.
- `lsp.diagnostics` returned no errors for `bin/lazyclaude-ai.js`.
- `typescript-language-server` missing; controlled skip documented by doctor.

## Failure Handling

Diagnostics are signals, not noise. Do not suppress them. If an LSP failure is
unrelated to the change, label it as pre-existing with the exact output and
continue only when the task can be safely completed without hiding it.
