skill-offline-first

Manage offline-first Android data with Room, WorkManager, and Retrofit APIs.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes assets (resource) components.

## What problem does it solve? This Skill solves the challenge of building reliable offline-capable data layers for Android apps by using Room for local persistence, seed data from assets on first run, and safe migration paths, ensuring users can access and interact with their data even without a network.

## Core Features & Use Cases

  • Offline-first persistence using Room and Kotlin Flows to keep UI responsive.
  • Seed initial data from assets on first run to bootstrap historical data.
  • Data migration path from legacy lottery_data.json to Room schema.
  • Background syncing via WorkManager with graceful backoff and retry.
  • Retrofit-based API with DTO-to-entity mapping to ensure domain integrity.

### Quick Start

  1. Ensure Android Studio is installed and open the project.
  2. Build and run the app on a device or emulator; on first launch, seed data from assets and migrate legacy data if present.
  3. Trigger a sync by toggling network connectivity or wiring WorkManager to run periodically.

Frequently Asked Questions about skill-offline-first

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

FAQPage Schema
How do I implement offline-first data persistence in Android using Room?

To implement offline-first persistence, use Room for local storage and Kotlin Flows for reactive data streams, ensuring the UI remains responsive and accessible without a network connection.

How do I load seed data from assets on first run in an Android app?

Loading seed data from assets on first run bootstraps initial historical data into the local Room database, allowing the app to display relevant content immediately before any remote API sync occurs.

What is the best way to sync Room database data with a remote Retrofit API in the background?

The best way to sync Room data with a Retrofit API is using WorkManager for background scheduling, applying graceful backoff and retry strategies to handle network instability reliably.

How do I handle data migration from a legacy JSON file to a Room database schema?

Handling data migration from legacy JSON to a Room schema involves safely parsing the legacy file on first launch and mapping its contents to the new Room entity structures to preserve historical data.

Does WorkManager support retry with backoff for Android background sync tasks?

Yes, WorkManager supports background sync tasks with graceful backoff and retry policies, ensuring remote API synchronization attempts recover automatically during transient network failures.

How do I map Retrofit DTOs to Room entities without blocking the Android UI?

Mapping Retrofit DTOs to Room entities without blocking the UI requires applying non-blocking operations via Kotlin Flows, ensuring domain integrity is maintained while keeping the main thread responsive.