kmp-repositories

Implement Kotlin Multiplatform repository patterns with shared interfaces and platform-specific data sources.

61|17|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/ahmed3elshaer/everything-claude-code-mobile --skill kmp-repositories
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kmp-repositories
Source: https://github.com/ahmed3elshaer/everything-claude-code-mobile/tree/main/skills/kmp-repositories
Command: npx skills add https://github.com/ahmed3elshaer/everything-claude-code-mobile --skill kmp-repositories

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill standardizes cross-platform data access by implementing a Kotlin Multiplatform repository pattern with shared interfaces and platform-specific implementations.

Core Features & Use Cases

  • Common interface layer: Define repository contracts in commonMain to be implemented per platform.
  • Platform-specific data sources: Provide remote/local implementations that coordinate data fetching, caching, and mapping between layers.
  • Testable architecture: Enables unit and integration tests through clear separations of concerns and dependency injection.
  • Use Case alignment: Integrates with domain/use case modules to coordinate data flows across presentation, domain, and data layers.

Quick Start

Define shared interfaces in commonMain, implement platform-specific repositories for Android and iOS, and wire them with DI to enable cross-platform data access.

Frequently Asked Questions about kmp-repositories

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

FAQPage Schema
How do I implement a repository pattern for Kotlin Multiplatform projects?

A repository pattern in Kotlin Multiplatform centralizes data access by defining shared interfaces in commonMain and platform-specific implementations for Android and iOS. This decouples domain logic from data sources, enabling consistent data flows across platforms while maintaining testability through dependency injection.

Can I share repository interfaces between Android and iOS in Kotlin Multiplatform?

Yes. Define repository contracts in commonMain as expect interfaces, then provide actual implementations in androidMain and iosMain. This allows both platforms to share domain layer logic while using platform-specific data sources for remote and local data.

What's the best way to handle data caching and error handling across platforms?

Implement a base repository class in commonMain that coordinates data fetching, caching, and error handling logic. Platform-specific repositories inherit this base and inject their own data sources, ensuring consistent behavior across Android and iOS with platform-appropriate error strategies.

How do I structure data sources for a cross-platform Kotlin repository?

Separate remote and local data sources as platform-specific implementations coordinated by the repository layer. The repository orchestrates these sources—fetching, caching, and mapping data between layers—while exposing a clean interface to the domain and presentation layers.

Do I need dependency injection to wire repositories in Kotlin Multiplatform?

Dependency injection enables testable, maintainable repositories by decoupling data source implementations from repositories. While not strictly required, DI wiring in commonMain with platform-specific factories ensures clean separation and simplifies unit and integration testing across Android and iOS.

When should I use the repository pattern instead of direct data layer access?

Use the repository pattern when you need consistent data access abstractions across multiple platforms, testable domain logic isolated from implementation details, or coordinated caching and error handling. It's essential for Kotlin Multiplatform projects targeting both Android and iOS with shared business logic.