agent-data

Design an offline-first data layer with Room, Retrofit, and WorkManager.

Updated Feb 3, 2026
One-click install
npx skills add https://github.com/pliniou/loto-generator --skill agent-data
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agent-data
Source: https://github.com/pliniou/loto-generator/tree/main/.windsurf/skills/agent-data
Command: npx skills add https://github.com/pliniou/loto-generator --skill agent-data

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill defines and installs a robust data-layer strategy for the Loto Generator app, focusing on offline-first persistence, data synchronization, and clean separation between data sources and domain logic.

Core Features & Use Cases

  • Offline-first persistence: Local Room database seeded with initial data and kept in sync with remote sources.
  • Repository pattern: Repositories combine local caches and remote services, transforming DTOs to domain models without enforcing business rules.
  • Background synchronization: WorkManager tasks schedule periodic and on-demand data sync with robust retry and migrations.
  • Data integrity and migrations: Safe migrations and legacy data handling to preserve user data.

Quick Start

Initialize an offline-first data layer with Room for local data, Retrofit for network, and a WorkManager-based sync. Seed the database on first launch and start a one-shot sync to pull remote data and map it to domain models.

Frequently Asked Questions about agent-data

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

FAQPage Schema
How do I design an offline-first data layer for an Android app?

An offline-first data layer combines Room for local persistence, Retrofit for network access, and WorkManager for background synchronization to ensure data availability across connectivity states. It seeds the database on launch and maps DTOs to domain models without enforcing business rules.

How does WorkManager handle background sync for local Room storage?

WorkManager handles background sync by scheduling periodic and on-demand tasks that fetch remote data via Retrofit and update Room storage. It manages retry logic and safe migrations to preserve data integrity while exposing synchronized data as Flow to the domain.

What's the best way to map network DTOs to domain models in a repository?

The repository pattern maps DTOs to domain models by combining local Room caches and remote Retrofit services. Repositories transform the data structures without enforcing business rules, exposing the final domain models as Flow streams for UI consumption.

Can I use Retrofit and Room together for offline-first persistence?

Yes, Retrofit and Room work together for offline-first persistence by caching remote API responses locally. WorkManager schedules background synchronization between the Room database and Retrofit remote sources, ensuring data integrity through safe migrations.

Why does an offline-first Android architecture need safe database migrations?

An offline-first architecture needs safe database migrations to preserve existing user data when updating the Room database schema. It handles legacy data correctly during background synchronization and remote data updates, maintaining data integrity throughout the app lifecycle.

Does the agent-data Skill support exposing repository data as Flow?

Yes, the agent-data Skill supports exposing repository data as Flow to the domain layer. It transforms DTOs into domain models from local Room caches and remote Retrofit services, ensuring reactive data streams maintain data integrity during background WorkManager synchronization.