Skip to main content
skill CX Codex

ty — Claude Code skill: what it does, how to install

Guides an agent through Python type checking with ty and its language server. Use it when adding type checks or moving from mypy or Pyright.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add astral-sh/claude-code-plugins --skill ty -a claude-code
Open on GitHub

What ty does

The skill tells an agent how to use ty for Python type checking: checking the current directory, a file, or a source directory with ty check. It covers rule severity, target Python versions, and platform targeting through command options.

Configuration lives in pyproject.toml or ty.toml. You can include or exclude paths, choose terminal output, and apply different rules to test files. The skill automatically configures the ty language server for .py and .pyi files.

Use uv run ty ... when ty is a project dependency, because that uses the pinned version. The guidance favours fixing type errors; add ty: ignore comments only when explicitly requested.

What it helps with

  • check types across a Python project
  • inspect type errors in one file
  • configure ty rules for test files
  • migrate type-checking commands from mypy or Pyright
  • target a Python version during checks

Example prompts for the agent

  • Check types in src/ with ty.
  • Configure ty in pyproject.toml for Python 3.12.
  • Migrate this project from mypy to ty and fix the reported type errors.

How to install ty

1Skills CLI (Vercel)

npx skills add astral-sh/claude-code-plugins --skill ty -a claude-code

2Manually: put the files in place

~/.claude/skills/ty/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/ty/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about ty

How do I install ty in Claude Code?

Run npx skills add astral-sh/claude-code-plugins --skill ty -a claude-code, then run npx skills add astral-sh/claude-code-plugins --skill ty -a claude-code again. The skill file is at ~/.claude/skills/ty/SKILL.md.

What does ty do?

This skill guides an agent when it runs Python type checks with ty and configures its language server. It also maps common mypy and Pyright commands to ty.

Where do ty rules go?

Put configuration in pyproject.toml or ty.toml. Use [[tool.ty.overrides]] sections when particular files need different rules.

Source text

SKILL.md · Apache-2.0
---
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

```bash
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

```bash
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

```bash
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`:

```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:

```toml
[[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

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

### Pyright → ty

```bash
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:

```python
# 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:

- https://docs.astral.sh/ty/

© astral-sh · Apache-2.0 · astral-sh/claude-code-plugins

Similar skills

All skills for Programming languages →

From the same set3

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor