Python Patterns Skill
Overview
This skill teaches Python design patterns, idioms, and best practices for writing clean, maintainable, and Pythonic code.
Principles
- •Pythonic Code: Write code that leverages Python's unique features
- •Readability: Code is read more than written
- •Simplicity: Keep it simple and straightforward
- •DRY: Don't Repeat Yourself
- •SOLID: Follow SOLID principles
Key Patterns
1. Context Managers
Use with statements for resource management.
2. Decorators
Use decorators for cross-cutting concerns.
3. Generators
Use generators for memory-efficient iteration.
4. List Comprehensions
Use list comprehensions for concise transformations.
5. Dataclasses
Use dataclasses for data containers.
6. Type Hints
Use type hints for better code clarity.
When to Use This Skill
Load this skill when working on:
- •Python code architecture
- •Design pattern implementation
- •Code refactoring
- •Performance optimization
- •Code review
Sections
- •
design-patterns.md: Common design patterns in Python - •
async-patterns.md: Asyncio and concurrency patterns - •
data-structures.md: Custom data structures and algorithms - •
error-handling.md: Exception handling patterns - •
idioms.md: Pythonic idioms and best practices