Repositories

From moasq/nanowave · View interactive version

Repositories is an AI agent skill from the GitHub repository moasq/nanowave. Repository pattern: protocol-based data access, DTO-to-domain mapping, and clean layer separation. Use when implementing app features related to repositories.

How to use this skill

Skill file

Repository Pattern

Architecture Overview

The repository pattern separates data access from business logic. ViewModels depend on protocol abstractions — never concrete implementations or database types.

Data flow: Supabase API → DTO (Codable) → Repository (maps) → Domain Model → ViewModel → View

Core Concepts

Repository Protocols

DTOs (Data Transfer Objects)

Domain Models

Concrete Implementations

Strict Rules

Composition Root

The @main App struct is the only place that creates concrete repository instances and passes them down:

@main
struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            let userRepo = SupabaseUserRepository()
            ContentView(viewModel: UserListViewModel(userRepository: userRepo))
        }
    }
}

Composition with Other Skills

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.