mobile-kotlin-multiplatform
Use when the user asks about Kotlin Multiplatform, KMP, Compose Multiplatform, commonMain, expect/actual, shared Kotlin modules for Android and iOS, Ktor…
от j4flmao★ 47 звёзд на GitHub
Установить mobile-kotlin-multiplatform в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Mobile Kotlin Multiplatform
Purpose
Guide for building Kotlin Multiplatform mobile apps with shared business logic, Compose Multiplatform UI, and platform-specific integrations.
Agent Protocol
Trigger
Phrases: "Kotlin Multiplatform", "KMP", "Compose Multiplatform", "shared Kotlin", "KMP module", "expect/actual", "commonMain", "KMP project", "multiplatform library"
Input Context
- Module structure (commonMain, androidMain, iosMain paths)
- Build files (build.gradle.kts with KMP plugin)
- Shared domain models and interfaces
- Platform-specific implementations
Output Artifact
Working KMP module with: commonMain business logic, expect/actual declarations, Compose Multiplatform screens, Gradle multi-module build configuration.
Response Format
No preamble. No postamble. No explanations. No filler/hedging/transitions. Compress output — why use many token when few do trick.
Completion Criteria
- commonMain compiles without platform imports
- expect/actual pairs resolve for all target platforms
- Compose Multiplatform screens render on Android and iOS
- Ktor client calls succeed on all platforms
- SQLDelight queries work cross-platform
Max Response Length
8000 tokens
Architecture Decision Trees
UI Strategy
Need shared UI?
├── Yes → Compose Multiplatform
│ Pros: Single UI codebase, Material3 theming, navigation
│ Cons: Cannot render native components (Map, Camera, WebView)
├── Native UI per platform
│ Pros: Full native API access, platform-native UX
│ Cons: Two UI codebases, more maintenance
└── Hybrid → Compose Multiplatform + expect/actual for native components
Strategy: 80% shared UI via Compose, 20% platform composable via expect
Networking Strategy
API complexity?
├── REST + JSON → Ktor Client + kotlinx.serialization
│ Engine: OkHttp (Android), Darwin (iOS)
├── GraphQL → Apollo Kotlin (KMP support)
└── gRPC → KMP-gRPC (emerging, check compatibility)
Persistence Strategy
Data model complexity?
├── Relational (SQL, joins) → SQLDelight
│ Common schema, platform drivers, Flow support
├── Key-value (settings, preferences) → multiplatform-settings
│ Wraps SharedPreferences (Android), NSUserDefaults (iOS)
├── NoSQL/Document → Realm Kotlin SDK
│ KMP-native, reactive, synchronization
└── Encrypted → SQLCipher (SQLDelight cipher) or platform Keychain/Keystore
Dependency Injection
DI framework preference?
├── Lightweight, KMP-native → Koin
│ No code gen, easy setup, reasonable runtime performance
├── Compile-time verified → Anvil (Dagger-based)
│ Works with KMP, faster than Kapt
└── Manual → Constructor injection with factory pattern
Workflow
KMP project structure — Three-tier source set layout:
commonMain(shared business logic, domain models, repository interfaces, Ktor client, SQLDelight schema, expect declarations),androidMain(Android-specific actual implementations, OkHttp engine, Android Sqlite driver, Context-dependent factories),iosMain(iOS-specific actual implementations, Darwin engine, NativeSqlite driver, platform factories). Additional source sets for testing:commonTest,androidUnitTest,iosTest. The shared module is consumed by Android apps as an AAR library and by iOS apps as a Kotlin/Native framework.expect/actual pattern — Declare platform-agnostic interfaces in
commonMainusingexpectkeyword. Provide concrete implementations in platform source sets withactual. Three forms:expect fun(function),expect class(class with actual constructors),expect object(singleton),expect val(property),expect typealias(type alias for platform types). Example:expect fun generateUuid(): Stringwithactual fun generateUuid(): String = UUID.randomUUID().toString()in Android andactual fun generateUuid(): String = platform.Foundation.NSUUID().UUIDString()in iOS. Keep expect declarations incommonMain/.../platform/package.Ktor client configuration — Single
HttpClientdeclaration incommonMainwith engine-agnostic setup. Usektor-client-corefor common code,ktor-client-okhttpfor Android (supports HTTP/2, caching),ktor-client-darwinfor iOS (uses NSURLSession, automatic cookie storage). Configure serialization withkotlinx-serialization-jsonusingContentNegotiationplugin. Add logging withLoggingplugin. Timeout configuration:HttpTimeoutplugin withrequestTimeoutMillis,connectTimeoutMillis,socketTimeoutMillis.
// commonMain — Ktor client factory
val httpClient = HttpClient {
install(ContentNegotiation) { json(Json { ignoreUnknownKeys = true }) }
install(Logging) { level = LogLevel.HEADERS }
install(HttpTimeout) { requestTimeoutMillis = 15_000 }
defaultRequest { url("https://api.example.com/") }
}
- kotlinx.serialization — All data classes in
commonMainuse@Serializableannotation. Supports primitives, enums, sealed classes, nullable fields, default values. C
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/kmm-concurrency.md
- references/kmm-networking.md
- references/kmp-compose.md
- references/kmp-structure.md
- references/kotlin-multiplatform-advanced.md
- references/kotlin-multiplatform-fundamentals.md
- references/platform-specific.md
FAQ
Что делает скилл mobile-kotlin-multiplatform?
Use when the user asks about Kotlin Multiplatform, KMP, Compose Multiplatform, commonMain, expect/actual, shared Kotlin modules for Android and iOS, Ktor client or SQLDelight. Produces KMP module layout, shared logic and platform interop. Not for Android-only apps (use android) or Kotlin language features (use lang-kotlin).
Как установить скилл mobile-kotlin-multiplatform?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл mobile-kotlin-multiplatform запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
AnthropicGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
webapp-testing
AnthropicToolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
brand-guidelines
AnthropicApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
web-artifacts-builder
AnthropicSuite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…