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.

Related rules

AWS CDK (TypeScript) CLAUDE.md

CLAUDE.md for AWS CDK v2 apps in TypeScript: constructs, least-privilege grants, snapshot tests, and safe deploys.

Claude Code (CLAUDE.md)AWS CDK

Bun runtime CLAUDE.md

CLAUDE.md for TypeScript projects on Bun 1.2+: bun test, Bun.serve, built-in SQLite/Postgres, and bundling.

Claude Code (CLAUDE.md)Bun

Claude Agent SDK CLAUDE.md

CLAUDE.md for building agents with the Claude Agent SDK (Python/TypeScript): options, tools, permissions, and hooks.

Claude Code (CLAUDE.md)LLM apps & agents

Code reviewer subagent (Claude Code)

A Claude Code subagent definition that reviews the current diff for bugs, security, and tests, reporting by severity.

Claude Code (CLAUDE.md)Agent workflows

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.