lsp-integration
LSP server detection, installation, and Claude Code integration — auto-invoke when setting up a new project, running /cc-setup, or configuring IDE tooling
What this skill does
# LSP Integration — Phase 7 of /cc-setup
LSP (Language Server Protocol) servers power real-time diagnostics, type checking, and formatting. Claude Code integrates with LSP through PostToolUse hooks to catch errors immediately after writing files.
## 18-Server Detection Matrix
| Language | LSP Server | Install Command | Detect Signal |
|----------|-----------|-----------------|---------------|
| TypeScript/JS | `typescript-language-server` | `npm i -g typescript-language-server typescript` | `tsconfig.json`, `package.json` |
| Python (strict) | `pyright` | `npm i -g pyright` | `pyproject.toml`, `requirements.txt` |
| Python (general) | `pylsp` | `pip install python-lsp-server` | `.py` files |
| Go | `gopls` | `go install golang.org/x/tools/gopls@latest` | `go.mod` |
| Rust | `rust-analyzer` | `rustup component add rust-analyzer` | `Cargo.toml` |
| Java | `jdtls` | Eclipse JDT LS (via Mason/LspInstall) | `pom.xml`, `build.gradle` |
| C# | `omnisharp` | `dotnet tool install -g csharp-ls` | `*.csproj`, `*.sln` |
| Ruby | `solargraph` | `gem install solargraph` | `Gemfile` |
| PHP | `intelephense` | `npm i -g intelephense` | `composer.json` |
| Elixir | `elixir-ls` | `mix archive.install hex elixir_ls` | `mix.exs` |
| Svelte | `svelte-language-server` | `npm i -g svelte-language-server` | `svelte.config.*` |
| Vue | `vue-language-server` | `npm i -g @vue/language-server` | `nuxt.config.*` |
| Tailwind CSS | `tailwindcss-language-server` | `npm i -g @tailwindcss/language-server` | `tailwind.config.*` |
| GraphQL | `graphql-language-service-cli` | `npm i -g graphql-language-service-cli` | `*.graphql`, `schema.gql` |
| Prisma | `prisma-language-server` | `npm i -g @prisma/language-server` | `prisma/` directory |
| YAML | `yaml-language-server` | `npm i -g yaml-language-server` | `.yaml`, `.yml` files |
| Dockerfile | `dockerfile-language-server` | `npm i -g dockerfile-language-server-nodejs` | `Dockerfile` |
| Bash | `bash-language-server` | `npm i -g bash-language-server` | `.sh` files, `.claude/hooks/` |
## Detection Script
Run during Phase 1 of `/cc-setup` to identify which LSPs to recommend:
```bash
#!/usr/bin/env bash
# Detect and report LSP recommendations for current project
check_lsp() {
local name="$1" signal="$2" install="$3"
if ls $signal 2>/dev/null | head -1 | grep -q .; then
if command -v "$(echo "$name" | cut -d/ -f1)" &>/dev/null; then
echo " OK: $name"
else
echo " MISSING: $name — install: $install"
fi
fi
}
echo "=== LSP Detection ==="
check_lsp "typescript-language-server" "tsconfig.json package.json" "npm i -g typescript-language-server typescript"
check_lsp "pyright" "pyproject.toml requirements.txt" "npm i -g pyright"
check_lsp "gopls" "go.mod" "go install golang.org/x/tools/gopls@latest"
check_lsp "rust-analyzer" "Cargo.toml" "rustup component add rust-analyzer"
check_lsp "solargraph" "Gemfile" "gem install solargraph"
check_lsp "svelte-language-server" "svelte.config.*" "npm i -g svelte-language-server"
check_lsp "tailwindcss-language-server" "tailwind.config.*" "npm i -g @tailwindcss/language-server"
check_lsp "prisma-language-server" "prisma/" "npm i -g @prisma/language-server"
check_lsp "bash-language-server" ".claude/hooks/" "npm i -g bash-language-server"
```
## Claude Code Hook Integration
Claude Code doesn't use LSP directly, but you can use PostToolUse hooks to run LSP-powered diagnostics after file writes.
### TypeScript — PostToolUse diagnostics hook
```bash
#!/usr/bin/env bash
# .claude/hooks/auto-typecheck.sh
# Registered on: PostToolUse (Write|Edit matcher on *.ts, *.tsx)
INPUT=$(head -c 65536)
FILE=$(printf '%s' "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [[ "$FILE" != *.ts ]] && [[ "$FILE" != *.tsx ]]; then
echo '{"decision": "approve"}'
exit 0
fi
# Run whole-project check filtered to changed file — single-file mode ignores tsconfig.json
ERRORS=$(npx tsc --noEmit 2>&1 | grep -F "$(basename "$FILE")" | head -5)
if [ -n "$ERRORS" ]; then
echo "TypeScript errors in $(basename "$FILE"):" >&2
echo "$ERRORS" >&2
fi
echo '{"decision": "approve"}'
```
### Python — pyright diagnostics hook
```bash
#!/usr/bin/env bash
# Registered on: PostToolUse (Write|Edit matcher on *.py)
INPUT=$(head -c 65536)
FILE=$(printf '%s' "$INPUT" | jq -r '.tool_input.file_path // ""')
if [[ "$FILE" != *.py ]]; then
echo '{"decision": "approve"}'
exit 0
fi
ERRORS=$(pyright "$FILE" 2>&1 | grep -E "error:" | head -5)
if [ -n "$ERRORS" ]; then
echo "Pyright errors:" >&2
echo "$ERRORS" >&2
fi
echo '{"decision": "approve"}'
```
### Rust — cargo check hook
```bash
#!/usr/bin/env bash
# Registered on: PostToolUse (Write|Edit matcher on *.rs)
INPUT=$(head -c 65536)
FILE=$(printf '%s' "$INPUT" | jq -r '.tool_input.file_path // ""')
if [[ "$FILE" != *.rs ]]; then
echo '{"decision": "approve"}'
exit 0
fi
cargo check 2>&1 | grep -E "^error" | head -10 >&2
echo '{"decision": "approve"}'
```
## settings.json Hook Registration
```json
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "bash .claude/hooks/auto-typecheck.sh"
}
]
}
]
}
}
```
## Why LSP Integration Matters
- **Immediate feedback**: Errors surface right after Claude writes a file, not at build time
- **Type-safe edits**: TypeScript errors caught before Claude attempts to run tests
- **Batch diagnostics**: Run `tsc --noEmit` across the whole project to catch cross-file breakage
- **Cost savings**: Catching errors early avoids multiple round-trips of write → test → fix
## LSP vs Built-in IDE Diagnostics
Claude Code has a built-in `LSP` tool (via `mcp__ide__getDiagnostics`) when running in VS Code or JetBrains IDE extensions. The hook approach above is for CLI usage where no IDE is attached.
| Context | Diagnostics Source |
|---------|-------------------|
| VS Code extension | `mcp__ide__getDiagnostics` (built-in) |
| JetBrains extension | `mcp__ide__getDiagnostics` (built-in) |
| CLI (terminal) | PostToolUse hook → `tsc --noEmit` / `pyright` |
| CI/CD headless | PostToolUse hook → LSP CLI tools |
## Cost Note
LSP installation is one-time. The diagnostics hooks add ~100ms per file write, which is negligible vs the cost of a missed type error causing a failed test run (which requires another full turn).
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.