Skip to main content
skill CX Codex

kotlin-multiplatform · travisjneuman — Claude Code skill: setup and guide

Architecture patterns, library recommendations, and templates for Kotlin Multiplatform and Compose Multiplatform codebases.

MIT 183 installs ★ 114 updated 2026-10-25

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add travisjneuman/.claude --skill kotlin-multiplatform -a claude-code
Open on GitHub

What kotlin-multiplatform does

The skill outlines standard project directory structures across Android, iOS, desktop, and web targets. It separates shared UI inside composeApp from shared business logic inside shared, covering Ktor network clients, SQLDelight database tables, and Compose Multiplatform screens.

It provides examples for expect/actual declarations, including platform context resolution and engine selection between OkHttp on Android and Darwin on iOS. It also guides framework export configuration for Swift using CocoaPods or SPM and test setup in commonTest.

The skill recommends keeping expect/actual usage minimal, favoring shared interfaces resolved through dependency injection with Koin.

What it helps with

  • organize shared KMP modules and Compose Multiplatform source sets
  • implement cross-platform HTTP networking with Ktor and serialization
  • generate local database queries and tables using SQLDelight
  • bridge platform-specific APIs between Android and iOS via expect and actual
  • configure shared Kotlin framework export for Xcode and Swift

Example prompts for the agent

  • Set up a Ktor API client inside commonMain for user profiles
  • Create an expect/actual declaration to resolve platform context on Android and iOS
  • Configure a shared SQLDelight schema with select and insert queries

How to install kotlin-multiplatform

1Skills CLI (Vercel)

npx skills add travisjneuman/.claude --skill kotlin-multiplatform -a claude-code

2Manually: put the files in place

~/.claude/skills/kotlin-multiplatform/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/kotlin-multiplatform/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about kotlin-multiplatform

How to install kotlin-multiplatform in Claude Code?

Run npx skills add travisjneuman/.claude --skill kotlin-multiplatform -a claude-code. The skill file will be placed at ~/.claude/skills/kotlin-multiplatform/SKILL.md.

What does kotlin-multiplatform do?

It equips the agent with guidelines for Kotlin Multiplatform development, covering architecture, Ktor, SQLDelight, and Compose Multiplatform.

Which libraries does this skill configure?

It defines patterns for Ktor, kotlinx.serialization, kotlinx.coroutines, SQLDelight, Koin, Compose Multiplatform, kotlinx.datetime, and Napier.

Source text

SKILL.md · MIT
---
name: kotlin-multiplatform
description: >-
  KMP/CMP shared business logic, Compose Multiplatform, expect/actual, Ktor, SQLDelight, and platform-specific implementations. Use when building cross-platform Kotlin applications for Android, iOS, desktop, or web.
---

# Kotlin Multiplatform Skill

Shared business logic and optional shared UI across Android, iOS, desktop, and web.

---

## Project Structure

```
project/
├── composeApp/                    # Shared Compose UI (if using CMP)
│   └── src/
│       ├── commonMain/            # Shared UI code
│       ├── androidMain/           # Android-specific UI
│       ├── iosMain/               # iOS-specific UI
│       └── desktopMain/          # Desktop-specific UI
├── shared/                        # Shared business logic (KMP)
│   └── src/
│       ├── commonMain/            # Shared code
│       │   └── kotlin/
│       │       ├── data/          # Repositories, data sources
│       │       ├── domain/        # Use cases, models
│       │       └── platform/      # expect declarations
│       ├── androidMain/           # actual implementations
│       ├── iosMain/               # actual implementations
│       └── commonTest/            # Shared tests
├── androidApp/                    # Android entry point
├── iosApp/                        # iOS entry point (Xcode project)
├── build.gradle.kts
└── settings.gradle.kts
```

---

## expect/actual Pattern

```kotlin
// commonMain - expect declaration
expect class PlatformContext

expect fun getPlatformName(): String

expect fun createHttpClient(): HttpClient

// androidMain - actual implementation
actual class PlatformContext(val context: android.content.Context)

actual fun getPlatformName(): String = "Android ${Build.VERSION.SDK_INT}"

actual fun createHttpClient(): HttpClient = HttpClient(OkHttp) {
    install(ContentNegotiation) { json() }
}

// iosMain - actual implementation
actual class PlatformContext

actual fun getPlatformName(): String = UIDevice.currentDevice.systemName()

actual fun createHttpClient(): HttpClient = HttpClient(Darwin) {
    install(ContentNegotiation) { json() }
}
```

---

## Key Libraries

| Library | Purpose | Multiplatform? |
|---------|---------|----------------|
| Ktor | HTTP client | Yes |
| kotlinx.serialization | JSON parsing | Yes |
| kotlinx.coroutines | Async/concurrency | Yes |
| SQLDelight | Local database | Yes |
| Koin | Dependency injection | Yes |
| Compose Multiplatform | Shared UI | Yes |
| kotlinx.datetime | Date/time | Yes |
| Napier | Logging | Yes |

---

## Networking with Ktor

```kotlin
// commonMain
class ApiClient(private val httpClient: HttpClient) {
    suspend fun getUsers(): List<User> {
        return httpClient.get("https://api.example.com/users").body()
    }

    suspend fun createUser(input: CreateUserInput): User {
        return httpClient.post("https://api.example.com/users") {
            contentType(ContentType.Application.Json)
            setBody(input)
        }.body()
    }
}

@Serializable
data class User(
    val id: String,
    val name: String,
    val email: String,
)
```

---

## Local Storage with SQLDelight

```sql
-- src/commonMain/sqldelight/com/example/UserQueries.sq
CREATE TABLE user (
    id TEXT NOT NULL PRIMARY KEY,
    name TEXT NOT NULL,
    email TEXT NOT NULL,
    cached_at INTEGER NOT NULL
);

selectAll:
SELECT * FROM user ORDER BY name;

insertOrReplace:
INSERT OR REPLACE INTO user (id, name, email, cached_at)
VALUES (?, ?, ?, ?);

deleteById:
DELETE FROM user WHERE id = ?;
```

---

## Compose Multiplatform UI

```kotlin
// commonMain - Shared composable
@Composable
fun UserListScreen(viewModel: UserListViewModel) {
    val users by viewModel.users.collectAsState()
    val isLoading by viewModel.isLoading.collectAsState()

    Scaffold(
        topBar = { TopAppBar(title = { Text("Users") }) }
    ) { padding ->
        if (isLoading) {
            CircularProgressIndicator(modifier = Modifier.padding(padding))
        } else {
            LazyColumn(modifier = Modifier.padding(padding)) {
                items(users) { user ->
                    UserRow(user = user, onClick = { viewModel.onUserClick(user.id) })
                }
            }
        }
    }
}
```

---

## iOS Integration

### Swift Interop

```swift
// iosApp - Using shared Kotlin code from Swift
import shared

class UserViewController: UIViewController {
    private let viewModel = UserListViewModel()

    override func viewDidLoad() {
        super.viewDidLoad()
        viewModel.users.collect(collector: FlowCollector { users in
            // Update UI with users
        })
    }
}
```

### CocoaPods or SPM Integration

```kotlin
// build.gradle.kts
kotlin {
    iosX64()
    iosArm64()
    iosSimulatorArm64()

    cocoapods {
        summary = "Shared module"
        homepage = "https://example.com"
        ios.deploymentTarget = "16.0"
        framework { baseName = "shared" }
    }
}
```

---

## Testing

```kotlin
// commonTest
class UserRepositoryTest {
    private val fakeApi = FakeApiClient()
    private val repository = UserRepository(fakeApi)

    @Test
    fun fetchUsersReturnsListFromApi() = runTest {
        fakeApi.setUsers(listOf(User("1", "Alice", "[email protected]")))

        val users = repository.getUsers()

        assertEquals(1, users.size)
        assertEquals("Alice", users.first().name)
    }
}
```

---

## Best Practices

- Share business logic (networking, storage, models) — keep platform UI native if needed
- Use `expect`/`actual` sparingly — prefer interfaces with platform implementations via DI
- Keep the shared module thin — avoid pulling in platform-heavy dependencies
- Test shared code in `commonTest` — it runs on all targets
- Use Compose Multiplatform for new projects where native look isn't critical

---

## Related Resources

- `~/.claude/skills/android-development/SKILL.md` - Android patterns
- `~/.claude/skills/ios-development/SKILL.md` - iOS patterns
- `agent-flutter-developer` skill - Alternative cross-platform

---

_Share logic, respect platforms. KMP gives you the best of both worlds._

© travisjneuman · MIT · travisjneuman/.claude

Similar skills

All skills for Mobile →

kotlin-multiplatform by other authors comes first.

kotlin-multiplatform vitorpamplona A skill for the Amethyst repo that tells the agent where Kotlin Multiplatform code belongs and which Gradle trap is about to fire. CX Codex +1 1,600installs compose-multiplatform-patterns affaan-m compose-multiplatform-patterns is a skill that guides shared UI design for Compose Multiplatform and Jetpack Compose in KMP projects, covering state, navigation, theming, and platform-specific UI. CX Codex +1 6,300installs kotlin-specialist VoltAgent Community kotlin-specialist — a subagent for Kotlin 1.9+ development across Android, Ktor, and multiplatform projects. It enforces coroutine patterns, clean functional code, and Detekt analysis. CX Codex 501installs compose-multiplatform AThevon Provides Compose Multiplatform patterns for Android, iOS, Desktop, and Web. It guides UI architecture and platform interop via expect and actual declarations. CX Codex +1 961installs android-clean-architecture affaan-m android-clean-architecture tells the agent how to split an Android or KMP project into layers: modules, dependency rules, UseCases, repositories, plus Room, SQLDelight and Ktor patterns. CX Codex +1 7,200installs apollo-kotlin apollographql Walks the agent through Apollo Kotlin setup in a Gradle project: schema, codegen, an ApolloClient with auth and cache, plus operations. CX Codex +1 1,900installs kotlin-tooling-cocoapods-spm-migration JetBrains The kotlin-tooling-cocoapods-spm-migration skill moves KMP projects from CocoaPods to Swift Package Manager, updating Gradle, Kotlin imports, and the Xcode project. Use it for a staged migration. CX Codex +1 2,100installs

From the same set117

The whole set →
ios-development ios-development — a skill for Claude Code guides native app creation across iOS, iPadOS, tvOS, and watchOS using Swift. Activates when structuring views, configuring async workflows, or matching Apple design rules. CX Codex +1 186installs volunteer-coordinator The volunteer-coordinator skill structures volunteer programs with role definitions, scheduling, skill matching, and communication planning. Use it when setting up or revising volunteer coordination. CX Codex +1 184installs recipe-card-creator The recipe-card-creator skill turns recipe details into structured cards, adjusts quantities for serving counts, and supports meal plans, shopping lists, and collections. CX Codex +1 183installs grant-proposal-builder grant-proposal-builder — a skill for Claude Code that structures nonprofit and research funding applications. Runs when drafting proposals, budget justifications, and project evaluation designs. CX Codex +1 183installs process-flowchart-designer process-flowchart-designer turns process descriptions into ASCII flowcharts, swimlane diagrams, SIPOC maps, and Lean bottleneck analyses. CX Codex +1 183installs application-security application-security is a Claude Code skill for hardening web apps and reviewing security risks. It activates for code reviews, vulnerability checks, and defensive implementation work. CX Codex +1 181installs marketing Marketing frameworks for the agent: brand architecture, positioning, research methods, segmentation, personas and channel metrics, ready to fill with your own data. CX Codex +1 181installs generic-fullstack-feature-developer generic-fullstack-feature-developer guides end-to-end feature development across Next.js App Router, NestJS, and Prisma. Use it when adding full-stack slices, updating schemas, or building API routes. CX Codex +1 180installs

Project sponsors

Companies that keep this analytics open