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
npx skills add travisjneuman/.claude --skill kotlin-multiplatform -a claude-codeWhat 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-code2Manually: put the files in place
~/.claude/skills/kotlin-multiplatform/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/kotlin-multiplatform/
1Skills CLI (Vercel)
npx skills add travisjneuman/.claude --skill kotlin-multiplatform -a codex2Manually: put the files in place
.agents/skills/kotlin-multiplatform/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add travisjneuman/.claude --skill kotlin-multiplatform -a cursor2Manually: put the files in place
.cursor/skills/kotlin-multiplatform/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install travisjneuman/.claude skills/kotlin-multiplatform2Manually: put the files in place
.github/skills/kotlin-multiplatform/SKILL.md1Skills CLI (Vercel)
npx skills add travisjneuman/.claude --skill kotlin-multiplatform -a gemini-cli2Platform CLI
gemini skills install https://github.com/travisjneuman/.claude --path skills/kotlin-multiplatformManually: put the files in place
.devin/skills/kotlin-multiplatform/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add travisjneuman/.claude --skill kotlin-multiplatform -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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.