python-patterns - Python Design Patterns and Best Practices Guide
Provides Python design patterns and best practices including protocols, dataclasses, context managers, decorators, async/await, and type hints.
Tags
Updated: 2026-09-20Capabilities
Typical Inputs
Typical Outputs
What this skill does
- Implement structural subtyping with protocols
- Define data transfer objects with dataclasses
- Manage resources using context managers
- Process data lazily using generators
- Apply function and class decorators
- Execute concurrent tasks with async/await
- Annotate code using advanced type hints
- Implement constructor dependency injection
- Structure packages and module exports
- Handle errors using custom exceptions
- Define object properties with property decorators
- Compose functions using higher-order functions
Inputs
- Python source code
- Python type stub files
Outputs
- Pythonic code structures
- Refactored Python code
- Type-safe Python modules
Requirements
- Python 3.10 or higher for union types and match statements
- Python 3.11 or higher for exception groups
