home / skills / pluginagentmarketplace / custom-plugin-python / type-hints
This skill helps you master Python type hints and mypy checks to improve code quality, IDE support, and static analysis.
npx playbooks add skill pluginagentmarketplace/custom-plugin-python --skill type-hintsReview the files below or copy the command above to add this skill to your agents.
---
name: Type Hints
description: Python type hints, type checking, and static analysis with mypy
version: "2.1.0"
sasmp_version: "1.3.0"
bonded_agent: 07-best-practices
bond_type: PRIMARY_BOND
# Skill Configuration
retry_strategy: exponential_backoff
observability:
logging: true
metrics: type_coverage_percent
---
# Python Type Hints Skill
## Overview
Master Python type hints for better code quality, IDE support, and static type checking with mypy.
## Topics Covered
### Basic Type Hints
- Variable annotations
- Function signatures
- Return types
- Optional types
- Union types
### Advanced Typing
- Generic types
- TypeVar and ParamSpec
- Protocol and structural typing
- Literal types
- TypedDict
### Type Checking
- mypy configuration
- Strict mode settings
- Type ignore comments
- Stub files (.pyi)
- Type coverage
### Runtime Types
- typing_extensions
- Pydantic validation
- Runtime type checking
- Dataclasses with types
- attrs integration
### Best Practices
- Gradual typing strategy
- Third-party type stubs
- CI type checking
- Documentation with types
- Type-driven development
## Prerequisites
- Python fundamentals
- OOP concepts
## Learning Outcomes
- Write type-annotated code
- Configure mypy properly
- Use generic types
- Implement protocols
This skill teaches practical Python type hints, static analysis, and mypy configuration to improve code reliability and developer experience. It covers basic and advanced typing constructs, runtime typing tools, and workflows for gradual adoption. You will learn how to write annotations that enable better IDE support, clearer APIs, and fewer runtime errors.
The skill inspects code patterns and explains appropriate type annotations for variables, functions, and classes. It demonstrates configuring and running mypy, interpreting its output, and using type stubs and ignore directives when needed. It also shows how to combine static typing with runtime validators and dataclass/attrs patterns for robust validation.
Do type hints affect runtime performance?
Type hints are ignored at runtime by default and incur no performance cost; runtime validators or libraries that enforce types can add overhead.
When should I use typing_extensions?
Use typing_extensions to access newer typing features on older Python versions until they become part of the standard typing module.