Home › Kotlin Multiplatform › Kotlin Multiplatform Copilot path instructions

Kotlin Multiplatform Copilot path instructions

Path-specific Copilot instructions for Kotlin Multiplatform modules: commonMain first, expect/actual, and coroutines.

GitHub CopilotKotlin Multiplatform

How to use

Save this as .github/instructions/kotlin.instructions.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

.github/instructions/kotlin.instructions.mdDownload  
---
applyTo: "**/*.kt,**/*.kts"
description: Kotlin Multiplatform conventions
---

# Kotlin Multiplatform

- Put code in `commonMain` by default. Only platform APIs go in `androidMain`, `iosMain`, `jvmMain`, `wasmJsMain`.
- Prefer interfaces + DI for platform services; use `expect`/`actual` only for small primitives (e.g. `expect fun platformName(): String`).
- Use multiplatform libraries: Ktor client, kotlinx.serialization, kotlinx.coroutines, kotlinx-datetime, SQLDelight or Room KMP. No `java.*` imports in common code.
- Coroutines: expose `suspend` functions and `Flow`; inject dispatchers; never `GlobalScope`.
- For iOS consumers, keep public API Swift-friendly (avoid deep generics, sealed hierarchies are fine with SKIE if configured).
- Versions in `gradle/libs.versions.toml`.
- Immutable `data class` models with `@Serializable`.
- Tests in `commonTest` using `kotlin.test` and `kotlinx-coroutines-test` (`runTest`).

## Check
`./gradlew check` (runs all target tests) passes, and `./gradlew :shared:linkDebugFrameworkIosSimulatorArm64` if iOS is a target.

More: all Kotlin Multiplatform rules · all GitHub Copilot rules

Related rules

Kotlin Multiplatform + Compose Multiplatform CLAUDE.md

CLAUDE.md for Kotlin Multiplatform apps sharing UI with Compose Multiplatform across Android, iOS, desktop, and web.

Claude Code (CLAUDE.md)Kotlin Multiplatform

Flutter AGENTS.md

AGENTS.md for Flutter apps with Riverpod, go_router and clean feature-first structure.

AGENTS.mdFlutter

Flutter + Riverpod rules

Cursor rules for Flutter 3 apps using Riverpod 3 with code generation, go_router, and widget tests.

CursorFlutter

Android Jetpack Compose AGENTS.md

AGENTS.md for Android apps in Kotlin 2 with Jetpack Compose, ViewModel + StateFlow, Hilt, and Room.

AGENTS.mdAndroid / Kotlin

React Native + Expo rules

Cursor rules for Expo Router apps with TypeScript, NativeWind and TanStack Query.

CursorReact Native / Expo

React Native + Expo Windsurf rules

Windsurf rules for React Native apps on Expo SDK (New Architecture): Expo Router, native modules, and EAS builds.

WindsurfReact Native / Expo

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.