Creator · rcosteira79
Last updated · Sep 4, 2026
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 pe
Creator · rcosteira79
Last updated · Sep 4, 2026
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 pe
Creator · rcosteira79
Last updated · Sep 4, 2026
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 pe
Creator · rcosteira79
Last updated · Sep 4, 2026
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 pe
Sandbox only
Install targets
Codex install prompt
Install the "datastore" agent skill from https://github.com/rcosteira79/android-skills/tree/main/plugins/android-skills/skills/datastore. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: 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. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"rcosteira79-datastore","task":"Install datastore","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.Supply asset profile
Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.
Scenario
GitHub automation
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Agent fit
Claude Code + CLI + Codex
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add rcosteira79/android-skills --skill datastore
Maintenance
fresh
13d since push
Risk
Needs review
Quality score needs review
GitHub quality
136
68/100 Quality · 78/100 Trust
Coverage tags
Review notes
Quality score needs review · Stars/forks activity: 136 stars, 14 forks; issue activity unavailable in current metadata
Agent adoption scorecard
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
PromisingUseful candidate, but compare it with alternatives before adopting.
Trust
Sandbox onlyUseful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
Audit
Needs reviewA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Run only in a sandbox and compare close alternatives before using it for real work.
Stars
136 GitHub stars
Repo activity
136 stars, 14 forks
Maintenance
13d since push
License
MIT
Install
npx skills add rcosteira79/android-skills --skill datastore
Install safety
Agent-readable metadata
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
Suited agents
Install decision
Trust and risk
Outcome loop
Install command
npx skills add rcosteira79/android-skills --skill datastoreDo not use when
Agent safety v2
Usable candidate, but the agent should surface permission and audit notes before installation.
Require human approval before installing into a real workspace.
medium
Skill likely fetches remote pages, APIs, repositories, or external services.
medium
Skill may read or write project files, documents, generated artifacts, or local workspace state.
medium
Skill may inspect schemas, query databases, or work with persistent stores.
Agent resolve plan
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20datastore%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20datastore%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/rcosteira79-datastore/install
Agent should check
Copy prompt
Task: Use datastore in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20datastore%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/rcosteira79-datastore/install
Install command: npx skills add rcosteira79/android-skills --skill datastore
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent handoff
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/rcosteira79-datastore/install
LLM text format
/api/skills/rcosteira79-datastore/install?format=text
Find alternatives
/api/skills/search?q=datastore&limit=3
Agent prompt
Use datastore for this task. Review https://www.openagentskill.com/api/skills/rcosteira79-datastore/install, then install with: npx skills add rcosteira79/android-skills --skill datastoreRegistry metadata
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/rcosteira79-datastore
LLM text
/api/registry/manifest/rcosteira79-datastore?format=text
Install alias
/api/registry/install/rcosteira79-datastore
Recommend
/api/registry/recommend?task=Use%20datastore%20in%20an%20agent%20workflow&limit=3
Agent fit
Local desktop
Use-case tags
Platforms
Claude Code
Audit report
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Prototype with this skill first; keep a fallback candidate ready.
Role in stack
Fallback candidate
Primary fit
Local desktop
Trust label
Prototype first
Install path
Command ready
Use when
Evidence
review first
Implementation path
Trust profile
Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
GitHub adoption
INFO136 GitHub stars
Stars/forks activity
CHECK136 stars, 14 forks; issue activity unavailable in current metadata
Recent maintenance
PASS13d since push
License clarity
PASSMIT
Good signals
Review before install
Recommended action
Run only in a sandbox and compare close alternatives before using it for real work.
Quality profile
Useful candidate, but compare it with alternatives before adopting.
Workflow fit
Operate local tools
I need my agent to operate local files and desktop apps in a repeatable workflow.
Analyze markets
I need my agent to analyze markets, financial data, filings, portfolios, and quant strategies.
Manage repositories
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Workflow fit
Inspect, patch, and verify code
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
Ingest, retrieve, and cite
A workflow for document-heavy agents that ingest files, create searchable knowledge, retrieve relevant context, and answer with grounded sources.
Scrape, clean, and reuse web data
A practical workflow for agents that crawl public pages, extract clean content, normalize data, and hand it to downstream research or RAG workflows.
Alternative shortlist
Similar skills that may fit this task.
Apache ECharts is a powerful, interactive charting and data visualization library for browser
Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:
Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 160,000+ scientists worldwide. 140 ready-to-use skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.
Apache Superset is a Data Visualization and Data Exploration Platform
--- 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](https://github.com/Meet-Miyani/compose-skill); MIT. **Related:** `android-skills:android-data-layer`, `android-skills:kmp-boundaries`, `android-skills:kotlin-flows`.
## Preferences vs Typed vs Room
| Need | Storage | |---|---| | Key-value flags (theme, locale, onboarding done) | Preferences DataStore | | One typed object, many related fields, schema evolution | Typed DataStore + `Serializer<T>` | | Relational data, indexes, `WHERE` / `JOIN`, >100 entries, paging | Room | | Payloads above ~50KB per write | Room / 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`.)
Source provenance
Decision snapshot
recent repository activity
Audit
Install and adoption review
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Free and open source. Review the report before installing into production agents.
Growth loop
Scenario-led draft for datastore, ready for a manual X post.
A practical pick for source-backed research: datastore: Use when persisting key-value preferences or small typed settings on Android or KMP with Jetpack DataStore — Preferences vs... 136 stars https://www.openagentskill.com/skills/rcosteira79-datastore?ref=x
Listing + install path for datastore: https://www.openagentskill.com/skills/rcosteira79-datastore?ref=x Install: npx skills add rcosteira79/android-skills --skill datastore
Listing source
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
This Registry indexed listing is attributed to rcosteira79 but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](https://www.openagentskill.com/skills/rcosteira79-datastore?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/rcosteira79-datastore?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/rcosteira79-datastore/audit)
[](https://www.openagentskill.com/skills/rcosteira79-datastore?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)rcosteira79
@rcosteira79
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Sandbox only
Echarts
Apache ECharts is a powerful, interactive charting and data visualization library for browser
67.2K StarsD3
Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:
113.1K StarsScientific Agent Skills
Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 160,000+ scientists worldwide. 140 ready-to-use skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.
33.5K StarsSuperset
Apache Superset is a Data Visualization and Data Exploration Platform
74.7K StarsSandbox only
Install targets
Codex install prompt
Install the "datastore" agent skill from https://github.com/rcosteira79/android-skills/tree/main/plugins/android-skills/skills/datastore. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: 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. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"rcosteira79-datastore","task":"Install datastore","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.Supply asset profile
Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.
Scenario
GitHub automation
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Agent fit
Claude Code + CLI + Codex
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add rcosteira79/android-skills --skill datastore
Maintenance
fresh
13d since push
Risk
Needs review
Quality score needs review
GitHub quality
136
68/100 Quality · 78/100 Trust
Coverage tags
Review notes
Quality score needs review · Stars/forks activity: 136 stars, 14 forks; issue activity unavailable in current metadata
Agent adoption scorecard
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
PromisingUseful candidate, but compare it with alternatives before adopting.
Trust
Sandbox onlyUseful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
Audit
Needs reviewA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Run only in a sandbox and compare close alternatives before using it for real work.
Stars
136 GitHub stars
Repo activity
136 stars, 14 forks
Maintenance
13d since push
License
MIT
Install
npx skills add rcosteira79/android-skills --skill datastore
Install safety
Agent-readable metadata
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
Suited agents
Install decision
Trust and risk
Outcome loop
Install command
npx skills add rcosteira79/android-skills --skill datastoreDo not use when
Agent safety v2
Usable candidate, but the agent should surface permission and audit notes before installation.
Require human approval before installing into a real workspace.
medium
Skill likely fetches remote pages, APIs, repositories, or external services.
medium
Skill may read or write project files, documents, generated artifacts, or local workspace state.
medium
Skill may inspect schemas, query databases, or work with persistent stores.
Agent resolve plan
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20datastore%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20datastore%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/rcosteira79-datastore/install
Agent should check
Copy prompt
Task: Use datastore in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20datastore%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/rcosteira79-datastore/install
Install command: npx skills add rcosteira79/android-skills --skill datastore
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent handoff
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/rcosteira79-datastore/install
LLM text format
/api/skills/rcosteira79-datastore/install?format=text
Find alternatives
/api/skills/search?q=datastore&limit=3
Agent prompt
Use datastore for this task. Review https://www.openagentskill.com/api/skills/rcosteira79-datastore/install, then install with: npx skills add rcosteira79/android-skills --skill datastoreRegistry metadata
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/rcosteira79-datastore
LLM text
/api/registry/manifest/rcosteira79-datastore?format=text
Install alias
/api/registry/install/rcosteira79-datastore
Recommend
/api/registry/recommend?task=Use%20datastore%20in%20an%20agent%20workflow&limit=3
Agent fit
Local desktop
Use-case tags
Platforms
Claude Code
Audit report
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Prototype with this skill first; keep a fallback candidate ready.
Role in stack
Fallback candidate
Primary fit
Local desktop
Trust label
Prototype first
Install path
Command ready
Use when
Evidence
review first
Implementation path
Trust profile
Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
GitHub adoption
INFO136 GitHub stars
Stars/forks activity
CHECK136 stars, 14 forks; issue activity unavailable in current metadata
Recent maintenance
PASS13d since push
License clarity
PASSMIT
Good signals
Review before install
Recommended action
Run only in a sandbox and compare close alternatives before using it for real work.
Quality profile
Useful candidate, but compare it with alternatives before adopting.
Workflow fit
Operate local tools
I need my agent to operate local files and desktop apps in a repeatable workflow.
Analyze markets
I need my agent to analyze markets, financial data, filings, portfolios, and quant strategies.
Manage repositories
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Workflow fit
Inspect, patch, and verify code
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
Ingest, retrieve, and cite
A workflow for document-heavy agents that ingest files, create searchable knowledge, retrieve relevant context, and answer with grounded sources.
Scrape, clean, and reuse web data
A practical workflow for agents that crawl public pages, extract clean content, normalize data, and hand it to downstream research or RAG workflows.
Alternative shortlist
Similar skills that may fit this task.
Apache ECharts is a powerful, interactive charting and data visualization library for browser
Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:
Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 160,000+ scientists worldwide. 140 ready-to-use skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.
Apache Superset is a Data Visualization and Data Exploration Platform
--- 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](https://github.com/Meet-Miyani/compose-skill); MIT. **Related:** `android-skills:android-data-layer`, `android-skills:kmp-boundaries`, `android-skills:kotlin-flows`.
## Preferences vs Typed vs Room
| Need | Storage | |---|---| | Key-value flags (theme, locale, onboarding done) | Preferences DataStore | | One typed object, many related fields, schema evolution | Typed DataStore + `Serializer<T>` | | Relational data, indexes, `WHERE` / `JOIN`, >100 entries, paging | Room | | Payloads above ~50KB per write | Room / 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`.)
Source provenance
Decision snapshot
recent repository activity
Audit
Install and adoption review
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Free and open source. Review the report before installing into production agents.
Growth loop
Scenario-led draft for datastore, ready for a manual X post.
A practical pick for source-backed research: datastore: Use when persisting key-value preferences or small typed settings on Android or KMP with Jetpack DataStore — Preferences vs... 136 stars https://www.openagentskill.com/skills/rcosteira79-datastore?ref=x
Listing + install path for datastore: https://www.openagentskill.com/skills/rcosteira79-datastore?ref=x Install: npx skills add rcosteira79/android-skills --skill datastore
Listing source
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
This Registry indexed listing is attributed to rcosteira79 but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](https://www.openagentskill.com/skills/rcosteira79-datastore?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/rcosteira79-datastore?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/rcosteira79-datastore/audit)
[](https://www.openagentskill.com/skills/rcosteira79-datastore?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)rcosteira79
@rcosteira79
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Sandbox only
Echarts
Apache ECharts is a powerful, interactive charting and data visualization library for browser
67.2K StarsD3
Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:
113.1K StarsScientific Agent Skills
Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 160,000+ scientists worldwide. 140 ready-to-use skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.
33.5K StarsSuperset
Apache Superset is a Data Visualization and Data Exploration Platform
74.7K StarsSandbox only
Install targets
Codex install prompt
Install the "datastore" agent skill from https://github.com/rcosteira79/android-skills/tree/main/plugins/android-skills/skills/datastore. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: 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. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"rcosteira79-datastore","task":"Install datastore","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.Supply asset profile
Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.
Scenario
GitHub automation
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Agent fit
Claude Code + CLI + Codex
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add rcosteira79/android-skills --skill datastore
Maintenance
fresh
13d since push
Risk
Needs review
Quality score needs review
GitHub quality
136
68/100 Quality · 78/100 Trust
Coverage tags
Review notes
Quality score needs review · Stars/forks activity: 136 stars, 14 forks; issue activity unavailable in current metadata
Agent adoption scorecard
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
PromisingUseful candidate, but compare it with alternatives before adopting.
Trust
Sandbox onlyUseful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
Audit
Needs reviewA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Run only in a sandbox and compare close alternatives before using it for real work.
Stars
136 GitHub stars
Repo activity
136 stars, 14 forks
Maintenance
13d since push
License
MIT
Install
npx skills add rcosteira79/android-skills --skill datastore
Install safety
Agent-readable metadata
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
Suited agents
Install decision
Trust and risk
Outcome loop
Install command
npx skills add rcosteira79/android-skills --skill datastoreDo not use when
Agent safety v2
Usable candidate, but the agent should surface permission and audit notes before installation.
Require human approval before installing into a real workspace.
medium
Skill likely fetches remote pages, APIs, repositories, or external services.
medium
Skill may read or write project files, documents, generated artifacts, or local workspace state.
medium
Skill may inspect schemas, query databases, or work with persistent stores.
Agent resolve plan
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20datastore%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20datastore%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/rcosteira79-datastore/install
Agent should check
Copy prompt
Task: Use datastore in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20datastore%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/rcosteira79-datastore/install
Install command: npx skills add rcosteira79/android-skills --skill datastore
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent handoff
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/rcosteira79-datastore/install
LLM text format
/api/skills/rcosteira79-datastore/install?format=text
Find alternatives
/api/skills/search?q=datastore&limit=3
Agent prompt
Use datastore for this task. Review https://www.openagentskill.com/api/skills/rcosteira79-datastore/install, then install with: npx skills add rcosteira79/android-skills --skill datastoreRegistry metadata
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/rcosteira79-datastore
LLM text
/api/registry/manifest/rcosteira79-datastore?format=text
Install alias
/api/registry/install/rcosteira79-datastore
Recommend
/api/registry/recommend?task=Use%20datastore%20in%20an%20agent%20workflow&limit=3
Agent fit
Local desktop
Use-case tags
Platforms
Claude Code
Audit report
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Prototype with this skill first; keep a fallback candidate ready.
Role in stack
Fallback candidate
Primary fit
Local desktop
Trust label
Prototype first
Install path
Command ready
Use when
Evidence
review first
Implementation path
Trust profile
Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
GitHub adoption
INFO136 GitHub stars
Stars/forks activity
CHECK136 stars, 14 forks; issue activity unavailable in current metadata
Recent maintenance
PASS13d since push
License clarity
PASSMIT
Good signals
Review before install
Recommended action
Run only in a sandbox and compare close alternatives before using it for real work.
Quality profile
Useful candidate, but compare it with alternatives before adopting.
Workflow fit
Operate local tools
I need my agent to operate local files and desktop apps in a repeatable workflow.
Analyze markets
I need my agent to analyze markets, financial data, filings, portfolios, and quant strategies.
Manage repositories
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Workflow fit
Inspect, patch, and verify code
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
Ingest, retrieve, and cite
A workflow for document-heavy agents that ingest files, create searchable knowledge, retrieve relevant context, and answer with grounded sources.
Scrape, clean, and reuse web data
A practical workflow for agents that crawl public pages, extract clean content, normalize data, and hand it to downstream research or RAG workflows.
Alternative shortlist
Similar skills that may fit this task.
Apache ECharts is a powerful, interactive charting and data visualization library for browser
Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:
Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 160,000+ scientists worldwide. 140 ready-to-use skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.
Apache Superset is a Data Visualization and Data Exploration Platform
--- 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](https://github.com/Meet-Miyani/compose-skill); MIT. **Related:** `android-skills:android-data-layer`, `android-skills:kmp-boundaries`, `android-skills:kotlin-flows`.
## Preferences vs Typed vs Room
| Need | Storage | |---|---| | Key-value flags (theme, locale, onboarding done) | Preferences DataStore | | One typed object, many related fields, schema evolution | Typed DataStore + `Serializer<T>` | | Relational data, indexes, `WHERE` / `JOIN`, >100 entries, paging | Room | | Payloads above ~50KB per write | Room / 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`.)
Source provenance
Decision snapshot
recent repository activity
Audit
Install and adoption review
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Free and open source. Review the report before installing into production agents.
Growth loop
Scenario-led draft for datastore, ready for a manual X post.
A practical pick for source-backed research: datastore: Use when persisting key-value preferences or small typed settings on Android or KMP with Jetpack DataStore — Preferences vs... 136 stars https://www.openagentskill.com/skills/rcosteira79-datastore?ref=x
Listing + install path for datastore: https://www.openagentskill.com/skills/rcosteira79-datastore?ref=x Install: npx skills add rcosteira79/android-skills --skill datastore
Listing source
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
This Registry indexed listing is attributed to rcosteira79 but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](https://www.openagentskill.com/skills/rcosteira79-datastore?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/rcosteira79-datastore?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/rcosteira79-datastore/audit)
[](https://www.openagentskill.com/skills/rcosteira79-datastore?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)rcosteira79
@rcosteira79
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Sandbox only
Echarts
Apache ECharts is a powerful, interactive charting and data visualization library for browser
67.2K StarsD3
Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:
113.1K StarsScientific Agent Skills
Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 160,000+ scientists worldwide. 140 ready-to-use skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.
33.5K StarsSuperset
Apache Superset is a Data Visualization and Data Exploration Platform
74.7K StarsSandbox only
Install targets
Codex install prompt
Install the "datastore" agent skill from https://github.com/rcosteira79/android-skills/tree/main/plugins/android-skills/skills/datastore. Read its SKILL.md or equivalent instructions first, install only the files needed for this workspace, and summarize any required setup before using it. Skill purpose: 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. After the install attempt, report the result to https://www.openagentskill.com/api/agent/outcome with POST JSON {"event_id":"install_<unique-id>","skill_slug":"rcosteira79-datastore","task":"Install datastore","agent":"codex","outcome":"success","install_used":true}. Replace event_id with a unique value and outcome with success or failed. Report success only after the skill is installed and a minimal verification passes.Supply asset profile
Code review, repo analysis, testing, CI, GitHub, DevOps, and developer workflow skills.
Scenario
GitHub automation
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Agent fit
Claude Code + CLI + Codex
Codex, Claude Code, Cursor, CLI, or custom agents.
Install
Ready
npx skills add rcosteira79/android-skills --skill datastore
Maintenance
fresh
13d since push
Risk
Needs review
Quality score needs review
GitHub quality
136
68/100 Quality · 78/100 Trust
Coverage tags
Review notes
Quality score needs review · Stars/forks activity: 136 stars, 14 forks; issue activity unavailable in current metadata
Agent adoption scorecard
These scores combine public repository metadata, OpenAgentSkill review signals, maintenance freshness, and install readiness. They are a shortlist signal, not a replacement for human review.
Quality
PromisingUseful candidate, but compare it with alternatives before adopting.
Trust
Sandbox onlyUseful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
Audit
Needs reviewA machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
OpenAgentSkill Trust Score v5
Run only in a sandbox and compare close alternatives before using it for real work.
Stars
136 GitHub stars
Repo activity
136 stars, 14 forks
Maintenance
13d since push
License
MIT
Install
npx skills add rcosteira79/android-skills --skill datastore
Install safety
Agent-readable metadata
Use this block or the embedded JSON to decide whether an agent should install this skill, choose an alternative, or ask for human review first.
Suited tasks
Suited agents
Install decision
Trust and risk
Outcome loop
Install command
npx skills add rcosteira79/android-skills --skill datastoreDo not use when
Agent safety v2
Usable candidate, but the agent should surface permission and audit notes before installation.
Require human approval before installing into a real workspace.
medium
Skill likely fetches remote pages, APIs, repositories, or external services.
medium
Skill may read or write project files, documents, generated artifacts, or local workspace state.
medium
Skill may inspect schemas, query databases, or work with persistent stores.
Agent resolve plan
The Resolve API returns the selected skill, alternatives, safety policy, audit notes, install target, and copy-paste prompt an agent can follow without scraping this page.
Open JSON
/api/agent/resolve?task=Use%20datastore%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Resolve text
/api/agent/resolve?task=Use%20datastore%20for%20an%20agent%20workflow&agent=codex&max_risk=medium&format=text
Install handoff
/api/skills/rcosteira79-datastore/install
Agent should check
Copy prompt
Task: Use datastore in this workspace.
Resolve first: https://www.openagentskill.com/api/agent/resolve?task=Use%20datastore%20for%20an%20agent%20workflow&agent=codex&max_risk=medium
Review install handoff: https://www.openagentskill.com/api/skills/rcosteira79-datastore/install
Install command: npx skills add rcosteira79/android-skills --skill datastore
Before running it, summarize audit warnings, required permissions, and the fallback skill if install is risky.Agent handoff
Use the public install endpoint to fetch the command, safety checklist, target prompts, and canonical links for this skill.
Install handoff
/api/skills/rcosteira79-datastore/install
LLM text format
/api/skills/rcosteira79-datastore/install?format=text
Find alternatives
/api/skills/search?q=datastore&limit=3
Agent prompt
Use datastore for this task. Review https://www.openagentskill.com/api/skills/rcosteira79-datastore/install, then install with: npx skills add rcosteira79/android-skills --skill datastoreRegistry metadata
This page exposes the same decision, trust, audit, use-case, and install signals through the Registry API, so agents can rank this skill without scraping the UI.
Manifest
/api/registry/manifest/rcosteira79-datastore
LLM text
/api/registry/manifest/rcosteira79-datastore?format=text
Install alias
/api/registry/install/rcosteira79-datastore
Recommend
/api/registry/recommend?task=Use%20datastore%20in%20an%20agent%20workflow&limit=3
Agent fit
Local desktop
Use-case tags
Platforms
Claude Code
Audit report
A machine-readable review of install readiness, security metadata, maintenance, and adoption risk.
Agent decision cockpit
Prototype with this skill first; keep a fallback candidate ready.
Role in stack
Fallback candidate
Primary fit
Local desktop
Trust label
Prototype first
Install path
Command ready
Use when
Evidence
review first
Implementation path
Trust profile
Useful candidate with missing or mixed trust signals. Keep it in an isolated workspace until the outcome loop proves task fit.
GitHub adoption
INFO136 GitHub stars
Stars/forks activity
CHECK136 stars, 14 forks; issue activity unavailable in current metadata
Recent maintenance
PASS13d since push
License clarity
PASSMIT
Good signals
Review before install
Recommended action
Run only in a sandbox and compare close alternatives before using it for real work.
Quality profile
Useful candidate, but compare it with alternatives before adopting.
Workflow fit
Operate local tools
I need my agent to operate local files and desktop apps in a repeatable workflow.
Analyze markets
I need my agent to analyze markets, financial data, filings, portfolios, and quant strategies.
Manage repositories
I need my agent to triage GitHub issues, review pull requests, and summarize repository changes.
Workflow fit
Inspect, patch, and verify code
A workflow for software agents that inspect repositories, review pull requests, generate tests, and turn findings into shippable patches.
Ingest, retrieve, and cite
A workflow for document-heavy agents that ingest files, create searchable knowledge, retrieve relevant context, and answer with grounded sources.
Scrape, clean, and reuse web data
A practical workflow for agents that crawl public pages, extract clean content, normalize data, and hand it to downstream research or RAG workflows.
Alternative shortlist
Similar skills that may fit this task.
Apache ECharts is a powerful, interactive charting and data visualization library for browser
Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:
Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 160,000+ scientists worldwide. 140 ready-to-use skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.
Apache Superset is a Data Visualization and Data Exploration Platform
--- 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](https://github.com/Meet-Miyani/compose-skill); MIT. **Related:** `android-skills:android-data-layer`, `android-skills:kmp-boundaries`, `android-skills:kotlin-flows`.
## Preferences vs Typed vs Room
| Need | Storage | |---|---| | Key-value flags (theme, locale, onboarding done) | Preferences DataStore | | One typed object, many related fields, schema evolution | Typed DataStore + `Serializer<T>` | | Relational data, indexes, `WHERE` / `JOIN`, >100 entries, paging | Room | | Payloads above ~50KB per write | Room / 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`.)
Source provenance
Decision snapshot
recent repository activity
Audit
Install and adoption review
Agent-proven evidence
Outcome reports after resolve, review, install, and one narrow run.
No agent outcome data yet. The first agent run can report success, setup needs, risk blocks, failure, or not-relevant through /api/agent/outcome.
Install
Free and open source. Review the report before installing into production agents.
Growth loop
Scenario-led draft for datastore, ready for a manual X post.
A practical pick for source-backed research: datastore: Use when persisting key-value preferences or small typed settings on Android or KMP with Jetpack DataStore — Preferences vs... 136 stars https://www.openagentskill.com/skills/rcosteira79-datastore?ref=x
Listing + install path for datastore: https://www.openagentskill.com/skills/rcosteira79-datastore?ref=x Install: npx skills add rcosteira79/android-skills --skill datastore
Listing source
This listing was indexed from public sources and is not marked official until a maintainer claim is approved.
Attribution links to the public repository or creator profile. Creators can claim the listing to update ownership signals.
Claim this skillOwner claim
This Registry indexed listing is attributed to rcosteira79 but is not marked official yet. Claim it to add a verified owner signal and make future launch, install, and audit updates easier to trust.
Creator backlink kit
Show the canonical listing, current trust and audit signals, and real Agent-Proven evidence where developers evaluate the repository.
[](https://www.openagentskill.com/skills/rcosteira79-datastore?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/rcosteira79-datastore?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)
[](https://www.openagentskill.com/skills/rcosteira79-datastore/audit)
[](https://www.openagentskill.com/skills/rcosteira79-datastore?ref=github&utm_source=github&utm_medium=referral&utm_campaign=creator_badge)rcosteira79
@rcosteira79
Share whether this skill looks useful for your agent workflow. Aggregated feedback improves rankings over time.
Sandbox only
Echarts
Apache ECharts is a powerful, interactive charting and data visualization library for browser
67.2K StarsD3
Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:
113.1K StarsScientific Agent Skills
Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 160,000+ scientists worldwide. 140 ready-to-use skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.
33.5K StarsSuperset
Apache Superset is a Data Visualization and Data Exploration Platform
74.7K StarsPermission surface
filesystem or document access, database access
Agent outcomes
No agent outcome data yet
Docs
Usable metadata, review docs
Risk summary
Install readiness
Permission surface
filesystem or document access, database access
Agent outcomes
No agent outcome data yet
Docs
Usable metadata, review docs
Risk summary
Install readiness
Permission surface
filesystem or document access, database access
Agent outcomes
No agent outcome data yet
Docs
Usable metadata, review docs
Risk summary
Install readiness
Permission surface
filesystem or document access, database access
Agent outcomes
No agent outcome data yet
Docs
Usable metadata, review docs
Risk summary
Install readiness