android-data-architecture

Define Android data layers with Room, Retrofit, Hilt, and typed errors.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill android-data-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: android-data-architecture
Source: https://github.com/soygabimoreno/Los-ANDROIDES/tree/main/.agents/skills/android-data-architecture
Command: npx skills add https://github.com/soygabimoreno/Los-ANDROIDES --skill android-data-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the common Android app issue of tangled data, inconsistent error handling, and leaky abstractions between data, domain, and presentation layers by providing a repeatable data-layer architecture for repositories, DTOs, mappers, Room, and networking.

Core Features & Use Cases

  • Defines data source vs repository boundaries so offline-first logic stays in the data layer while domain contracts remain pure.
  • Establishes a consistent DTO → domain model → Room/Retrofit mapping approach to prevent domain/persistence/network coupling.
  • Standardizes typed error handling using Result<T, E> and DataError (plus android-typed-errors helpers) across Room, Retrofit, and token storage.
  • Provides practical networking + persistence wiring patterns including Hilt provisioning for Moshi/OkHttp/Retrofit, safe Retrofit call helpers, Room transaction rules, and DataStore token storage with refresh handling.
  • Supports offline-first workflows following Room as single source of truth via Flow to ViewModels.

Quick Start

Use the android-data-architecture skill to design your feature’s data layer by defining domain interfaces, creating DTOs and mappers, implementing Room and Retrofit data sources, and assembling an offline-first repository with typed errors.

Frequently Asked Questions about android-data-architecture

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

FAQPage Schema
How do I structure an offline-first Android data layer with Room and Retrofit?

An offline-first Android data layer uses Room as the single source of truth, exposing data via Flow while Retrofit fetches remote updates. Repositories coordinate network and local data sources, keeping persistence and networking logic decoupled from domain contracts.

What's the best way to handle Retrofit and Room errors in Android repositories?

Standardize error handling in Android repositories using typed Result<T, E> wrappers and DataError classes. Map android-typed-errors from Retrofit and Room operations into domain-specific errors so presentation layers receive consistent, predictable failure states.

How do I keep domain models pure when using Room and Moshi in Android?

Keep domain models pure by defining separate DTOs for network parsing with Moshi and Room entities for persistence. Use mappers to convert DTOs to domain models, preventing any persistence or networking coupling from leaking into domain contracts.

Can I use Hilt to provide OkHttp interceptors and DataStore for token storage?

Hilt can provision OkHttp interceptors and DataStore instances for token storage in Android. This setup enables authenticated Retrofit requests and secure token refresh handling while maintaining clean dependency injection boundaries across data sources.

When should I separate data sources from repositories in Clean Architecture?

Separate data sources from repositories when offline-first logic needs isolation from domain rules. Data sources handle Room queries and Retrofit calls directly, while repositories orchestrate caching, mapping, and error handling to keep domain interfaces pure Kotlin.

Why does my Android repository leak network details into the domain layer?

Repositories leak network details when domain layers depend directly on Retrofit responses or Room entities. Defining pure Kotlin domain interfaces and mapping DTOs to domain models prevents data, persistence, and networking abstractions from coupling.