python-ty

tizee's avatarfrom tizee

Fast Python type checking with ty (by Astral). Use when checking Python types, running type checks in CI, or setting up type checking for Python projects. Triggers on "type check", "ty check", "python types", or type error debugging.

⭐2stars🔀0forks📁View on GitHub🕐Updated Dec 19, 2025

When & Why to Use This Skill

The python-ty skill integrates Astral's high-performance Python type checker into Claude, enabling lightning-fast static analysis and type error debugging. It streamlines the development workflow by providing instant feedback on type safety, supporting CI/CD integration, and offering advanced configuration for professional Python projects to ensure code reliability and maintainability.

Use Cases

  • Instant Type Validation: Quickly run 'ty check' on specific files or directories to identify and resolve Python type hint issues during active coding sessions.
  • CI/CD Pipeline Integration: Automate type safety checks within GitHub Actions or GitLab CI using specialized output formats to prevent type-related regressions in production code.
  • Large-Scale Refactoring: Utilize watch mode and strict error reporting to maintain type integrity while performing complex architectural changes in large Python codebases.
  • Cross-Platform Compatibility: Target specific Python versions or platforms (e.g., Linux, Windows) to ensure consistent type behavior across different deployment environments.
  • Type Error Debugging: Leverage Claude to interpret and fix complex typing errors identified by the ty engine, improving overall developer productivity.
namepython-ty
descriptionFast Python type checking with ty (by Astral). Use when checking Python types, running type checks in CI, or setting up type checking for Python projects. Triggers on "type check", "ty check", "python types", or type error debugging.

Python Type Checking with ty

ty is an extremely fast Python type checker from Astral (makers of Ruff).

Quick Start

# Run type checker (no install needed)
uvx ty check

# Check specific files
uvx ty check src/ tests/

Installation (Optional)

# Install globally
uv tool install ty@latest

# Update
uv tool upgrade ty

Common Tasks

# Watch mode - auto-recheck on file changes
ty check --watch

# Target specific Python version
ty check --python-version 3.11

# Concise output
ty check --format concise

# Exclude test files
ty check --exclude "**/test_*.py"

Configuration File

Create ty.toml in project root (auto-discovered):

python-version = "3.11"
exclude = ["**/test_*.py", "**/__pycache__/**"]
format = "concise"

CI/CD

# Strict CI check
ty check --error all --error-on-warning --no-progress

Exit codes: 0 = success, 1 = errors found, 2 = internal error


Advanced Options

Severity Control

ty check --error all        # All issues as errors
ty check --warn typing      # Typing issues as warnings
ty check --ignore unused    # Ignore unused imports

Environment Targeting

ty check --python /path/to/python    # Specific interpreter
ty check --venv /path/to/venv        # Target virtualenv
ty check --python-platform linux     # Cross-platform check
ty check --extra-search-path ./stubs/

Output Formats

ty check --format full       # Detailed (default)
ty check --format concise    # Compact
ty check --format github     # GitHub Actions annotations
ty check --format gitlab     # GitLab CI format
ty check --color never       # No colors
ty check --no-progress       # Hide progress bar
ty check -v                  # Verbose
ty check -q                  # Quiet

Other Commands

ty server                              # Start LSP server
ty version                             # Show version
ty generate-shell-completion zsh       # Shell completions