ty
FreeNo executable scriptsNot checkedChecks Python code for type errors with ty, Astral's fast type checker and language server written in Rust. Use when a user asks to type check a Python…
by TerminalSkills★ 221 GitHub starsAbout this skill
ty — fast Python type checker and language server
Overview
ty is a static type checker for Python and a language server, made by Astral (the authors of uv and Ruff). The command line reports type errors such as calling a method on a value that may be None, or assigning an int to a str variable. The same binary runs as a language server for editors.
ty uses 0.0.x versions. Its own README warns that diagnostics and behavior can change between any two releases, so pin the version in projects and CI. The commands below were run against ty 0.0.91.
Instructions
Install
Prefer a project dependency so every developer and CI job uses the same version:
uv add --dev ty # project dev dependency, run with: uv run ty check
uv tool install ty@latest # global tool
pipx install ty # global, without uv
pip install ty # into the active environment
uvx ty check # one-off run, nothing installed
Check the install with ty --version. Upgrading: uv lock --upgrade-package ty, uv tool upgrade ty or pipx upgrade ty.
Run a check
ty check # whole project, from the current directory
ty check src tests/test_cart.py # specific files or directories
ty check --project services/billing # run for a project in a subdirectory
ty check --watch # re-check when files change
Exit code is 1 when there are errors and 0 when clean. Warnings do not fail the run unless --error-on-warning is set.
ty needs to see the project's virtual environment to resolve third-party imports. It finds .venv (and an activated environment) by itself. For any other location, pass it:
ty check --python /srv/venvs/billing # a venv directory or interpreter
ty check --python-version 3.12 # target version for syntax and stdlib types
ty check --extra-search-path vendor/ # extra module roots
If ty reports unresolved-import for packages that are installed, the environment was not found: pass --python.
Configure
Put settings in pyproject.toml under [tool.ty], or in a ty.toml file (same keys without the tool. prefix). Command-line options win over files.
[tool.ty.environment]
python-version = "3.12"
root = ["./src"]
[tool.ty.src]
exclude = ["build/", "migrations/"]
[tool.ty.rules]
possibly-missing-attribute = "warn"
unused-ignore-comment = "warn"
tool.ty.overrides
include = ["tests/**"]
[tool.ty.overrides.rules]
invalid-assignment = "ignore"
environment.python-version: if absent, ty readsproject.requires-python, then the environment's Python.rules: each rule is"error","warn"or"ignore". List names and defaults withty explain ruleand read one withty explain rule invalid-assignment.overrides: change rules for file globs, for example looser rules in tests.- One-off rule level on the command line:
ty check --error possibly-missing-attribute --ignore unused-ignore-comment.
Suppress diagnostics
Add a comment on the offending line, naming the rule:
price = find(items, "A1").price_cents # ty: ignore[unresolved-attribute]
To baseline a legacy code base, let ty write the comments for every current error, then review the diff:
ty check --add-ignore
After that ty check passes, and new errors fail. Enable unused-ignore-comment = "warn" so stale ignores are reported once the code is fixed. # type: ignore comments are also honored.
Output formats for CI
ty check --output-format concise # one line per diagnostic
ty check --output-format github # GitHub Actions annotations
ty check --output-format gitlab # GitLab Code Quality JSON
ty check --output-format junit # JUnit XML
ty check --exit-zero # report only, never fail (for a trial period)
A GitHub Actions step, using uv:
- uses: astral-sh/setup-uv@v6
- run: uv sync --dev
- run: uv run ty check --output-format github
Editor integration
The language server is ty server; editors start it themselves.
- VS Code: install the official ty extension from the Marketplace. It turns off the Python extension's own language server (
python.languageServer = "None"). To use ty only for diagnostics next to Pylance, set"python.languageServer": "Pylance"and"ty.disableLanguageServices": true. - Neovim 0.11+:
vim.lsp.enable('ty')(config from nvim-lspconfig). Optional settings go throughvim.lsp.config('ty', { settings = { ty = {} } }). - Zed: ty is built in; list
"ty"and"ruff"underlanguages.Python.language_serversto use it instead of basedpyright. - PyCharm 2025.3+: Settings, Python, Tools, ty, tick Enable.
- Emacs 29+ with Eglot: map
python-base-modeto("ty" "server"). - Any other LSP client: run
ty serverover stdio.
Coming from mypy or pyright
ty is gradual: unannotated code is treated leniently, so a first run on an untyped code base is usually quieter
Install ty in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the ty skill do?
Checks Python code for type errors with ty, Astral's fast type checker and language server written in Rust. Use when a user asks to type check a Python project, add ty to pyproject.toml or CI, silence or baseline existing type errors, set up a type-checking language server in VS Code, Neovim, Zed or PyCharm, or move from mypy or pyright. Covers ty check, configuration, rule levels, ignore comments and output formats.
How do I install the ty skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the ty skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic