Skillshub android-persistence

Standards for Room Database and DataStore. Use when implementing Room database schemas or DataStore preferences in Android. (triggers: **/*Dao.kt, **/*Database.kt, **/*Entity.kt, @Dao, @Entity, RoomDatabase)

install
source · Clone the upstream repo
git clone https://github.com/ComeOnOliver/skillshub
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/HoangNguyen0403/agent-skills-standard/android-persistence" ~/.claude/skills/comeonoliver-skillshub-android-persistence && rm -rf "$T"
manifest: skills/HoangNguyen0403/agent-skills-standard/android-persistence/SKILL.md
source content

Android Persistence Standards

Priority: P0

Implementation Guidelines

Room

  • Async: Return
    Flow<List<T>>
    for queries, use
    suspend
    for Write/Insert.
  • Entities: Keep simple
    @Entity
    data classes. Map to Domain models in Repository.
  • Transactions: Use
    @Transaction
    for multi-table queries (Relations).

DataStore

  • Usage: Replace
    SharedPreferences
    with
    ProtoDataStore
    (Type-safe) or
    PreferencesDataStore
    .
  • Scope: Inject singleton instance via Hilt.

Anti-Patterns

  • No IO on Main Thread: Room handles dispatchers, but verify Flow is collected off-main.
  • No @Entity in UI Layer: Map to Domain or UI models in Repository.

References