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.

More: all Kotlin Multiplatform rules · all Claude Code (CLAUDE.md) rules

Related rules

Kotlin Multiplatform Copilot path instructions

Path-specific Copilot instructions for Kotlin Multiplatform modules: commonMain first, expect/actual, and coroutines.

GitHub CopilotKotlin Multiplatform

SwiftUI iOS app CLAUDE.md

CLAUDE.md for SwiftUI apps on iOS 18+ with Swift 6 strict concurrency, @Observable, SwiftData, and Swift Testing.

Claude Code (CLAUDE.md)Swift / SwiftUI

.NET MAUI rules

Cursor rules for .NET MAUI apps on .NET 10: MVVM with CommunityToolkit.Mvvm, Shell navigation, compiled bindings, DI.

Cursor.NET MAUI

Flutter AGENTS.md

AGENTS.md for Flutter apps with Riverpod, go_router and clean feature-first structure.

AGENTS.mdFlutter

Flutter + Riverpod rules

Cursor rules for Flutter 3 apps using Riverpod 3 with code generation, go_router, and widget tests.

CursorFlutter

Ionic + Capacitor AGENTS.md

AGENTS.md for Ionic 8 apps with Capacitor (Angular, React, or Vue): native plugins, platform sync, and mobile UX rules.

AGENTS.mdIonic / Capacitor

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.