What problem does it solve?
This Skill addresses code complexity, tight coupling, and testing difficulties by providing a structured approach to implementing design patterns and architectural boundaries in Python projects.
Core Features & Use Cases
- Architectural Decoupling: Uses Protocols and dependency injection to separate business logic from infrastructure and frameworks.
- Pattern Implementation: Provides guidance on Strategy, Factory, Adapter, Repository, Unit of Work, and State Machine patterns.
- Use Case: When a growing codebase becomes difficult to test or modify due to framework-specific dependencies, use this Skill to refactor the system into a clean, testable architecture using domain-driven design principles.
Quick Start
Apply the py-patterns skill to refactor the current module by introducing a Protocol for the external service dependency and implementing constructor injection.