Agent skill

Python Lsp

by oaustegard in oaustegard/claude-skills

Semantic Python code queries via a stdio LSP client driving pyright-langserver.

MITAuto-check passedDevelopment

Install Python Lsp

skills CLI
$ npx skills add oaustegard/claude-skills --skill python-lsp -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install oaustegard/claude-skills python-lsp --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/oaustegard/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/python-lsp .claude/skills/python-lsp && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
python-lsp
GitHub stars
150
Token cost
~1.9k tokens
SKILL.md length
671 words
Files
10 (incl. scripts)
Skills in repo
93
Repo updated
First seen
Licence
MIT

At a glance

Semantic Python code queries via a stdio LSP client driving pyright-langserver.

  • Works in 5 steps: Wait for indexing before querying.… → Don't advertise workspace.configuration… → Reap the subprocess. Use the context… → …
  • You need to follow an import to a definition
  • SKILL.md covers Setup (self-installing), Usage: CLI, Usage: library and Methods, plus 2 more sections
  • Runs Python and Shell scripts from its folder; calls python3, uv and sh

What it does

Python Lsp is an agent skill from oaustegard/claude-skills. Semantic Python code queries via a stdio LSP client driving pyright-langserver. Provides binding-resolved go-to-definition, find-references, hover types, type diagnostics, file symbol outlines, and project-wide symbol search — name resolution and type inference that tree-sitter and ripgrep cannot do. Use when you need to follow an import to a definition, find all real uses of a symbol (excluding same-named-but-unrelated ones), get an inferred type, surface type errors, outline a file, or search symbols across a…

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 13 other files, including scripts (for example `CHANGELOG.md`, `scripts/bootstrap.sh` and `scripts/lsp_client.py`).

It sits in Development, covering Codebase onboarding. It works with Python. The repository describes itself as: My collection of Claude skills. The licence is MIT.

When your agent uses it

  • You need to follow an import to a definition
  • Find all real uses of a symbol (excluding same-named-but-unrelated ones)
  • Get an inferred type
  • Surface type errors

Example prompts

  • “go to definition”
  • “find references”
  • “what type is”
  • “/python-lsp”

Requirements

  • Python 3
  • Node.js
  • A Bash shell

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Wait for indexing before querying. Querying mid-index returns empty
  2. Don't advertise workspace.configuration or workspace.workspaceFolders.
  3. Reap the subprocess. Use the context manager (or call stop()) so
  4. Open the files you query. Queries auto-did_open their target file, but
  5. Root at the project, not the sub-package. pyright resolves absolute

What it can do on your machine

Read from SKILL.md and the folder at commit 559a6cd. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (Python and Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • python3
    • uv
    • sh

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use uv, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Python Lsp loads about 1.9k tokens when it runs. Until then it costs about 176 tokens; SKILL.md has 671 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~176
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from oaustegard/claude-skills at commit 559a6cd, republished under its MIT licence (© oaustegard). 671 words, ~1,926 tokens.

Download SKILL.mdSave it as .claude/skills/python-lsp/SKILL.md (or your agent's skills folder). This skill also uses 9 other files; get the full folder from GitHub.
name
python-lsp
description
Semantic Python code queries via a stdio LSP client driving pyright-langserver. Provides binding-resolved go-to-definition, find-references, hover types, type diagnostics, file symbol outlines, and project-wide symbol search — name resolution and type inference that tree-sitter and ripgrep cannot do. Use when you need to follow an import to a definition, find all real uses of a symbol (excluding same-named-but-unrelated ones), get an inferred type, surface type errors, outline a file, or search symbols across a project. Triggers on "go to definition", "find references", "what type is", "resolve this symbol", "symbol outline", "find symbol in project", "pyright", "type-check this file".
metadata.version
0.3.0

python-lsp

A thin, dependency-free Python client that owns the LSP lifecycle against pyright-langserver --stdio and exposes high-value semantic queries.

Why, over tree-sitter / ripgrep: tree-sitter gives a CST — structural queries, call-site enumeration by name. It cannot do name resolution, type inference, or cross-file binding. ripgrep matches text, so it false-positives on shadowed / same-named symbols. pyright resolves bindings. This client is that semantic overlay.

Setup (self-installing)

The client bootstraps pyright on first use. Run the bootstrap explicitly, or let LSPClient do it via ensure_pyright():

sh
sh /mnt/skills/user/python-lsp/scripts/bootstrap.sh
# or, equivalently, the one-liner it wraps:
command -v pyright-langserver >/dev/null || uv tool install pyright

pyright wheels vendor the langserver JS bundle and run it on system node — no npm install, no separate fetch when node is present. Measured cold (caches wiped): uv tool install pyright ~0.7s, first working server ~1.8s total; warm sub-second.

Node prerequisite. The clean path assumes system node (v18+) is present. With no node, pyright-python falls back to downloading node from nodejs.org, which may be blocked in locked-down containers. The bootstrap detects node and fails loudly (exit 1, clear message) rather than hanging.

Usage: CLI

bash
LSP=/mnt/skills/user/python-lsp/scripts/lsp_client.py

python3 $LSP bootstrap                              # ensure pyright installed
python3 $LSP <root> definition  <file> <line> <col>
python3 $LSP <root> references  <file> <line> <col>
python3 $LSP <root> hover       <file> <line> <col>
python3 $LSP <root> diagnostics <file>
python3 $LSP <root> symbols     <file>             # documentSymbol outline
python3 $LSP <root> wsymbols    <query>            # workspace/symbol search

Positions are zero-based line/character (LSP spec). <file> is relative to <root> or absolute.

Usage: library

The scripts/ module lands on the boot .pth, so it is importable directly.

python
import sys; sys.path.insert(0, "/mnt/skills/user/python-lsp/scripts")
from lsp_client import LSPClient

with LSPClient("/path/to/repo") as c:        # context manager reaps the subprocess
    c.open_all("pkg/service.py", "pkg/models.py")
    c.wait_for_index()                       # REQUIRED before querying — see below
    defs  = c.definition("pkg/service.py", 4, 8)   # -> [Location], follows imports
    refs  = c.references("pkg/models.py", 8, 4)     # -> [Location], binding-resolved
    typ   = c.hover("pkg/service.py", 4, 4)         # -> "(variable) u: User"
    diags = c.diagnostics("pkg/bad.py")             # -> [diagnostic dicts]
    outln = c.document_symbols("pkg/models.py")     # -> [SymbolInfo], file outline
    hits  = c.workspace_symbols("User")             # -> [SymbolInfo], project-wide

Location has .path, .start_line, .start_char, .end_line, .end_char (all zero-based) and .as_dict(). Convert 1-based UI input with Position.from_one_based(line, col).

The root you pass is split into two roles. Relative <file> arguments resolve against it (call that the scope), but pyright is rooted at the enclosing project root — by default LSPClient climbs out of any package the scope sits inside (every ancestor with an __init__.py) via find_project_root. This is what makes a query scoped to a sub-package (scipy/optimize) still resolve the project's own absolute imports (from scipy.optimize._x import Y); without it, references silently undercount — same blindness as a text grep, opposite direction. The promotion is announced on stderr. Pass auto_root=False to pin pyright at the scope verbatim.

Methods

MethodReturnsNotes
definition(file, line, col)list[Location]Go-to-definition across files/imports.
references(file, line, col)list[Location]Binding-resolved — the win over ripgrep. Excludes same-named, unrelated symbols.
hover(file, line, col)str | NoneInferred type / signature string.
diagnostics(file)list[dict]pyright type/error diagnostics for the file.
document_symbols(file)list[SymbolInfo]One file's outline (classes/functions/methods); nesting via .container.
workspace_symbols(query)list[SymbolInfo]Project-wide fuzzy symbol search. Empty query = every symbol (expensive).

SymbolInfo has .name, .kind (int), .kind_name (e.g. "Class"), .location (a Location), .container, and .as_dict().

Show full SKILL.md (287 more words)Show less

The lifecycle gotchas (the parts that bite)

  1. Wait for indexing before querying. Querying mid-index returns empty results — the most common silent failure. wait_for_index() blocks on pyright's $/progress begin/end cycle (with a diagnostics-arrival fallback). Always call it after did_open / open_all and before any query.
  2. Don't advertise workspace.configuration or workspace.workspaceFolders. If the client claims either capability, pyright defers all analysis until the corresponding negotiation completes — the server starts its service instance and then goes silent (no diagnostics, no progress, queries hang). start() advertises neither, so pyright uses its defaults and analyzes open files immediately — no didChangeConfiguration nudge needed. Relevant if you reimplement the lifecycle or add capabilities. (Bisected against the fixture; workspace.symbol is safe to advertise.)
  3. Reap the subprocess. Use the context manager (or call stop()) so sessions don't leak pyright-langserver processes. stop() sends shutdown + exit, then waits/terminates/kills as needed.
  4. Open the files you query. Queries auto-did_open their target file, but for cross-file references open all relevant files first so pyright has built their models.
  5. Root at the project, not the sub-package. pyright resolves absolute intra-project imports only when rooted where the top-level package is importable. Rooted at a sub-package, those imports fail and references undercount with no error. LSPClient auto-detects this (climbs out of the enclosing package; see find_project_root) and prints the promotion to stderr; auto_root=False opts out. This was a live silent-undercount bug: --refs ScalarFunction over scipy/optimize returned 3 references rooted at the sub-package vs 30 rooted at the project root.

Tests

bash
cd /mnt/skills/user/python-lsp
python3 -m pytest tests/test_lsp_client.py -v

Round-trips against tests/fixture/ (a small multi-file package): definition follows an import, references excludes an unrelated same-named symbol, hover returns an inferred type, diagnostics flags an intentional type error, the indexing-wait is verified deterministic, and subprocess cleanup is checked for orphans.

© oaustegard, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 9 other files (scripts) in python-lsp of oaustegard/claude-skills.

  • SKILL.md
  • CHANGELOG.md
  • scripts/bootstrap.sh
  • scripts/lsp_client.py
  • tests/fixture/bad.py
  • tests/fixture/pkg/__init__.py
  • tests/fixture/pkg/models.py
  • tests/fixture/pkg/other.py
  • tests/fixture/pkg/service.py
  • tests/test_lsp_client.py

Open the folder on GitHubat commit 559a6cd

Compare with similar skills

Python Lsp next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Python Lsp compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Python Lsp this skilloaustegard/claude-skills150—~1.9kAutomated safety check: PassMIT
Code Graph Mermaid Diagramstrailofbits/skills7.4k—~1.7kAutomated safety check: PassCC-BY-SA-4.0
Acquire Codebase Knowledgegithub/awesome-copilot40k1 repos~2.3kAutomated safety check: PassMIT
BiSheng Approval Module Referencedataelement/bisheng12k—~4kAutomated safety check: PassApache-2.0
Jgrepkeltokhy/jgrep136—~1.1kAutomated safety check: PassMIT
Local File and Code Searchtaxueseek/argo184—~1.1kAutomated safety check: PassMIT

Similar skills

  • Code Graph Mermaid Diagrams

    trailofbits/skills

    Official

    Generates Mermaid diagrams from Trailmark code graphs, including call graphs, class hierarchies, module dependency maps, complexity heatmaps and attack surface data flows.

    7.4k GitHub stars~1.7k tokensUpdated 5 days ago
    DevelopmentAuto-check passed
  • Acquire Codebase Knowledge

    github/awesome-copilot

    Official

    Maps an unfamiliar codebase into seven evidence-backed documents in docs/codebase/, using a scan script and templates, for onboarding or architecture write-ups.

    40k GitHub starsUsed in 1 repo~2.3k tokens
    DevelopmentAuto-check passed
  • Maps BiSheng's approval-center architecture to exact service files and methods, so a change to approval logic can be located without searching the whole repo.

    12k GitHub stars~4k tokensUpdated 6 days ago
    DevelopmentAuto-check passed
  • Jgrep

    keltokhy/jgrep

    Filter text, records, code functions, or complete diff hunks by a plain-English description using Jev.

    136 GitHub stars~1.1k tokensUpdated 8 days ago
    DevelopmentAuto-check passed
  • Searches local files and code through one script, seek.py, that picks between rg, fd and macOS Spotlight and works in three layers: locate, context, close reading.

    184 GitHub stars~1.1k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Burla Internals Deep Dive

    Burla-Cloud/burla

    Reference for Burla internals: how a remote_parallel_map job flows between services, how clusters and nodes are managed, and where the head keeps its state.

    263 GitHub stars~2.4k tokensUpdated 15 days ago
    DevelopmentAuto-check passed

More from oaustegard/claude-skills

All 93 skills in this repo
  • Bluesky Zeitgeist Sampler

    oaustegard/claude-skills

    Deprecated sampler that captures short windows of the Bluesky firehose, clusters trending terms and builds an HTML report; replaced by the browsing-bluesky skill.

    150 GitHub starsUsed in 1 repo~1.4k tokens
    Auto-check passed
  • Vega-Lite Interactive Charts

    oaustegard/claude-skills

    Builds interactive Vega-Lite charts from uploaded data: analyzes the fields, picks five to ten fitting chart types, and produces a React artifact with the data embedded inline.

    150 GitHub stars~2.1k tokensUpdated 5 days ago
    Auto-check passed
  • Single-File HTML Composer

    oaustegard/claude-skills

    Builds self-contained single-file HTML pages such as reports, decks, postmortems, flowcharts and prototypes from a small spec using a bundled Python composer and templates.

    150 GitHub stars~3.2k tokensUpdated 5 days ago
    Auto-check passed
  • Declauding

    oaustegard/claude-skills

    Rewrites model-sounding prose into plain technical writing and checks that every claim survives, for PR text, docs, commit messages and similar drafts.

    150 GitHub stars~5.1k tokensUpdated 5 days ago
    Auto-check passed
  • Forecasting Reverso

    oaustegard/claude-skills

    Zero-shot univariate time series forecasting using the Reverso foundation model (NumPy/Numba CPU-only inference).

    150 GitHub starsUsed in 1 repo~1.5k tokens
    Auto-check passed
  • Preact Developer

    oaustegard/claude-skills

    Guides building standards-based Preact apps with native-first choices, HTM syntax, import maps and vendored ESM, from single-file demos to larger builds.

    150 GitHub stars~4.6k tokensUpdated 5 days ago
    Auto-check passed

Works with

Categories

Questions about Python Lsp

What does Python Lsp do?

Semantic Python code queries via a stdio LSP client driving pyright-langserver. Python Lsp is an agent skill from oaustegard/claude-skills. Semantic Python code queries via a stdio LSP client driving pyright-langserver.

When should I use Python Lsp?

Python Lsp fits situations like: you need to follow an import to a definition; find all real uses of a symbol (excluding same-named-but-unrelated ones); get an inferred type; surface type errors.

How do I install Python Lsp in Claude Code?

Run `npx skills add oaustegard/claude-skills --skill python-lsp -a claude-code`. Or copy the skill folder (python-lsp in oaustegard/claude-skills) into .claude/skills/python-lsp in your project. Claude Code loads it when a task matches its description.

How do I install Python Lsp in Codex?

Run `npx skills add oaustegard/claude-skills --skill python-lsp -a codex`. Or copy the skill folder (python-lsp in oaustegard/claude-skills) into .agents/skills/python-lsp in your project. Codex loads it when a task matches its description.

Can I use Python Lsp in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add oaustegard/claude-skills --skill python-lsp -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/python-lsp, .gemini/skills/python-lsp, .github/skills/python-lsp and .opencode/skills/python-lsp in your project.

What does Python Lsp need to run?

Going by SKILL.md and its folder, Python Lsp needs Python and a shell for the scripts in its folder and the command-line tools its instructions call (python3, uv and sh). Our summary lists: Python 3; Node.js; A Bash shell.

Does Python Lsp access the network?

SKILL.md contains no URLs. Its commands use uv, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Python Lsp safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Python Lsp use?

Python Lsp is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Python Lsp use?

About 1.9k tokens (SKILL.md is roughly 7.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Python Lsp?

Skills that share tags, products or a category with Python Lsp: Code Graph Mermaid Diagrams (trailofbits/skills, 7.4k stars), Acquire Codebase Knowledge (github/awesome-copilot, 40k stars), BiSheng Approval Module Reference (dataelement/bisheng, 12k stars) and Jgrep (keltokhy/jgrep, 136 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Python Lsp?

oaustegard (a GitHub user) maintains it in oaustegard/claude-skills, which has 150 GitHub stars. The repository holds 93 skills in this directory. The repository was last updated on October 2, 2026.

Source: oaustegard/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.