repositories

Implements Swift repository design pattern with DTO-domain mapping and Supabase abstraction via dependency injection.

32|10|Updated Feb 21, 2026
One-click install
npx skills add https://github.com/moasq/nanowave --skill repositories
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: repositories
Source: https://github.com/moasq/nanowave/tree/main/internal/orchestration/skills/features/repositories
Command: npx skills add https://github.com/moasq/nanowave --skill repositories

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

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.

Frequently Asked Questions about repositories

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement the repository pattern in Swift to separate data access logic?

The repository pattern in Swift separates data access logic by defining protocol-based contracts for data sources, managing DTO-to-domain model mapping, and enforcing dependency injection so ViewModels depend on abstractions rather than concrete implementations.

Why does my Swift ViewModel remain tightly coupled to the database schema?

Your ViewModel is tightly coupled because it likely consumes raw database models directly. Introducing DTO-to-domain mapping and layer separation enforces a strict data flow—API to DTO to Repository to Domain Model—keeping UI layers independent of data sources.

What is the best way to structure clean architecture data flow with Supabase in Swift?

The best way to structure clean architecture data flow with Supabase is enforcing a strict pipeline: Supabase API fetches DTOs, a Repository maps them to domain models, and dependency injection passes these models to ViewModels, ensuring modular and testable code.

Can I use dependency injection with Swift protocols to test data access logic?

Yes, you can use dependency injection with Swift protocols to test data access logic. By defining repository protocols and injecting concrete implementations like a Supabase repository, ViewModels remain testable and independent of live data sources.

How do I map data transfer objects to domain models when fetching user data?

You map data transfer objects to domain models by defining a repository that retrieves DTOs representing database schemas and transforms them into clean domain models, abstracting the data source and providing type safety for your application.

When do I need a repository protocol for a new Swift entity?

You need a repository protocol for a new Swift entity when building a feature that fetches data and requires testability. Define a protocol, implement a concrete repository against a backend like Supabase, and inject it to maintain separation of concerns.