Skip to content

Commit 59cd985

Browse files
rappdwclaude
andcommitted
Add LSP setup check to map-the-repo — detect, install, or guide user
Before running the script, the skill now checks whether language server binaries and Claude Code LSP plugins are installed for the detected languages. Offers to install missing binaries or walks the user through plugin installation. Falls back gracefully if user declines. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2fb1009 commit 59cd985

1 file changed

Lines changed: 51 additions & 8 deletions

File tree

skills/map-the-repo/SKILL.md

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,53 @@ Before running the script, build context:
2828
the language, framework, and project type
2929
- Scan the top-level directory structure to understand the layout
3030

31-
### 2. Run the Script
31+
### 2. Check LSP Setup
32+
33+
After identifying the project's languages, check whether the corresponding LSP plugins and
34+
language server binaries are installed. This dramatically improves enrichment quality —
35+
especially for non-Python languages where the script falls back to regex.
36+
37+
**Language server requirements by language:**
38+
39+
| Language | Binary | Install | Plugin |
40+
|----------|--------|---------|--------|
41+
| Python | `pyright-langserver` | `pip install pyright` | `pyright-lsp` |
42+
| TypeScript/JS | `typescript-language-server` | `npm install -g typescript-language-server typescript` | `typescript-lsp` |
43+
| Go | `gopls` | `go install golang.org/x/tools/gopls@latest` | `gopls-lsp` |
44+
| Rust | `rust-analyzer` | See [rust-analyzer.github.io](https://rust-analyzer.github.io) | `rust-analyzer-lsp` |
45+
| Java | `jdtls` | See [eclipse.org/jdtls](https://projects.eclipse.org/projects/eclipse.jdt.ls) | `jdtls-lsp` |
46+
| C/C++ | `clangd` | `apt install clangd` / `brew install llvm` | `clangd-lsp` |
47+
| Kotlin | `kotlin-language-server` | See [github.com/fwcd/kotlin-language-server](https://github.com/fwcd/kotlin-language-server) | `kotlin-lsp` |
48+
| Swift | `sourcekit-lsp` | Bundled with Xcode / Swift toolchain | `swift-lsp` |
49+
| PHP | `intelephense` | `npm install -g intelephense` | `php-lsp` |
50+
| Lua | `lua-language-server` | See [github.com/LuaLS/lua-language-server](https://github.com/LuaLS/lua-language-server) | `lua-lsp` |
51+
| C# | `csharp-ls` | `dotnet tool install -g csharp-ls` | `csharp-lsp` |
52+
53+
**Check procedure** — for each primary language detected in the repo:
54+
55+
1. Check if the binary is on PATH:
56+
```bash
57+
which pyright-langserver 2>/dev/null # example for Python
58+
```
59+
60+
2. If the binary is missing, offer to install it:
61+
> I noticed this is a Python project but `pyright` isn't installed. LSP support
62+
> gives me much better type information and cross-file analysis for enriching the docs.
63+
> Want me to install it? (`pip install pyright`)
64+
65+
3. Check if the Claude Code LSP plugin is installed by running `/plugin` commands. If the
66+
binary is present but the plugin isn't, tell the user:
67+
> `pyright` is installed but the Claude Code LSP plugin isn't. Run:
68+
> `/plugin install pyright-lsp`
69+
> Then we can continue with full code intelligence.
70+
71+
4. If the user declines or installation isn't possible, proceed without LSP — the script's
72+
AST/regex analysis plus manual code reading still produces good results.
73+
74+
Only check languages that are actually present in the repo. Don't suggest installing Go
75+
tooling for a Python-only project.
76+
77+
### 3. Run the Script
3278

3379
```bash
3480
python ${CLAUDE_PLUGIN_ROOT}/skills/map-the-repo/scripts/map.py --repo-path . --output-path ./wiki
@@ -44,11 +90,9 @@ The script generates:
4490
This is the critical step. The script produces structure — file listings, function signatures,
4591
import graphs. You provide understanding.
4692

47-
**Use LSP if available.** If the user has LSP plugins installed (e.g., `pyright-lsp`,
48-
`typescript-lsp`, `gopls-lsp`), use go-to-definition, find-references, and call hierarchies
49-
to get accurate type information and cross-file relationships. This is especially valuable for
50-
non-Python languages where the script uses regex fallback. If LSP is not available, you can
51-
still enrich effectively by reading the source files directly — it just takes more context.
93+
If LSP was set up in step 2, use go-to-definition, find-references, and call hierarchies
94+
freely as you work — they give you accurate type information and cross-file relationships
95+
that the script's static analysis may have missed.
5296

5397
Read every generated file in `wiki/docs/` and rewrite weak sections:
5498

@@ -57,8 +101,7 @@ Read every generated file in `wiki/docs/` and rewrite weak sections:
57101
Note key design decisions and their tradeoffs.
58102

59103
- **`data-flows.md`** — Add sequence diagrams for the 2-3 most important flows through the
60-
system. Explain what triggers each flow and what the end state is. Use go-to-definition
61-
and find-references to trace actual call paths.
104+
system. Explain what triggers each flow and what the end state is.
62105

63106
- **Module docs** (`modules/*.md`) — Each should read like a senior engineer wrote it after
64107
a day in the code. Explain the module's role in the system, its key abstractions, and any

0 commit comments

Comments
 (0)