lsp-code-analysis
Skill3 starsChanged 3 months agoMITView on GitHub
Semantic code analysis via LSP. Navigate code (definitions, references, implementations), search symbols, get file outlines, and safely rename symbols. Use when exploring unfamiliar codebases, tracing call chains, or performing structural code changes. Prefer over grep/read for any question about code structure. Supports Python, Rust, TypeScript/JS, Go, Java via language servers already installed by Mason.
In this repository86 other files it gives its agents.
- AGENTS.mdAGENTS.md
- adrSkill
- adzic-bddSkill
- agent-md-refactorSkill
- agent-muxSkill
- agent-role-impersonatorSkill
- agilquest-reservationsSkill
- ai-text-humanizerSkill
- architecture-decision-recordsSkill
- ast-grepSkill
- atacSkill
- aws-cliSkill
- bart-adversarial-reviewerSkill
- bddSkill
- branch-doctorSkill
- c4-architectureSkill
- c4Skill
- claude-sub-agentSkill
- codemap-config-setupSkill
- codemap-exploreSkill
- codemap-handoffSkill
- codemap-hub-safetySkill
- codemapSkill
- commitSkill
- copilot-sub-agentSkill
- daily-standupSkill
- daily-statusSkill
- debugSkill
- design-thinkingSkill
- doctorSkill
- docx-word-processorSkill
- farley-tddSkill
- forensicsSkill
- gemini-sub-agentSkill
- git-commit-formatterSkill
- git-forensicsSkill
- github-actions-permissionsSkill
- github-cliSkill
- git-repo-discoverySkill
- git-safety-guardrailsSkill
- harness-idpSkill
- humanizeSkill
- iteration-plannerSkill
- jira-issue-managerSkill
- justfile-assistantSkill
- kiro-sub-agentSkill
- lessons-learnedSkill
- lessonsSkill
- lisa-planning-agentSkill
- lovejoy-release-agentSkill
- macro-to-microSkill
- marge-product-agentSkill
- meeting-notesSkill
- mermaid-diagram-generatorSkill
- modern-cli-overridesSkill
- native-web-searchSkill
- obsidian-notetakerSkill
- outlook-headlessSkill
- pdf-document-processorSkill
- pi-sub-agentSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 44
All commands accept --project DIR.
- Distinctive: line 87
Read a single function or class without opening the whole file.
- Distinctive: line 98
Use when you don't know which file a symbol is in.
- Distinctive: line 113
Check that a scope or find pattern resolves before running a heavier command.
- Distinctive: line 124
Always preview before executing.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
LSP Code Analysis
Compiler-accurate code navigation using language servers from Mason
(~/.local/share/nvim/mason/bin). No separate server installation.
Setup (run once)
export PATH="$HOME/.local/share/nvim/mason/bin:$PATH"
bash scripts/lsp-setup.shRe-run after uv tool upgrade lsp-cli. The script is idempotent.
Targeting syntax
Most commands take FILE then optional --scope and --find:
--scope MyClass # class by name
--scope MyClass.my_method # method by dotted path (most precise)
--scope 42 # line number
--scope 10,50 # line range
--scope MyClass.run --find "self.<|>logger" # position within a symbolThe <|> marker pins the cursor to the character immediately to its right —
use it inside --find when multiple tokens are on the line and you need to
distinguish between them.
Commands
All commands accept --project DIR. Without it the project root is inferred
by walking up for pyproject.toml, Cargo.toml, go.mod, package.json.
lsp outline — file structure at a glance
Get the symbol tree without reading the file. Use this before read.
lsp outline src/models.py
lsp outline src/models.py --symbol MyClass # narrow to one classlsp definition — jump to where a symbol is defined
lsp definition src/api.py --scope UserService.get_user
lsp definition src/api.py --scope 42 --find "<|>config" # variable on line 42
lsp definition src/api.py --scope 42 --find "<|>user" --mode type_definitionModes: definition (default), declaration, type_definition
lsp reference — find all usages
lsp reference src/models.py --scope User
lsp reference src/models.py --scope User --max-items 50Note:
--mode implementationsrequires the language server to supporttextDocument/implementation. pyright does not — usereferencesmode and filter the results, orsearch --kinds classto find concrete subclasses.
lsp symbol — full source of a symbol
Read a single function or class without opening the whole file.
lsp symbol src/models.py --scope User.validate
lsp symbol src/models.py --scope 15 # symbol containing line 15lsp search — workspace-wide symbol lookup
Use when you don't know which file a symbol is in.
lsp search "UserModel"
lsp search "validate" --kinds function --max-items 20
lsp search "Config" --kinds classUseful --kinds values: function, method, class, interface,
variable, constant, module.
lsp locate — verify a target exists before acting
Check that a scope or find pattern resolves before running a heavier command.
lsp locate src/models.py --scope User.validate
lsp locate src/models.py --scope 42 --find "<|>process_data"lsp rename — safe workspace-wide rename
Always preview before executing.
# Step 1: preview — shows every file and line that will change
lsp rename preview src/models.py new_name --scope OldClassName
# Step 2: execute using the ID from the preview
lsp rename execute <rename_id>
# Exclude paths from the rename
lsp rename execute <rename_id> --exclude tests/ --exclude legacy/Never run execute without reviewing preview output first.
Exploration workflow
For an unfamiliar file or subsystem:
# 1. Map the structure — avoid reading the full file
lsp outline src/service.py
# 2. Get the contract of something interesting
lsp symbol src/service.py --scope UserService.process
# 3. Find where it's called from
lsp reference src/service.py --scope UserService.process
# 4. Jump to a dependency
lsp definition src/service.py --scope UserService.process --find "<|>validator"Tool selection
| Task | Skip | Use |
| Find a function definition | grep -r def foo | lsp search "foo" --kinds function |
| Find all call sites | grep -rn foo | lsp reference file --scope foo |
| Understand a file | read file | lsp outline file |
| Read one method | read file | lsp symbol file --scope Class.method |
| Get type/docstring | read file | lsp symbol file --scope symbol |
| Rename across codebase | sed -i | lsp rename preview then execute |
Performance
- First call: ~3s (manager + pyright start)
- Subsequent calls: ~2s (manager warm)
- Config at
~/.config/lsp-cli/config.toml:warmup_time=0,idle_timeout=30
Supported languages (via Mason)
| Language | Server |
| Python | pyright-langserver |
| Rust | rust-analyzer |
| TypeScript/JS | typescript-language-server |
| Go | gopls |
What doesn't work (yet)
lsp doc— not implemented in this version of lsp-cli; uselsp symbolinstead--mode implementationswith pyright — pyright doesn't supporttextDocument/implementation; uselsp referenceorlsp search --kinds class- Upstream bugs patched by
lsp-setup.sh— seereferences/upstream-patches.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

