android-data-layer
Originally fromnew-silvermoon/awesome-android-agent-skills
Installation
SKILL.md
Android Data Layer
The data layer coordinates data from multiple sources. Its public API to the rest of the app is repository interfaces; its internal implementation details (DAOs, API services, DTOs) never leak upward.
Related skills: See android-skills:android-retrofit for Retrofit service setup, OkHttp configuration, and Hilt module wiring. See android-skills:android-dev for how the data layer fits into the overall architecture and error propagation model.
Repository Pattern
The repository is the single source of truth. It decides whether to serve cached data or fetch fresh data, and maps raw data-layer types to domain models.
class NewsRepository @Inject constructor(
private val newsDao: NewsDao,
private val newsApi: NewsApi,
private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO
) {
// Room DAO as the source of truth — UI always reads from local DB
val newsStream: Flow<List<News>> = newsDao.getAllNews()