What problem does it solve?
This Skill helps developers implement the Repository Pattern, abstracting data access logic from business logic. It ensures a clean separation of concerns, making your application more testable, maintainable, and independent of specific database technologies, ultimately simplifying data persistence.
Core Features & Use Cases
- Interface-First Design: Define clear data access contracts using Python
Protocol interfaces.
- Business Model Isolation: Ensure repositories work exclusively with business models, preventing database implementation details from leaking.
- Mapper Integration: Seamlessly convert between business and ORM models using dedicated mappers for data transformation.
- Use Case: Generate a Python
IProductRepository interface and a SQLAlchemyProductRepository implementation, including create, get_by_id, and update methods, ensuring proper use of mappers and type hints.
Quick Start
Create a Python IUserRepository interface and a PostgreSQLUserRepository implementation for a User model, including methods to create and get_by_email, using a UserMapper.