android-data-layer

new-silvermoon/awesome-android-agent-skills · updated Apr 8, 2026

$npx skills add https://github.com/new-silvermoon/awesome-android-agent-skills --skill android-data-layer
0 commentsdiscussion
summary

The Data Layer coordinates data from multiple sources.

skill.md

Android Data Layer & Offline-First

Instructions

The Data Layer coordinates data from multiple sources.

1. Repository Pattern

  • Role: Single Source of Truth (SSOT).
  • Logic: The repository decides whether to return cached data or fetch fresh data.
  • Implementation:
    class NewsRepository @Inject constructor(
        private val newsDao: NewsDao,
        private val newsApi: NewsApi
    ) {
        // Expose data from Local DB as the source of truth
        val newsStream: Flow<List<News>> = newsDao.getAllNews()
    
        // Sync operation
        suspend fun refreshNews() {
            val remoteNews = newsApi.fetchLatest()
            newsDao.insertAll(remoteNews)
        }
    }
    

2. Local Persistence (Room)

  • Usage: Primary cache and offline storage.
  • Entities: Define @Entity data classes.
  • DAOs: Return Flow<T> for observable data.

3. Remote Data (Retrofit)

  • Usage: Fetching data from backend.
  • Response: Use suspend functions in interfaces.
  • Error Handling: Wrap network calls in try-catch blocks or a Result wrapper to handle exceptions (NoInternet, 404, etc.) gracefully.

4. Synchronization

  • Read: "Stale-While-Revalidate". Show local data immediately, trigger a background refresh.
  • Write: "Outbox Pattern" (Advanced). Save local change immediately, mark as "unsynced", use WorkManager to push changes to server.

5. Dependency Injection

  • Bind Repository interfaces to implementations in a Hilt Module.
    @Binds
    abstract fun bindNewsRepository(impl: OfflineFirstNewsRepository): NewsRepository
    

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.627 reviews
  • Pratham Ware· Dec 12, 2024

    We added android-data-layer from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Yash Thakker· Nov 3, 2024

    android-data-layer fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Dhruvi Jain· Oct 22, 2024

    Registry listing for android-data-layer matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Isabella Liu· Sep 13, 2024

    android-data-layer fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Piyush G· Sep 5, 2024

    Keeps context tight: android-data-layer is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Kiara Reddy· Sep 1, 2024

    android-data-layer is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Shikha Mishra· Aug 24, 2024

    android-data-layer has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Chinedu Shah· Aug 20, 2024

    Useful defaults in android-data-layer — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Isabella Farah· Aug 4, 2024

    Registry listing for android-data-layer matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Layla Gill· Jul 23, 2024

    Solid pick for teams standardizing on skills: android-data-layer is focused, and the summary matches what you get after install.

showing 1-10 of 27

1 / 3