android-data-layerlisted
Install: claude install-skill pablitoarango/android-skills
# Android Data Layer
Sources of truth: [Data layer](https://developer.android.com/topic/architecture/data-layer), [Offline-first](https://developer.android.com/topic/architecture/data-layer/offline-first).
For offline-first reads, write strategies, synchronization and conflict resolution, read [`offline-first.md`](offline-first.md).
## 1. Responsibilities
The data layer holds the app data **and the business logic** that gives it value:
- Exposes data to the rest of the app as immutable types.
- Centralizes every change to that data.
- Resolves conflicts between data sources.
- Hides data sources from the rest of the app.
## 2. Structure
```
Repository (public) one per data type; the only entry point
├── XxxLocalDataSource internal; one source each (Room, DataStore, file)
└── XxxRemoteDataSource internal; one source each (Retrofit, Firebase)
```
- Create a repository **even for a single data source**.
- Each repository defines **one source of truth**. For offline-first data it is the local database.
- Each data source works with exactly one source of data.
- Name data sources by role, not technology: `NewsRemoteDataSource`, not `NewsRetrofitDataSource`.
- Repositories may depend on other repositories when combining data; name such a class `<DataType>Manager` if it only coordinates (`UserManager`).
- ViewModels, use cases and composables never inject a DAO, Retrofit service, DataStore or data source.
```kotlin
interface NewsRepository {
fun getN