/migration-patterns-plugin:mypy-to-ty [--check-only] [--fix]from migration-patterns-plugin
Migrate Python type checking from mypy to ty (Astral's Rust-based type checker). Updates pre-commit hooks and pyproject.toml config.
Ships in migration-patterns-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Migrate from mypy to ty — Astral's new fast Python type checker. Replaces the mirrors-mypy pre-commit hook with a local repo: local hook using uvx ty check, migrates config from [tool.mypy] to [tool.ty], and removes mypy.ini.
| Use this skill when... | Keep mypy when... |
|---|---|
.pre-commit-config.yaml contains mirrors-mypy | ty does not yet support a specific mypy plugin you rely on |
[tool.mypy] section exists in pyproject.toml | CI pipeline depends on mypy-specific exit codes or plugins |
| You want faster type checking (ty is written in Rust) | Project uses mypy daemon (dmypy) for incremental checks |
| Repo uses uv and the astral stack already | Team prefers mypy's error message format |
find . -maxdepth 1 -name '.pre-commit-config.yaml'find . -maxdepth 1 -name 'pyproject.toml'find . -maxdepth 1 -name 'mypy.ini'find . -maxdepth 1 -name 'uv.lock'| Parameter | Description |
|---|---|
--check-only | Report what would change without modifying files |
--fix | Apply migration automatically |
Execute this mypy-to-ty migration:
.pre-commit-config.yaml and locate any mirrors-mypy or mypy entries.pyproject.toml and extract the [tool.mypy] section.mypy.ini.mypy → ty migration audit
==========================
pre-commit hook: mirrors-mypy found at rev <rev>
pyproject.toml: [tool.mypy] section found (N lines)
mypy.ini: FOUND / NOT FOUND
uv.lock: EXISTS (uv available) / MISSING
If --check-only, stop here.Remove the mirrors-mypy repo block. Add a repo: local hook for ty:
- repo: local
hooks:
- id: ty
name: ty type check
entry: uvx ty check
language: system
types: [python]
pass_filenames: false
Note: astral-sh/ty-pre-commit does not yet exist as a hosted pre-commit repo. The repo: local pattern with uvx ty check is the correct approach until an official mirror is published.
If an entry: mypy hook in a non-mirrors-mypy repo exists, replace it similarly.
Read the [tool.mypy] section and convert each key to the ty equivalent:
| mypy key | ty equivalent | Notes |
|---|---|---|
python_version | python-version | Rename only |
strict | strict | Same |
warn_return_any | warn-return-any | Kebab-case |
disallow_untyped_defs | disallow-untyped-defs | Kebab-case |
ignore_missing_imports | Not needed | ty resolves stubs natively |
exclude | exclude | Same |
Per-module [[tool.mypy.overrides]] | Drop or convert manually | Note for manual review |
Remove the [tool.mypy] section (and any [[tool.mypy.overrides]] sections). Add [tool.ty] with converted keys. Annotate any options that need manual review.
If mypy.ini exists, delete it. Its content should already be in [tool.ty] after Step 3.
If mypy appears in pyproject.toml dev/lint dependencies, remove it:
# With uv
uvx --from uv uv remove --dev mypy 2>/dev/null || true
If not using uv, note it for manual removal.
Run the new hook to confirm it works:
pre-commit run ty --all-files
If it exits 0, the migration is complete. If it exits non-zero:
Print a summary of all changes made and list files to commit:
mypy → ty migration complete
=============================
.pre-commit-config.yaml UPDATED (removed mirrors-mypy, added local ty hook)
pyproject.toml UPDATED ([tool.mypy] → [tool.ty])
mypy.ini DELETED / NOT FOUND
Manual review needed:
- [[tool.mypy.overrides]] sections were dropped — verify ty handles them
- Check ty docs for any unsupported mypy options
Files to stage:
git add .pre-commit-config.yaml pyproject.toml
| Context | Command |
|---|---|
| Audit only | /migration-patterns:mypy-to-ty --check-only |
| Apply migration | /migration-patterns:mypy-to-ty --fix |
| Verify after migration | pre-commit run ty --all-files |
| Test ty directly | uvx ty check . |
| Item | Value |
|---|---|
| ty docs | https://github.com/astral-sh/ty |
| Pre-commit hook type | repo: local, entry: uvx ty check |
| Config section | [tool.ty] in pyproject.toml |
| Key difference | ty uses kebab-case keys; mypy uses underscore |
/migration-patterns:black-to-ruff-format — Migrate from black to ruff format/migration-patterns:flake8-to-ruff — Migrate flake8/isort to ruff/configure:repo — End-to-end repo config driverWhat SKILL.md sets; muted values are Claude Code's defaults
sonnetThree short reads, in order
npx claudepluginhub laurigates/claude-plugins --plugin migration-patterns-plugin7 skills in this plugin
/black-to-ruff-formatMigrate Python formatting from black to ruff-format. Use when psf/black is in .pre-commit-config.yaml or [tool.black] exists in pyproject.toml./dual-writeDual-write pattern for safe data store transitions. Use when planning DB migrations, switching storage backends, or reviewing code writing to multiple systems simultaneously./eslint-to-biomeMigrate JS/TS linting from ESLint+Prettier to Biome. Use when .eslintrc* or eslint.config.* exists and no biome.json is present./flake8-to-ruffMigrate Python linting from flake8/isort to ruff. Use when pycqa/flake8 or PyCQA/isort is in .pre-commit-config.yaml or [tool.flake8]/[tool.isort] config exists./shadow-modeShadow mode / dark-launch for validating new systems under production load. Use when testing replacement services, comparing behavior, or planning traffic mirroring for migrations./tool-migration-cutoverMigrating tools (Dependabot to Renovate, PAT to GitHub App, linter swaps). Use when removing the incumbent, to verify the new one runs, or on whole-file reformat churn from a leftover tool.Other plugins' skills for the same job