Agent skill

Datastore

by rcosteira79 in rcosteira79/android-skills

A skill your agent uses 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…

MITAuto-check passedMobile

Install Datastore

skills CLI
$ npx skills add rcosteira79/android-skills --skill datastore -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install rcosteira79/android-skills datastore --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/rcosteira79/android-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/android-skills/skills/datastore .claude/skills/datastore && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
datastore
GitHub stars
151
Token cost
~977 tokens
SKILL.md length
227 words
Files
1
Skills in repo
21
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses 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…

  • Persisting key-value preferences
  • SKILL.md covers Preferences vs Typed vs Room, The two traps and KMP factory — per-platform…
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Small typed settings on Android

What it does

Datastore is an agent skill from rcosteira79/android-skills. 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 per-platform file paths. Triggers on DataStore, Preferences, PreferenceDataStoreFactory, DataStoreFactory, preferencesDataStore, Serializer, SharedPreferences-to-DataStore migration, or persistent settings work.

Its SKILL.md is about 980 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Mobile. It works with Android. The repository describes itself as: Claude Code skills for Android & KMP development. The licence is MIT.

When your agent uses it

  • Persisting key-value preferences
  • Small typed settings on Android
  • KMP with Jetpack DataStore — Preferences vs Typed (Proto/JSON) vs Room selection
  • The IOException and corruption-recovery error traps

Example prompts

  • “/datastore”

What it can do on your machine

Read from SKILL.md and the folder at commit 0f9af5a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are kotlin).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Datastore loads about 977 tokens when it runs. Until then it costs about 125 tokens; SKILL.md has 227 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~125
When it runs · the whole SKILL.md, loaded when a task matches
~977

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from rcosteira79/android-skills at commit 0f9af5a, republished under its MIT licence (© rcosteira79). 227 words, ~977 tokens.

Download SKILL.mdSave it as .claude/skills/datastore/SKILL.md (or your agent's skills folder).
name
datastore
description
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 per-platform file paths. Triggers on DataStore, Preferences, PreferenceDataStoreFactory, DataStoreFactory, preferencesDataStore, Serializer, SharedPreferences-to-DataStore migration, or persistent settings work.

Jetpack DataStore for Android and KMP

Reactive coroutine-based key-value / typed storage; the same androidx.datastore:datastore-preferences-core runs on Android, iOS, and JVM — only the file-path producer is platform-specific. (Web support is 1.3.0-alpha only, and it's sessionStorage/OPFS-backed there, not file-path-based.) This reference covers the storage-choice call plus the two error/path traps, not the basics of Preferences keys, edit { }, or Serializer<T>. Adapted from Meet-Miyani/compose-skill; MIT. Related: android-skills:android-data-layer, android-skills:kmp-boundaries, android-skills:kotlin-flows.

Preferences vs Typed vs Room

NeedStorage
Key-value flags (theme, locale, onboarding done)Preferences DataStore
One typed object, many related fields, schema evolutionTyped DataStore + Serializer<T>
Relational data, indexes, WHERE / JOIN, >100 entries, pagingRoom
Payloads above ~50KB per writeRoom / filesystem — DataStore rewrites the whole file on every edit

Rule of thumb: if a WHERE clause would be useful, use Room.

The two traps

.catch must match IOException specifically — never a broad catch. A bare catch { emit(emptyPreferences()) } swallows CancellationException (breaking structured concurrency) and hides serializer/corruption errors behind a silent empty state.

kotlin
val settings: Flow<UserSettings> = dataStore.data
    .catch { e -> if (e is IOException) emit(emptyPreferences()) else throw e }
    .map { p -> UserSettings(p[Keys.DARK_MODE] ?: false, p[Keys.LOCALE] ?: "en") }

Typed-DataStore corruption recovery triggers on CorruptionException, NOT IOException. The serializer's readFrom must wrap parse failures in CorruptionException, and the store needs a ReplaceFileCorruptionHandler — without it, one corrupt file makes every read fail permanently.

kotlin
object AppSettingsSerializer : Serializer<AppSettings> {
    override val defaultValue = AppSettings()
    override suspend fun readFrom(input: InputStream): AppSettings =
        try { Json.decodeFromString(input.readBytes().decodeToString()) }
        catch (e: SerializationException) { throw CorruptionException("Cannot read AppSettings", e) }
    override suspend fun writeTo(t: AppSettings, output: OutputStream) =
        output.write(Json.encodeToString(t).encodeToByteArray())
}
val store = DataStoreFactory.create(
    serializer = AppSettingsSerializer,
    corruptionHandler = ReplaceFileCorruptionHandler { AppSettings() },
    produceFile = { File(context.filesDir, "app_settings.json") },
)

KMP factory — per-platform path (not the temp dir)

kotlin
// commonMain
fun createPreferencesDataStore(producePath: () -> String): DataStore<Preferences> =
    PreferenceDataStoreFactory.createWithPath(produceFile = { producePath().toPath() })
// android: context.filesDir.resolve(PREFS_FILE).absolutePath
// ios:     NSDocumentDirectory via NSFileManager
// jvm:     File(System.getProperty("user.home"), ".myapp") — NOT java.io.tmpdir (the OS may wipe it on reboot)

(In a composable, never runBlocking on DataStore — it parks the main thread on disk I/O, risking an ANR, and re-runs every recomposition. Expose a StateFlow and collect with collectAsStateWithLifecycle.)

© rcosteira79, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/android-skills/skills/datastore of rcosteira79/android-skills.

Open the folder on GitHubat commit 0f9af5a

Compare with similar skills

Datastore next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Datastore compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Datastore this skillrcosteira79/android-skills151—~977Automated safety check: PassMIT
Compose Multiplatform Patternsmonta-app/ocpp-emulator1805 repos~2kAutomated safety check: PassApache-2.0
Phone HarnessShawnPana/phone-harness3.2k—~4.3kAutomated safety check: PassMIT
Stylesarindamxd/camerax-android1324 repos~2.3kAutomated safety check: PassApache-2.0
Verified Emailarindamxd/camerax-android1324 repos~4.7kAutomated safety check: PassApache-2.0
Argent Metro Debuggerbbplayer-app/BBPlayer1.1k—~3.4kAutomated safety check: PassMIT

Similar skills

  • Compose Multiplatform Patterns

    monta-app/ocpp-emulator

    Compose Multiplatform and Jetpack Compose patterns for KMP projects — state management, navigation, theming, performance, and platform-specific UI.

    180 GitHub starsUsed in 5 repos~2k tokens
    MobileAuto-check passed
  • Phone Harness

    ShawnPana/phone-harness

    Control the user's phone — an iPhone through the Mac's iPhone Mirroring window, an Android over adb, or a rented cloud Android: open apps, tap, type, swipe, read the screen.

    3.2k GitHub stars~4.3k tokensUpdated 11 days ago
    MobileAuto-check passed
  • Styles

    arindamxd/camerax-android

    A skill your agent uses to integrate the Jetpack Compose Styles API into an Android project.

    132 GitHub starsUsed in 4 repos~2.3k tokens
    MobileAuto-check passed
  • Verified Email

    arindamxd/camerax-android

    Provides a complete workflow for implementing verified email retrieval on Android Credential Manager API.

    132 GitHub starsUsed in 4 repos~4.7k tokens
    MobileAuto-check passed
  • Argent Metro Debugger

    bbplayer-app/BBPlayer

    Debug a JS runtime via CDP using argent debugger tools. An agent skill from bbplayer-app/BBPlayer.

    1.1k GitHub stars~3.4k tokensUpdated today
    MobileAuto-check passed
  • 统一 Android XML 资源命名:layout、drawable、mipmap、color、values、id 的前缀与 snakecase 规则;把颜色/圆角/描边/状态编码进文件名(bg、border、textcolor…selector)。

    1.6k GitHub stars~1.3k tokensUpdated 1 mo ago
    MobileAuto-check passed

More from rcosteira79/android-skills

All 21 skills in this repo
  • Guides writing correct, performant Compose and Compose Multiplatform UI across Android, desktop, iOS and web, from state and animation to design-to-code and crash fixes.

    151 GitHub stars~2.6k tokensUpdated 19 days ago
    Auto-check passed
  • Kotlin Multiplatform Boundaries

    rcosteira79/android-skills

    Helps choose how common Kotlin Multiplatform code reaches platform APIs: expect/actual, a common interface with platform bindings, or separate platform screens.

    151 GitHub stars~1.5k tokensUpdated 19 days ago
    Auto-check passed
  • Android Data Layer and Room in KMP

    rcosteira79/android-skills

    Sets out the repository pattern's error-propagation model for Android and Kotlin Multiplatform, plus the Room setup for commonMain.

    151 GitHub stars~1.2k tokensUpdated 19 days ago
    Auto-check passed
  • Android Debugging

    rcosteira79/android-skills

    Android and KMP debugging techniques for crashes, ANRs, memory leaks, R8 traces, Gradle failures and Compose recomposition, built on finding the root cause first.

    151 GitHub stars~2.6k tokensUpdated 19 days ago
    Auto-check passed
  • Android and KMP Baseline

    rcosteira79/android-skills

    Sets house defaults for Android and Kotlin Multiplatform work and routes to the right specialized skill for Compose, networking, testing or build tooling.

    151 GitHub stars~3k tokensUpdated 19 days ago
    Auto-check passed
  • Android Gradle Build Logic

    rcosteira79/android-skills

    Sets up Android Gradle convention plugins in a build-logic composite build, including the version catalog wiring and shared configuration that are easy to get wrong.

    151 GitHub stars~959 tokensUpdated 19 days ago
    Auto-check passed

Works with

Categories

Questions about Datastore

What does Datastore do?

A skill your agent uses 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…. Datastore is an agent skill from rcosteira79/android-skills. 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 per-platform file paths.

When should I use Datastore?

Datastore fits situations like: persisting key-value preferences; small typed settings on Android; KMP with Jetpack DataStore — Preferences vs Typed (Proto/JSON) vs Room selection; the IOException and corruption-recovery error traps.

How do I install Datastore in Claude Code?

Run `npx skills add rcosteira79/android-skills --skill datastore -a claude-code`. Or copy the skill folder (plugins/android-skills/skills/datastore in rcosteira79/android-skills) into .claude/skills/datastore in your project. Claude Code loads it when a task matches its description.

How do I install Datastore in Codex?

Run `npx skills add rcosteira79/android-skills --skill datastore -a codex`. Or copy the skill folder (plugins/android-skills/skills/datastore in rcosteira79/android-skills) into .agents/skills/datastore in your project. Codex loads it when a task matches its description.

Can I use Datastore in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add rcosteira79/android-skills --skill datastore -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/datastore, .gemini/skills/datastore, .github/skills/datastore and .opencode/skills/datastore in your project.

What does Datastore need to run?

SKILL.md names no scripts, command-line tools or credentials: Datastore is instructions for the agent only.

Does Datastore access the network?

SKILL.md names 1 domain. As links in the text: github.com. This is read from the text; nothing was executed.

Is Datastore safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Datastore use?

Datastore is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Datastore use?

About 977 tokens (SKILL.md is roughly 3.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Datastore?

Skills that share tags, products or a category with Datastore: Compose Multiplatform Patterns (monta-app/ocpp-emulator, 180 stars), Phone Harness (ShawnPana/phone-harness, 3.2k stars), Styles (arindamxd/camerax-android, 132 stars) and Verified Email (arindamxd/camerax-android, 132 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Datastore?

rcosteira79 (a GitHub user) maintains it in rcosteira79/android-skills, which has 151 GitHub stars. The repository holds 21 skills in this directory. The repository was last updated on September 19, 2026.

Source: rcosteira79/android-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.