mypy
mypy brings static type checking to Python through gradual adoption of type hints, letting you add type safety incrementally without rewriting existing code. It supports strict mode for maximum safety, works seamlessly with FastAPI and Django, and uses type inference to minimize annotation overhead.
mypy adds static type checking to Python projects through gradual typing and type hints, catching errors before runtime.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-07-18
mypy adds static type checking to Python projects through gradual typing and type hints, catching errors before runtime. mypy brings static type checking to Python through gradual adoption of type hints, letting you add type safety incrementally without rewriting existing code. It supports strict mode for maximum safety, works seamlessly with FastAPI and Django, and uses type inference to minimize annotation overhead.
Use it when
- mypy catches type errors before runtime in FastAPI and Django applications by analyzing function signatures, variable assignments.
- mypy can be configured with strict mode settings in a mypy.ini or pyproject.toml file.
Verify before relying
Read SKILL.md below before installing (2 files). Open directory: indexed for reading, not audited.
Install
bobmatnyc/claude-mpm-skills/mypy · repository language: Python
Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.
Frequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
What is mypy and how does static type checking python work?
mypy is a static type checker for Python that analyzes your code before runtime to catch type errors. It brings static type checking to Python through gradual adoption of type hints, letting you add type safety incrementally without rewriting existing code. mypy uses type inference to minimize annotation overhead while supporting strict mode for maximum safety.
How can mypy catch type errors before runtime in FastAPI and Django?
mypy catches type errors before runtime in FastAPI and Django applications by analyzing function signatures, variable assignments, and API endpoint definitions against their declared types. When you annotate your route handlers, request models, and database queries with type hints, mypy validates that arguments match expected types and return values conform to contracts, preventing runtime failures in production.
How do I configure and enforce strict type checking in CI/CD pipelines?
mypy can be configured with strict mode settings in a mypy.ini or pyproject.toml file, then integrated into your CI/CD pipeline as a build step. Set options like `strict = True`, `disallow_untyped_defs`, and `disallow_incomplete_defs` to enforce comprehensive type coverage. Run mypy in your pipeline before tests or deployment to block code that fails type validation.
What type annotations, generics, and advanced typing patterns does mypy support?
mypy supports Python type annotations including Optional, Union, List, Dict, and custom types. It handles generics through TypeVar for parameterized types, Protocol for structural typing, and advanced patterns like bounded TypeVars, type aliases, and overloads. mypy also supports type stubs for untyped libraries and can infer types automatically when explicit annotations aren't provided.
How can I integrate mypy with my IDE and development workflow?
mypy integrates with most IDEs through plugins and language servers. Many editors like VS Code, PyCharm, and Vim can run mypy in real-time as you type, showing type errors immediately. Configure mypy in your project's configuration file, then enable the mypy plugin in your IDE settings to get instant feedback on type violations during development.
What's the difference between mypy and other python type checking tools?
mypy is the original and most widely-adopted Python type checker, supporting gradual typing and extensive configuration options. Other tools like Pyright offer different trade-offs in speed and strictness. mypy's strength lies in its mature ecosystem, broad library support through type stubs, and flexibility for incremental adoption across large codebases.
SKILL.md
Rendered from the published skill. Quoted content, verbatim.
mypy - Static Type Checking for Python
Overview
mypy is the standard static type checker for Python, enabling gradual typing with type hints (PEP 484) and comprehensive type safety. It catches type errors before runtime, improves code documentation, and enhances IDE support while maintaining Python's dynamic nature through
(truncated - see the full file via the links below)
File tree — 2 files
toolchains/python/tooling/mypy/SKILL.md
toolchains/python/tooling/mypy/metadata.json
Let your AI agent find skills like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.
wish › “Add type safety to existing Python projects with gradual typing”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
Quality Run Type Checking combines pyright for rapid development feedback with mypy for comprehensive pre-commit validation. Both tools catch complementary error classes—pyright excels at speed and IDE integration, while mypy provides deeper Pydantic model support and CI/CD authority. Use pyright during coding iterations and mypy before commits.
Learn to use ty, Astral's high-performance Rust-based type checker for Python. This skill covers adding type annotations, resolving type errors, configuring rules, and migrating from mypy or pyright. Explore advanced patterns like intersection types and protocols, plus editor integration for VS Code, Cursor, Neovim, and PyCharm.
Drizzle is a TypeScript-first ORM built for compile-time type safety and edge-runtime performance. Define schemas with SQL-like syntax, execute queries with full type inference, and manage one-to-many and many-to-many relations without runtime dependencies.
Drizzle ORM is a lightweight, type-safe TypeScript ORM that treats SQL as a first-class citizen. This skill covers schema definition, database connections across PostgreSQL, SQLite, and Turso, relational queries, and performance patterns like proper indexing and pagination.
pytest is Python's standard testing framework, enabling developers to write organized unit and integration tests through fixtures for dependency injection and parametrization for data-driven test cases. It supports async code, multiple test discovery patterns, and integrates seamlessly with FastAPI, Django, and Flask, plus a rich plugin ecosystem for coverage, mocking, and parallel execution.
This protocol enforces a three-stage quality check for Rust code: format validation, clippy linting, and test execution, each halting on failure. It's designed for the trusty-tools monorepo and clarifies crate naming conventions, test output interpretation, and handling of pre-existing failures. Use it before any PR merge or when code changes are ready to commit.
More skills vitest (MIT) · cypress (MIT)