Kotlin Multiplatform Development Standards
Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178.
Use When
- Kotlin Multiplatform shared module development standards for sharing business logic across Android and iOS while keeping native UI. Covers project structure (shared/composeApp/iosApp), source sets, targets, expect/actual, DI (Koin)...
Evidence Produced
| Category |
Artifact |
Format |
Example |
| Correctness |
Shared-module contract test results |
CI log or recorded test report covering commonTest / actual / expect surfaces |
docs/kmp/shared-tests-2026-04-16.md |
References
- Use the
references/ directory for deep detail after reading the core workflow below.
references/kmp-compose-multiplatform.md for shared Compose UI across Android, iOS, Desktop, and Web targets.
references/kmp-tdd.md for shared-module Red-Green-Refactor, common tests, and expect/actual test strategy.
- For iOS targets in 2026+ Apple toolchains, load
../../ios/ios-development/references/apple-platform-compatibility-wwdc26.md and keep SwiftUI-native UI, Xcode 27, Swift 6.4, and availability gates in the iosApp/ module.
Strategy: Shared Logic, Native UI
KMP shares business logic (domain, data, networking) across platforms. Each
platform keeps its native UI framework: Jetpack Compose for Android, SwiftUI
for iOS. This preserves the best user experience on each platform while
eliminating business logic duplication.
Module-to-Skill Mapping
| Module |
Governs |
Skill |
shared/ |
Business logic, data, networking |
This skill (kmp-development) |
composeApp/ |
Android UI, platform integration |
android-development |
iosApp/ |
iOS UI, platform integration, Apple availability gates, Xcode 27 release evidence |
ios-development |
Project Structure
Every KMP project has three modules:
project-root/
shared/ # Shared Kotlin module (this skill governs)
src/
commonMain/ # Shared code (domain, data, use cases)
kotlin/
resources/
androidMain/ # Android-specific implementations
kotlin/
AndroidManifest.xml
iosMain/ # iOS-specific implementations
kotlin/
commonTest/ # Shared tests
androidUnitTest/ # Android-specific tests
iosTest/ # iOS-specific tests
build.gradle.kts # KMP Gradle config
composeApp/ # Android app (follow android-development skill)
src/main/
build.gradle.kts
iosApp/ # iOS Xcode project (follow ios-development skill)
iosApp/
iosApp.xcodeproj
build.gradle.kts # Root build file
gradle/libs.versions.toml # Version catalog
Additional Guidance
Decision Rules
| Code concern |
Location |
| Pure domain rule, validation, or API model |
commonMain |
| Stable platform service with distinct implementations |
Narrow expect/actual or injected interface |
| Native navigation, accessibility, or platform interaction |
Platform source set and native UI |
| Library lacks supported targets |
Choose an alternative or isolate it; do not leak it into common code |
Capability Contract And Degraded Mode
Read and search all target source sets before moving code. Edits and builds require authority. Without both Android and iOS toolchains, return the target-specific checks still outstanding and do not claim parity.
If either target toolchain is unavailable, mark cross-platform parity unverified.
Domain Anti-Patterns
- Moving UI wholesale into shared code by default. Fix: share stable logic and keep native experiences intentional.
- Spreading expect/actual across domain types. Fix: inject one narrow platform service.
- Choosing dependencies from Android support alone. Fix: verify every declared target.
- Catching platform errors as generic strings. Fix: map them into a shared typed error model.
- Declaring parity after one target builds. Fix: run shared and platform tests on both targets.
Extended guidance for kmp-development was moved to references/skill-deep-dive.md to keep this entrypoint compact and fast to load.
Use that deep dive for:
Technology Stack
Source Sets and Targets
Architecture: Clean Architecture in Shared Module
Expect/Actual Pattern
Dependency Injection with Koin
Networking with Ktor
Database with SQLDelight
Modularization
Native Library Integration
Tooling
Mandatory Rules
Anti-Patterns
Inputs
| Artefact |
Required? |
Purpose |
| Shared-domain scope, platform capabilities, API contracts, and native UX boundaries |
yes |
Choose KMP sharing boundaries |
Outputs
- Produce KMP architecture or code with shared/native separation, tests, and platform integration evidence.
Degraded mode
Fallback without both platform toolchains: validate shared code and mark native integration unverified.
Capability contract
Builds and tests follow task scope; signing, store release, backend mutation, and destructive device actions require explicit authority.
1---2name: kmp-development3description: Use when sharing Kotlin business logic across Android and iOS with Kotlin Multiplatform while retaining deliberate platform boundaries; use native development skills for platform UI and release work.4---56# Kotlin Multiplatform Development Standards7Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178.89<!-- dual-compat-start -->10## Use When1112- Kotlin Multiplatform shared module development standards for sharing business logic across Android and iOS while keeping native UI. Covers project structure (shared/composeApp/iosApp), source sets, targets, expect/actual, DI (Koin)...1314## Evidence Produced1516| Category | Artifact | Format | Example |17|----------|----------|--------|---------|18| Correctness | Shared-module contract test results | CI log or recorded test report covering commonTest / actual / expect surfaces | `docs/kmp/shared-tests-2026-04-16.md` |1920## References2122- Use the `references/` directory for deep detail after reading the core workflow below.23- `references/kmp-compose-multiplatform.md` for shared Compose UI across Android, iOS, Desktop, and Web targets.24- `references/kmp-tdd.md` for shared-module Red-Green-Refactor, common tests, and expect/actual test strategy.25- For iOS targets in 2026+ Apple toolchains, load `../../ios/ios-development/references/apple-platform-compatibility-wwdc26.md` and keep SwiftUI-native UI, Xcode 27, Swift 6.4, and availability gates in the `iosApp/` module.26<!-- dual-compat-end -->27## Strategy: Shared Logic, Native UI2829KMP shares business logic (domain, data, networking) across platforms. Each30platform keeps its native UI framework: Jetpack Compose for Android, SwiftUI31for iOS. This preserves the best user experience on each platform while32eliminating business logic duplication.3334## Module-to-Skill Mapping3536| Module | Governs | Skill |37|---|---|---|38| `shared/` | Business logic, data, networking | **This skill** (kmp-development) |39| `composeApp/` | Android UI, platform integration | android-development |40| `iosApp/` | iOS UI, platform integration, Apple availability gates, Xcode 27 release evidence | ios-development |4142## Project Structure4344Every KMP project has three modules:4546```text47project-root/48 shared/ # Shared Kotlin module (this skill governs)49 src/50 commonMain/ # Shared code (domain, data, use cases)51 kotlin/52 resources/53 androidMain/ # Android-specific implementations54 kotlin/55 AndroidManifest.xml56 iosMain/ # iOS-specific implementations57 kotlin/58 commonTest/ # Shared tests59 androidUnitTest/ # Android-specific tests60 iosTest/ # iOS-specific tests61 build.gradle.kts # KMP Gradle config62 composeApp/ # Android app (follow android-development skill)63 src/main/64 build.gradle.kts65 iosApp/ # iOS Xcode project (follow ios-development skill)66 iosApp/67 iosApp.xcodeproj68 build.gradle.kts # Root build file69 gradle/libs.versions.toml # Version catalog70```7172## Additional Guidance7374## Decision Rules7576| Code concern | Location |77|---|---|78| Pure domain rule, validation, or API model | `commonMain` |79| Stable platform service with distinct implementations | Narrow expect/actual or injected interface |80| Native navigation, accessibility, or platform interaction | Platform source set and native UI |81| Library lacks supported targets | Choose an alternative or isolate it; do not leak it into common code |8283## Capability Contract And Degraded Mode8485Read and search all target source sets before moving code. Edits and builds require authority. Without both Android and iOS toolchains, return the target-specific checks still outstanding and do not claim parity.86If either target toolchain is unavailable, mark cross-platform parity unverified.8788## Domain Anti-Patterns8990- Moving UI wholesale into shared code by default. Fix: share stable logic and keep native experiences intentional.91- Spreading expect/actual across domain types. Fix: inject one narrow platform service.92- Choosing dependencies from Android support alone. Fix: verify every declared target.93- Catching platform errors as generic strings. Fix: map them into a shared typed error model.94- Declaring parity after one target builds. Fix: run shared and platform tests on both targets.9596Extended guidance for `kmp-development` was moved to [references/skill-deep-dive.md](references/skill-deep-dive.md) to keep this entrypoint compact and fast to load.9798Use that deep dive for:99- `Technology Stack`100- `Source Sets and Targets`101- `Architecture: Clean Architecture in Shared Module`102- `Expect/Actual Pattern`103- `Dependency Injection with Koin`104- `Networking with Ktor`105- `Database with SQLDelight`106- `Modularization`107- `Native Library Integration`108- `Tooling`109- `Mandatory Rules`110- `Anti-Patterns`111## Inputs112| Artefact | Required? | Purpose |113|---|---|---|114| Shared-domain scope, platform capabilities, API contracts, and native UX boundaries | yes | Choose KMP sharing boundaries |115## Outputs116- Produce KMP architecture or code with shared/native separation, tests, and platform integration evidence.117## Degraded mode118Fallback without both platform toolchains: validate shared code and mark native integration unverified.119## Capability contract120Builds and tests follow task scope; signing, store release, backend mutation, and destructive device actions require explicit authority.