Resources
1Install
npx skillscat add hoangnguyen0403/agent-skills-standard/android-persistence Install via the SkillsCat registry.
SKILL.md
Android Persistence Standards
Priority: P0
Implementation Guidelines
Room
- Async: Return
Flow<List<T>>for queries, usesuspendfor Write/Insert. - Entities: Keep simple
@Entitydata classes. Map to Domain models in Repository. - Transactions: Use
@Transactionfor multi-table queries (Relations).
DataStore
- Usage: Replace
SharedPreferenceswithProtoDataStore(Type-safe) orPreferencesDataStore. - Scope: Inject singleton instance via Hilt.
Anti-Patterns
- Main Thread:
**No IO on Main**: Use Dispatchers.IO (Room helper does this, but verify flow collection). - Domain Leak:
**No Entities in UI**: Map to Domain/UI Models.