Home › Kotlin Multiplatform › Kotlin Multiplatform + Compose Multiplatform CLAUDE.md
Kotlin Multiplatform + Compose Multiplatform CLAUDE.md
CLAUDE.md for Kotlin Multiplatform apps sharing UI with Compose Multiplatform across Android, iOS, desktop, and web.
Claude Code (CLAUDE.md)Kotlin Multiplatform
How to use
Save this as CLAUDE.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.
CLAUDE.mdDownload # CLAUDE.md: KMP + Compose Multiplatform
## Commands
- `./gradlew :composeApp:assembleDebug` (Android) · `./gradlew :composeApp:run` (desktop) · `./gradlew allTests` · `./gradlew detekt` or `ktlintCheck`
- iOS: open `iosApp/iosApp.xcodeproj` or `./gradlew :composeApp:iosSimulatorArm64Test`
## Structure
- `composeApp/src/commonMain`: shared UI (Compose), ViewModels, navigation, resources.
- `shared/` or `core/*` modules: domain, data (Ktor, SQLDelight/Room KMP, DataStore), DI (Koin).
- Platform folders (`androidMain`, `iosMain`, `desktopMain`, `wasmJsMain`) only for platform glue.
## Rules
- Default to `commonMain`. Before writing `expect`/`actual`, check for a multiplatform library.
- Resources via Compose Multiplatform resources (`Res.string.title`, `Res.drawable.logo`) in `composeResources/`, not Android `R`.
- ViewModels from `androidx.lifecycle` (multiplatform) exposing `StateFlow` UI state; collect with `collectAsStateWithLifecycle()`.
- Navigation with the multiplatform Navigation Compose library and `@Serializable` routes.
- No `java.*`/`android.*` imports in common code; use kotlinx-datetime, kotlinx-io, Okio.
- Keep the iOS entry (`MainViewController`) thin; Swift code only for things Compose can't do.
- Dependencies in `gradle/libs.versions.toml`; keep Kotlin, Compose plugin and AGP versions compatible (check the compatibility table before bumping).
## Tests
`commonTest` with `kotlin.test`, `runTest`, and Turbine for flows; UI tests with the Compose multiplatform test APIs.