Skip to content
Skills Library
Programming · Building & coding

Android Database

/Android Database

Store data on Android with Room, SQLite or DataStore, including schema, migrations, threading and testing. Use when the app needs persistence.

Licence
MIT
Last repository change
12.11.2026

Assessment and security

90/ 100Class: good
Format15 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 12.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Store data on Android with Room, SQLite or DataStore, including schema, migrations, threading and testing. Use when the app needs persistence.

Original author description

Store data on Android with Room, SQLite or DataStore, including schema, migrations, threading and testing. Use when the app needs persistence.

How it works

  1. Choose
  2. Room setup
  3. Rules
  4. Check dependencies
  5. Debug on device
Original SKILL.md headings · 59 lines, 242 words
SKILL.md preview
---
name: Android Database
description: Store data on Android with Room, SQLite or DataStore, including schema, migrations, threading and testing. Use when the app needs persistence.
---

# Android Database

## Choose

- **DataStore (Preferences/Proto)**: small key-value settings, no schema.
- **Room**: relational data, queries, migrations, Flow support.
- **Raw SQLite**: only for tiny cases or existing code; Room is safer.

## Room setup

```groovy
implementation 'androidx.room:room-runtime:2.6.1'
annotationProcessor 'androidx.room:room-compiler:2.6.1'
// Kotlin: use ksp/kapt matching the Kotlin plugin
```

```kotlin
@Entity data class Note(@PrimaryKey(autoGenerate = true) val id: Long = 0, val text: String)

@Dao interface NoteDao {
    @Query("SELECT * FROM Note ORDER BY id DESC") fun all(): Flow<List<Note>>
    @Insert suspend fun insert(note: Note): Long
    @Delete suspend fun delete(note: Note)
}

@Database(entities = [Note::class], version = 1)
abstract class AppDb : RoomDatabase() {
    abstract fun notes(): NoteDao
}
```

## Rules

- Never access the database on the main thread.
- Use `suspend`/`Flow`; Room enforces it for queries.
- Every schema change needs a migration or `fallbackToDestructiveMigration`
  only for debug builds.
- Export the schema (`room.schemaLocation`) so migrations are reviewable.
- Test with an in-memory database (`Room.inMemoryDatabaseBuilder`).
- Back up/restore is the app's responsibility; `allowBackup` may be disabled
  for token-bearing apps.

## Check dependencies

Room artifacts may not be in the offline cache. Check with a small build; if
missing, ask before `OC_BUILD_ONLINE=1`.

## Debug on device

```sh
adb shell run-as com.example.app ls databases
adb shell run-as com.example.app sqlite3 databases/app.db '.tables'
```

Run adb normally; `auto` sends the whole command (including variables) to proot.

`sqlite3` may not be present on the device; do not depend on it for the app.

Versions

The database has no other skills named Android Database.

Database snapshot: 13.11.2026 · package version c80e478ba514 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100android-room-database-sqlite-orm
    Use this skill when persisting local offline data on Android devices using type-safe Room DAOs, entities, and database migrations.
  • 100android-development
    Use when building or reviewing native Android apps with Kotlin, Compose, architecture, Room/DataStore persistence, offline sync, or test-driven development; use mobile-platform-operations for store release work.
  • 95datastore
    Use when persisting key-value preferences or small typed settings on Android or KMP with Jetpack DataStore — Preferences vs Typed (Proto/JSON) vs Room selection, the IOException and corruption-recovery error traps, serializers with corruption handlers, and the KMP factory with…
  • 100database-management
    Implement SQLite database patterns using the database.py interface with complete SQL isolation. MANDATORY for all database projects. Use when working with databases, data persistence, or SQLite.
  • 90database-quick
    Use when the product needs to store data — choosing between JSON/SQLite/Supabase/Postgres, schema design, migrations, seeding, and vector search for RAG.
  • 90rust-persistence
    File and SQLite persistence for Cybercore Rust apps. Use for atomic writes, data directories, SQLite setup, and ordered migrations. Do not invent a second database without approval.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.