kmp-compose-multiplatform

Guides Kotlin Multiplatform and Compose Multiplatform development with clean architecture patterns.

Updated Jul 1, 2026
One-click install
npx skills add https://github.com/w0lzard/Wolzard-s-Marketplace --skill kmp-compose-multiplatform-w0lzard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kmp-compose-multiplatform
Source: https://github.com/w0lzard/Wolzard-s-Marketplace/tree/main/plugins/personal-skills/skills/kmp-compose-multiplatform
Command: npx skills add https://github.com/w0lzard/Wolzard-s-Marketplace --skill kmp-compose-multiplatform-w0lzard

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building Kotlin Multiplatform apps with Compose Multiplatform requires coordinating many moving parts — shared source sets, expect/actual declarations, Koin DI, Ktor networking, Room persistence, and platform-specific build configuration. This Skill provides expert guidance and production-tested patterns so you avoid architectural mistakes and inconsistent implementations across Android, iOS, Desktop, and Web targets. ## Core Features & Use Cases - Architecture Guidance: Enforces clean architecture with strict Data → Domain → Presentation layering, feature-based modularization, and unidirectional data flow using StateFlow and SharedFlow. - Full-Stack KMP Patterns: Covers Koin dependency injection (scopes, qualifiers, SavedStateHandle), Ktor networking (auth, retry, certificate pinning), Room KMP persistence (DAO, paging, FTS), DataStore, and BuildKonfig environment configuration. - Reference Documentation: Includes in-depth guides on architecture, build system (convention plugins, version catalogs, KSP, R8), Compose best practices (state hoisting, accessibility, performance), and typed error handling with a sealed AppError hierarchy. - Use Case: When scaffolding a new KMP feature module, the Skill generates the correct folder structure, repository/use-case/ViewModel patterns, Koin module wiring, and Gradle configuration following Now in Android conventions. ## Quick Start Ask the assistant to create a new KMP feature module with a repository, use case, ViewModel, and Compose screen following clean architecture.

Frequently Asked Questions about kmp-compose-multiplatform

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

FAQPage Schema
How do I structure a Kotlin Multiplatform project with Compose Multiplatform?

Organize code into commonMain, androidMain, and iosMain source sets with feature-based packages containing data, domain, presentation, and di subfolders. Follow clean architecture where domain holds pure Kotlin interfaces and use cases, data implements repositories, and presentation holds ViewModels with StateFlow.

How to set up Koin dependency injection in KMP shared modules?

Define feature modules with single, factory, and viewModel declarations, then aggregate them in a getAllModules() function. Call initKoin from the Android Application class with androidContext, and from iOS via the generated KoinInitializerKt.doInitKoin() Swift entry point.

Does Room work in Kotlin Multiplatform commonMain?

Yes, Room KMP supports commonMain with expect/actual DatabaseBuilder classes per platform. Android uses a Context-based builder while iOS builds from a file path in NSHomeDirectory, and KSP processors must be added for each target including iosX64, iosArm64, and iosSimulatorArm64.

Should I use mocks or fakes for KMP unit testing?

Use fakes instead of Mockito or MockK, following the Now in Android philosophy that tests should exercise real code paths. Implement repository interfaces with in-memory fake classes in commonTest and use runTest from kotlinx-coroutines-test for coroutine testing.

How do I handle network errors in Ktor for multiplatform apps?

Wrap API calls in a safeApiCall function that maps Ktor exceptions like ClientRequestException and HttpRequestTimeoutException to a sealed AppError hierarchy. Convert these to user-facing strings only at the presentation layer, never exposing raw exceptions to the UI.

When should I use expect/actual versus interfaces in KMP?

Use expect/actual for platform-specific implementations like database builders, logging, and DataStore creation where the API shape is identical across platforms. Use interface injection through Koin when behavior differs significantly or when you need test doubles in commonTest.