kmp-sqldelight-setup

Configures SQLDelight 2 databases with platform drivers and Flow queries in Kotlin Multiplatform projects.

2|Updated Jun 6, 2026
One-click install
npx skills add https://github.com/ronjunevaldoz/kmp-agent-skills --skill kmp-sqldelight-setup-ronjunevaldoz
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kmp-sqldelight-setup
Source: https://github.com/ronjunevaldoz/kmp-agent-skills/tree/main/skills/kmp-sqldelight-setup
Command: npx skills add https://github.com/ronjunevaldoz/kmp-agent-skills --skill kmp-sqldelight-setup-ronjunevaldoz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Setting up local persistence in a Kotlin Multiplatform project requires coordinating Gradle plugin configuration, schema files, migrations, type adapters, and platform-specific drivers across Android, iOS, Desktop, and Web — a process that is error-prone when done manually. ## Core Features & Use Cases - Complete SQLDelight 2 Setup: Configures the Gradle plugin, version catalog entries, and the :core:database module with schema (.sq) files and migrations. - Platform Driver Wiring: Provides expect/actual DriverFactory implementations for Android (AndroidSqliteDriver), iOS (NativeSqliteDriver), Desktop (JdbcSqliteDriver), and Web/JS (WebWorkerDriver). - Reactive Queries & DI: Wires coroutines Flow-based queries, type adapters, transactions, and Koin dependency injection modules. - Use Case: After scaffolding a KMP project, use this Skill to add a local database layer with a User table, Flow-emitting queries, and Koin bindings so feature modules can persist data offline across all platforms. ## Quick Start Ask the agent to set up SQLDelight 2 in the :core:database module with a schema file, platform drivers, and Koin wiring for your KMP project.

Frequently Asked Questions about kmp-sqldelight-setup

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up SQLDelight 2 in a Kotlin Multiplatform project?▼

Add the SQLDelight Gradle plugin and version catalog entries, create .sq schema files in commonMain, and implement an expect/actual DriverFactory per platform. Then wire the database and data sources through a Koin module.

SQLDelight vs Room for Kotlin Multiplatform — which should I use?▼

SQLDelight 2 is the default choice for KMP because it supports Android, iOS, Desktop, and Web with compile-time SQL verification and Flow queries. Room is only preferable when the team is Android-only and shared-module investment is not worthwhile.

Does SQLDelight 2 support WasmJs targets?▼

No, SQLDelight 2.x has no WasmJs driver. For WasmJs targets, use an in-memory store or an alternative persistence strategy such as localStorage via kotlin-wrappers, and track the upstream SQLDelight issue for updates.

How do I write migrations in SQLDelight?▼

Place .sqm files in src/commonMain/sqldelight/migrations/, named by the schema version being migrated from (e.g., 1.sqm). SQLDelight auto-detects the version from the migration files, and verifyMigrations validates them at build time.

Why are my SQLDelight Flow queries not updating after a write?▼

Flow queries only emit when the write and the Flow share the same database instance. Verify that both use the same AppDatabase from Koin, and that queries use asFlow() with mapToList or mapToOneOrNull rather than one-shot executeAsList calls.