kotlin-multiplatform
Kotlin Multiplatform lets you write business logic once and deploy it across Android, iOS, web, and desktop targets. This skill helps you evaluate the trade-offs between code sharing and platform-specific optimization, ensuring your architecture decisions align with your project's performance and maintenance goals.
Kotlin Multiplatform helps you decide by weighing code reuse against platform-specific optimization needs. Share business logic, serialization, and domain models in commonMain when the logic is truly platform-agnostic. Keep platform-specific code (UI, native APIs, performance-critical paths) in androidMain, iosMain, or jvmMain. The kotlin-multiplatform skill guides you through this trade-off analysis to avoid leaky abstractions while maximizing shared code.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-07-28
Kotlin Multiplatform helps you decide by weighing code reuse against platform-specific optimization needs. Share business logic, serialization, and domain models in commonMain when the logic is truly platform-agnostic. Keep platform-specific code (UI, native APIs, performance-critical paths) in androidMain, iosMain, or jvmMain. The kotlin-multiplatform skill guides you through this trade-off analysis to avoid leaky abstractions while maximizing shared code.
Use it when
- Kotlin Multiplatform uses a source set hierarchy to organize code by platform scope.
- Kotlin Multiplatform's expect/actual mechanism lets you define an interface in commonMain and provide platform-specific implementations.
Verify before relying
Read SKILL.md below before installing (7 files). Open directory: indexed for reading, not audited.
Install
vitorpamplona/amethyst/kotlin-multiplatform · repository language: Kotlin
Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.
Frequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
Should I share this code across Android, iOS and desktop?
Kotlin Multiplatform helps you decide by weighing code reuse against platform-specific optimization needs. Share business logic, serialization, and domain models in commonMain when the logic is truly platform-agnostic. Keep platform-specific code (UI, native APIs, performance-critical paths) in androidMain, iosMain, or jvmMain. The kotlin-multiplatform skill guides you through this trade-off analysis to avoid leaky abstractions while maximizing shared code.
Where do I put my code: commonMain, androidMain, or iosMain?
Kotlin Multiplatform uses a source set hierarchy to organize code by platform scope. Place truly cross-platform logic in commonMain. Use androidMain and iosMain for platform-specific implementations. For JVM-only libraries shared between Android and desktop, use the jvmAndroid source set to avoid duplication. The kotlin-multiplatform skill teaches you to evaluate each module's dependencies and constraints to choose the right placement.
What are expect/actual patterns and best practices?
Kotlin Multiplatform's expect/actual mechanism lets you define an interface in commonMain and provide platform-specific implementations in androidMain, iosMain, or other targets. Use expect/actual for crypto, file I/O, or native APIs that vary by platform. Best practices include keeping expect declarations minimal, avoiding leaky abstractions, and testing each actual implementation. The kotlin-multiplatform skill covers real-world examples like serialization and platform abstraction.
When should I use the jvmAndroid source set?
The jvmAndroid source set eliminates duplication when a library (like Jackson for serialization) runs on both JVM and Android but not on iOS or web. Kotlin Multiplatform's jvmAndroid pattern lets you write the code once instead of repeating it in androidMain and jvmMain. This skill explains when jvmAndroid is appropriate and how it fits into your overall architecture without creating brittle dependencies.
How do I structure a Kotlin Multiplatform project?
Kotlin Multiplatform projects organize code into a hierarchy: commonMain for shared logic, intermediate source sets (jvmAndroid) for platform pairs, and leaf source sets (androidMain, iosMain, jvmMain) for platform-specific code. The kotlin-multiplatform skill teaches you to design this hierarchy to maximize reuse, minimize maintenance burden, and future-proof your architecture for web and wasm targets as your project grows.
How do I avoid code duplication and leaky abstractions in KMP?
Kotlin Multiplatform reduces duplication by sharing business logic, but poor abstraction design creates leaky abstractions that force platform-specific workarounds. The kotlin-multiplatform skill helps you identify which code genuinely belongs in commonMain versus what should stay platform-specific. Use expect/actual for true platform variations, not as a workaround for incomplete abstractions. This approach keeps your codebase maintainable as you add web and wasm targets.
SKILL.md
Rendered from the published skill. Quoted content, verbatim.
Kotlin Multiplatform: Platform Abstraction Decisions
Expert guidance for KMP architecture in Amethyst - deciding what to share vs keep platform-specific.
When to Use This Skill
Making platform abstraction decisions: - "Should I create expect/actual or keep Android-only?" - "Can I share this ViewModel logic?" - "Where does this crypto/JSON/network implementation belong?" - "This uses Android Context - can it be abstracted?" - "Is this code in the wrong module?" - Preparing for iOS/web/wasm targets - Detecting incorrect placements
Abstraction Decision
(truncated - see the full file via the links below)
File tree — 7 files
.claude/skills/kotlin-multiplatform/SKILL.md
.claude/skills/kotlin-multiplatform/references/abstraction-examples.md
.claude/skills/kotlin-multiplatform/references/expect-actual-catalog.md
.claude/skills/kotlin-multiplatform/references/source-set-hierarchy.md
.claude/skills/kotlin-multiplatform/references/target-compatibility.md
.claude/skills/kotlin-multiplatform/scripts/suggest-kmp-dependency.sh
.claude/skills/kotlin-multiplatform/scripts/validate-kmp-structure.sh
Let your AI agent find skills like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.
wish › “Decide whether to share code across platforms or keep it platform-specific”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
This skill equips you to develop applications that run seamlessly across multiple platforms—Android, iOS, desktop, and web—by leveraging shared Kotlin codebases. Learn to structure projects for maximum code reuse while handling platform-specific implementations efficiently. Master the patterns and tools that make Kotlin Multiplatform a practical choice for teams building truly portable applications.
Compose Expert is a specialized assistant for developers building UIs with Compose and Compose Multiplatform. It covers state management, animations, layouts, navigation, paging, theming, and design-to-code workflows across Android, iOS, Desktop, and Web platforms. The skill activates on Compose API mentions, design system questions, and GitHub PR reviews.
Master Android development using Kotlin and Jetpack Compose for declarative UI building. Learn clean architecture patterns, dependency injection with Hilt, Room database integration, and Retrofit API calls across phones, tablets, TV, Wear OS, and Android Auto.
Master patterns for building shared UI with Compose Multiplatform and Jetpack Compose across multiple platforms. Covers state management with ViewModels, type-safe navigation, reusable composable design, platform-specific implementations, and recomposition optimization.
Compose Expert guides you through creating reusable visual components that work across Android and Desktop platforms. Learn when to share composables in commonMain versus keeping them platform-specific, master state patterns like remember and derivedStateOf, and apply Material3 theming consistently. The skill covers component structure, state hoisting, recomposition optimization, and custom icon creation.
k8s-deploy provides deployment workflows for Kubernetes using kubectl-mcp-server tools, supporting standard deployments via manifests or Helm alongside progressive delivery through Argo Rollouts and Flagger. It covers canary promotions, blue-green strategies, rolling updates, scaling, and rollback operations across single and multi-cluster environments.