xiaohongshu
xiaohongshu
lsp-first
LSP 優先開發策略工具。用於:(1) 查詢 LSP 操作指令, (2) 配置新語言 LSP 插件, (3) LSP vs MCP 工具選擇決策, (4) 自建 LSP 插件指南
Full skill instructions
LSP 能解決的問題必須優先使用 LSP
| 優勢 | 說明 | 效益 |
|---|---|---|
| 效能 | ~50ms vs ~45 秒 | 900x 加速 |
| Token 效率 | 結構化資料輸出 | 降低 API 成本 |
| 語意精準 | 語言伺服器分析 | 非文字比對 |
Session 啟動時自動執行 LSP 環境檢查
基本 LSP(所有專案必備)
語言特定 LSP(根據專案類型)
| 平台 | 安裝工具 |
|---|---|
| macOS | Homebrew, npm |
| Linux | apt/dnf/pacman, Homebrew, npm |
| Windows | winget, scoop, npm |
.claude/hooks/lsp-environment-check.py.claude/hooks/lsp-check-config.json.claude/hooks/startup-check-hook.sh (步驟 6.6)用途:找到符號的定義位置
使用場景:
範例:
LSP(operation="goToDefinition", filePath="lib/main.dart", line=15, character=10)
用途:找出所有引用某符號的位置
使用場景:
範例:
LSP(operation="findReferences", filePath="lib/domains/book/book.dart", line=26, character=6)
用途:取得符號的型別資訊和文件
使用場景:
Dart MCP 替代:
mcp__dart__hover(uri="file:///path/to/file.dart", line=10, column=5)
用途:列出檔案中所有符號
使用場景:
用途:跨檔案搜尋符號
使用場景:
Dart MCP 替代:
mcp__dart__resolve_workspace_symbol(query="ClassName")
用途:找出介面或抽象類別的所有實作
使用場景:
用途:準備呼叫層級分析
使用場景:
用途:找出誰呼叫了這個函式
使用場景:
用途:找出這個函式呼叫了誰
使用場景:
需求分析:
├─ 需要呼叫層級分析? → LSP (incomingCalls / outgoingCalls)
├─ 需要查找介面實作? → LSP (goToImplementation)
├─ 需要符號定義? → LSP (goToDefinition) / Dart MCP
├─ 需要引用追蹤? → LSP (findReferences) / Serena
├─ 需要 Hover 資訊? → Dart MCP (mcp__dart__hover)
├─ 需要工作區搜尋? → Dart MCP (mcp__dart__resolve_workspace_symbol)
├─ 需要執行測試? → Dart MCP (mcp__dart__run_tests)
├─ 需要 Hot Reload? → Dart MCP (mcp__dart__hot_reload)
├─ 需要精準符號編輯? → Serena (replace_symbol_body)
└─ LSP 不可用? → Serena (備援方案)
| 工具 | 功能 | 對應 LSP 操作 |
|---|---|---|
mcp__dart__hover | 懸停資訊 | hover |
mcp__dart__resolve_workspace_symbol | 工作區搜尋 | workspaceSymbol |
mcp__dart__signature_help | 簽名提示 | signatureHelp |
mcp__dart__analyze_files | 專案分析 | diagnostics |
| 工具 | 功能 | 對應 LSP 操作 |
|---|---|---|
mcp__serena__get_symbols_overview | 符號概覽 | documentSymbol |
mcp__serena__find_symbol | 符號查找 | goToDefinition |
mcp__serena__find_referencing_symbols | 引用追蹤 | findReferences |
| 語言 | LSP 伺服器 | 插件位置 |
|---|---|---|
| Dart/Flutter | dart language-server | .claude/plugins/dart-lsp/ |
| Markdown | marksman | .claude/plugins/marksman-lsp/ |
| YAML | yaml-language-server | .claude/plugins/yaml-lsp/ |
# 新增插件市場
/plugin marketplace add boostvolt/claude-code-lsps
| 語言 | LSP 伺服器 | 安裝指令 |
|---|---|---|
| Dart/Flutter | dart-analyzer | /plugin install dart-analyzer@claude-code-lsps |
| TypeScript/JavaScript | vtsls | /plugin install vtsls@claude-code-lsps |
| Python | pyright | /plugin install pyright@claude-code-lsps |
| Go | gopls | /plugin install gopls@claude-code-lsps |
| Rust | rust-analyzer | /plugin install rust-analyzer@claude-code-lsps |
| Java | jdtls | /plugin install jdtls@claude-code-lsps |
| C/C++ | clangd | /plugin install clangd@claude-code-lsps |
| C# | omnisharp | /plugin install omnisharp@claude-code-lsps |
| PHP | intelephense | /plugin install intelephense@claude-code-lsps |
| Kotlin | kotlin | /plugin install kotlin@claude-code-lsps |
| Ruby | solargraph | /plugin install solargraph@claude-code-lsps |
| HTML/CSS | vscode-langservers | /plugin install html-css@claude-code-lsps |
.claude/plugins/<plugin-name>/
├── .claude-plugin/
│ └── plugin.json # 插件清單
└── .lsp.json # LSP 配置
{
"name": "<plugin-name>",
"version": "1.0.0",
"description": "LSP plugin for <language>",
"author": "Your Name"
}
{
"<language-id>": {
"command": "<lsp-server-command>",
"args": ["--stdio"],
"extensionToLanguage": {
".<ext>": "<language-id>"
}
}
}
plugin.json:
{
"name": "marksman-lsp",
"version": "1.0.0",
"description": "Marksman Markdown LSP for Claude Code",
"author": "Project Team"
}
.lsp.json:
{
"markdown": {
"command": "marksman",
"args": ["server"],
"extensionToLanguage": {
".md": "markdown",
".markdown": "markdown"
}
}
}
| 操作 | LSP | 傳統方法 | 效能提升 |
|---|---|---|---|
| 查找引用 | ~50ms | ~45 秒(grep) | 900x |
| 跳轉定義 | ~10ms | ~5 秒(搜尋) | 500x |
| 符號概覽 | ~20ms | ~10 秒(解析) | 500x |
| 呼叫層級 | ~100ms | 無法自動化 | ∞ |
| 工具 | 輸出類型 | 預估 Token |
|---|---|---|
| LSP findReferences | 結構化位置列表 | ~100-500 |
| Dart MCP hover | 結構化資訊 | ~200-500 |
| Serena find_referencing_symbols | 完整上下文 | ~2000-5000 |
| Grep 搜尋 | 完整行內容 | ~3000-10000 |
可能原因:
解決方案:
# 1. 確認 LSP 伺服器已安裝
which marksman
which yaml-language-server
# 2. 啟用 LSP 功能(如需要)
export ENABLE_LSP_TOOL=1
# 3. 執行 LSP 環境檢查
./.claude/hooks/lsp-environment-check.py
可能原因:
解決方案:
檢查清單:
.lsp.json 格式正確extensionToLanguage 對應正確/ticket-create - Atomic Ticket 建立/ticket-track - Ticket 狀態追蹤/startup-check - Session 啟動檢查.claude/hooks/lsp-environment-check.py.claude/hooks/lsp-check-config.json.claude/settings.local.jsonxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
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...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
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...
Display project status, active tracks, and next actions
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.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience