What problem does it solve?
This Skill addresses the challenge of tightly coupled data access logic within applications, making code harder to test, maintain, and scale. It enforces a clean separation between data sources and business logic.
Core Features & Use Cases
- Protocol-Based Data Access: Define data access contracts using Swift protocols, ensuring ViewModels depend on abstractions, not concrete implementations.
- DTO-to-Domain Mapping: Clearly separates database schema representations (DTOs) from your application's domain models, facilitating type safety and cleaner code.
- Layer Separation: Enforces a strict data flow (
Supabase API → DTO → Repository → Domain Model → ViewModel → View), promoting modularity and testability.
- Use Case: When building a new feature that requires fetching user data, use this Skill to define a
UserRepository protocol, implement it against a Supabase backend, and inject it into your ViewModel, ensuring your UI layer remains independent of the data source.
Quick Start
Implement the repository pattern for a new 'Product' entity by defining a ProductRepository protocol and a SupabaseProductRepository concrete implementation.