new-silvermoon/android-data-layer
Guidance on implementing the Data Layer using Repository pattern, Room (Local), and Retrofit (Remote) with offline-first synchronization.
npx skills add https://github.com/new-silvermoon/awesome-android-agent-skills --skill android-data-layer
The Data Layer coordinates data from multiple sources.
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)
}
}
@Entity data classes.Flow<T> for observable data.suspend functions in interfaces.try-catch blocks or a Result wrapper to handle exceptions (NoInternet, 404, etc.) gracefully.WorkManager to push changes to server. @Binds
abstract fun bindNewsRepository(impl: OfflineFirstNewsRepository): NewsRepository
Take new-silvermoon/android-data-layer from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.