ty — скилл для Claude Code: что делает и как установить
Настраивает работу агента с ty для проверки типов Python и языкового сервера. Пригодится при добавлении типизации или переходе с mypy и Pyright.
npx skills add astral-sh/claude-code-plugins --skill ty -a claude-codeЧто делает ty
Скилл задаёт правила работы с ty: проверка текущего каталога, отдельного файла или каталога исходников через ty check. Он умеет настраивать уровень правил, целевую версию Python и платформу через параметры команды.
Конфигурация ty хранится в pyproject.toml или ty.toml. Можно задать включаемые пути, исключения, формат вывода и отдельные правила для файлов тестов. Для Python-файлов .py и .pyi скилл автоматически настраивает языковой сервер ty.
При наличии ty в зависимостях проекта нужно использовать uv run ty ..., потому что так берётся закреплённая версия. Ошибки типов предлагается исправлять, а комментарии ty: ignore добавлять только по явной просьбе.
Какие задачи решает
- проверить типы во всём Python-проекте
- найти ошибку типов в конкретном файле
- настроить правила ty для тестов
- перенести команды с mypy или Pyright
- задать версию Python для проверки
Примеры запросов агенту
- Проверь типы в
src/с помощью ty. - Настрой ty в
pyproject.tomlдля Python 3.12. - Перенеси проверку типов с mypy на ty и исправь найденные ошибки.
Как установить ty
1Через Skills CLI (Vercel)
npx skills add astral-sh/claude-code-plugins --skill ty -a claude-code2Вручную: положить файлы
~/.claude/skills/ty/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/ty/
1Через Skills CLI (Vercel)
npx skills add astral-sh/claude-code-plugins --skill ty -a codex2Вручную: положить файлы
.agents/skills/ty/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add astral-sh/claude-code-plugins --skill ty -a cursor2Вручную: положить файлы
.cursor/skills/ty/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install astral-sh/claude-code-plugins ty2Вручную: положить файлы
.github/skills/ty/SKILL.md1Через Skills CLI (Vercel)
npx skills add astral-sh/claude-code-plugins --skill ty -a gemini-cli2Командой платформы
gemini skills install https://github.com/astral-sh/claude-code-plugins --path plugins/astral/skills/tyВручную: положить файлы
.devin/skills/ty/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add astral-sh/claude-code-plugins --skill ty -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о ty
Как установить ty в Claude Code?
Выполните npx skills add astral-sh/claude-code-plugins --skill ty -a claude-code, затем ещё раз npx skills add astral-sh/claude-code-plugins --skill ty -a claude-code. Файл скилла расположен в ~/.claude/skills/ty/SKILL.md.
Что делает ty?
Скилл направляет агента при проверке типов Python через ty и настройке его языкового сервера. Он также содержит соответствия команд для миграции с mypy и Pyright.
Где настраиваются правила ty?
Правила задаются в pyproject.toml или ty.toml. Для отдельных файлов можно использовать секции [[tool.ty.overrides]].
Исходный текст
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