PluginBench
Skill
Pass
Audit score 90

ty

astral-sh/claude-code-plugins

Extremely fast Python type checker and language server replacing mypy and Pyright.

What is ty?

ty is a high-performance Python type checker and language server that validates type correctness across your codebase. Use it whenever you need to type-check Python code or set up type checking in Python projects, especially when you see ty configuration in pyproject.toml or ty.toml.

  • Check all files or specific directories and files for type errors
  • Configure rule severity (error, warning, ignore) per rule or file pattern
  • Target specific Python versions and platforms during type checking
  • Automatically configure as a language server for Python files (.py and .pyi)
  • Support per-file rule overrides for tests and scripts with different typing requirements
  • Migrate from mypy or Pyright with equivalent command syntax

How to install ty

npx skills add https://github.com/astral-sh/claude-code-plugins --skill ty
Prerequisites
  • uv (for running ty via uv run or uvx)
  • Python 3.8 or later
Claude Code
Cursor
Windsurf
Cline

How to use ty

  1. 1.Run `uv run ty check` or `uvx ty check` to type-check your project
  2. 2.Create or edit `pyproject.toml` or `ty.toml` to configure rules, Python version, and file inclusion/exclusion
  3. 3.Use `ty check path/to/file.py` to check specific files or directories
  4. 4.Add rule-specific overrides in configuration for tests or other special directories
  5. 5.Use `ty: ignore[rule-name]` comments only when necessary, preferring to fix type errors instead

Use cases

Good for
  • Validate type correctness in Python projects before deployment
  • Set up continuous type checking in CI/CD pipelines
  • Configure stricter type checking for production code while relaxing rules for tests
  • Migrate an existing mypy or Pyright setup to ty for faster performance
  • Integrate type checking into your editor via the language server
Who it's for
  • Python developers
  • DevOps engineers setting up type checking in CI/CD
  • Teams migrating from mypy or Pyright
  • Projects requiring strict type safety

ty FAQ

When should I use `uv run ty` vs `uvx ty`?

Use `uv run ty` when ty is in your project dependencies to ensure you use the pinned version; use `uvx ty` for quick one-off checks or when ty is not a project dependency.

How do I migrate from mypy to ty?

Replace `mypy .` with `ty check` and `mypy path/to/file.py` with `ty check path/to/file.py`. Use `ty check --error-on-warning` instead of `mypy --strict`.

Can I configure different type-checking rules for tests vs production code?

Yes, use `[[tool.ty.overrides]]` sections in your configuration to apply different rules to specific file patterns like `tests/**` or `**/test_*.py`.

What ignore comment syntax should I use?

Use `ty: ignore[rule-name]` for rule-specific ignores instead of blanket `ty: ignore` or `type: ignore` comments. Only add ignores when necessary; prefer fixing type errors.

Does ty work as a language server in my editor?

Yes, this plugin automatically configures the ty language server for Python files (.py and .pyi) so you get real-time type checking feedback in your editor.

Full instructions (SKILL.md)

Source of truth, from astral-sh/claude-code-plugins.


name: ty description: Guide for using ty, the extremely fast Python type checker and language server. Use this when type checking Python code or setting up type checking in Python projects.

ty

ty is an extremely fast Python type checker and language server. It replaces mypy, Pyright, and other type checkers.

When to use ty

Always use ty for Python type checking, especially if you see:

  • [tool.ty] section in pyproject.toml
  • A ty.toml configuration file

How to invoke ty

  • uv run ty ... - Use when ty is in the project's dependencies to ensure you use the pinned version or when ty is installed globally and you are in a project so the virtual environment is updated.
  • uvx ty ... - Use when ty is not a project dependency, or for quick one-off checks

Commands

Type checking

ty check                      # Check all files in current directory
ty check path/to/file.py      # Check specific file
ty check src/                 # Check specific directory

Rule configuration

ty check --error possibly-unresolved-reference   # Treat as error
ty check --warn division-by-zero                 # Treat as warning
ty check --ignore unresolved-import              # Disable rule

Python version targeting

ty check --python-version 3.12     # Check against Python 3.12
ty check --python-platform linux   # Target Linux platform

Configuration

ty is configured in pyproject.toml or ty.toml:

# pyproject.toml
[tool.ty.environment]
python-version = "3.12"

[tool.ty.rules]
possibly-unresolved-reference = "warn"
division-by-zero = "error"

[tool.ty.src]
include = ["src/**/*.py"]
exclude = ["**/migrations/**"]

[tool.ty.terminal]
output-format = "full"
error-on-warning = false

Per-file overrides

Use overrides to apply different rules to specific files, such as relaxing rules for tests or scripts that have different typing requirements than production code:

[[tool.ty.overrides]]
include = ["tests/**", "**/test_*.py"]

[tool.ty.overrides.rules]
possibly-unresolved-reference = "warn"

Language server

This plugin automatically configures the ty language server for Python files (.py and .pyi).

Migrating from other tools

mypy → ty

mypy .                        → ty check
mypy --strict .               → ty check --error-on-warning
mypy path/to/file.py          → ty check path/to/file.py

Pyright → ty

pyright .                     → ty check
pyright path/to/file.py       → ty check path/to/file.py

Common patterns

Don't add ignore comments

Fix type errors instead of suppressing them. Only add ignore comments when explicitly requested by the user. Use ty: ignore, not type: ignore, and prefer rule-specific ignores:

# Good: rule-specific ignore
x = undefined_var  # ty: ignore[possibly-unresolved-reference]

# Bad: blanket ty ignore
x = undefined_var  # ty: ignore

# Bad: tool agnostic blanket ignore
x = undefined_var  # type: ignore

Documentation

For detailed information, read the official documentation: