Agent-skills-standard android-persistence
Implement Room database schemas and DataStore preferences with proper async patterns in Android. Use when defining Room entities, DAOs, migrations, or replacing SharedPreferences with DataStore. (triggers: **/*Dao.kt, **/*Database.kt, **/*Entity.kt, @Dao, @Entity, RoomDatabase)
install
source · Clone the upstream repo
git clone https://github.com/HoangNguyen0403/agent-skills-standard
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/HoangNguyen0403/agent-skills-standard "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/android/android-persistence" ~/.claude/skills/hoangnguyen0403-agent-skills-standard-android-persistence && rm -rf "$T"
manifest:
skills/android/android-persistence/SKILL.mdsource content
Android Persistence Standards
Priority: P0
1. Configure Room Database
- Return
for queries, useFlow<List<T>>
for Write/Insert.suspend - Keep
data classes simple. Map to Domain models in Repository.@Entity - Use
for multi-table queries (Relations).@Transaction
See DAO templates for Room DAO patterns.
2. Migrate to DataStore
- Replace
withSharedPreferences
(type-safe) orProtoDataStore
.PreferencesDataStore - Inject singleton DataStore instance via Hilt.
See DAO templates for DataStore migration patterns.
Anti-Patterns
- No IO on Main Thread: Room handles dispatchers, but verify Flow collected off-main.
- No @Entity in UI Layer: Map to Domain or UI models in Repository.