/mobile:code-kotlinfrom mobile
How to write good Kotlin beyond the KMP rules - structured concurrency, choosing Flow operators, sealed types and value classes, serialization edge cases, and the traps of Kotlin Multiplatform on iOS. Use when writing or reviewing Kotlin. The KMP rules decide how the app is shaped; if they and this skill disagree, the rule wins and you say so.
Ships in mobile. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The KMP rules are the baseline (no !!, Result from repositories, one ViewModel per flow). This is the depth
beyond them. If a rule and this skill disagree, the rule wins: say so.
GlobalScope is banned: it throws the guarantee away.coroutineScope { }: one child fails → the others are cancelled. supervisorScope { }: they keep going. Three
independent widgets where one may fail → supervisorScope; three things you need all of → coroutineScope.async without await hides its exception. If you are not awaiting, you wanted launch.withContext(NonCancellable) only inside a finally, for work that must finish (clearing tokens on logout).ensureActive() in loops: a cancelled coroutine only stops at a suspension point that checks.CancellationException is not an error. catch (e: Exception) swallows it and turns a cancel into a hang:
rethrow it.// a platform or SDK call; repository calls use Result, never try/catch
try { scanner.start() }
catch (e: CancellationException) { throw e }
catch (e: Exception) { logger.e(e) { "scanner failed" } }
collectLatest when only the newest value matters (search as you type). collect when every value must be
handled, in order.debounce before mapLatest, not after.stateIn(scope, SharingStarted.WhileSubscribed(5_000), initial) for a flow behind UI: it survives a configuration
change and stops when nobody listens.flowOn changes the dispatcher of everything above it. Two flowOn in one chain is usually a mistake.shareIn if you
don't want that.sealed class (the KMP rules), which SKIE turns into Swift enums.@JvmInline value class GuestId(val raw: Long) costs nothing and stops you swapping two
Long arguments.kotlin.Result is not the project's BaseRepository.Result. Don't mix them in a repository signature.@SerialName wherever the wire name differs, and a default on every optional field: without it, a field the
backend adds later breaks the whole payload, not just that field.ignoreUnknownKeys = true is what makes additive API changes safe on the client.@EncodeDefault(NEVER) when a default must not be sent back (a PATCH would otherwise send every untouched field).type key collides with any DTO field called
type.expect/actual is a compile-time swap, not an abstraction layer. Every parameter must exist on both platforms,
so a Context in an expect is a design error.Dispatchers.IO exists on iOS too (import kotlinx.coroutines.IO); Dispatchers.Default is a thread pool there.companion object function becomes Companion.shared.foo() in Swift: prefer a top-level function.NSLog("%@", message) crashes (SIGSEGV). Use the message as the format,
with % escaped, and cover the actual with an iosTest.List<T> reaches Swift as an NSArray and can lose its element type in some places: check the generated header
before designing an API around nested generics.NAME_MAX, PATH_MAX, MIN, YES) breaks the exported
Objective-C header: Swift stops with "property requires fields to be named". Pick another name (NAME_LIMIT).new joins Objective-C's new family and reaches Swift renamed: start it with
another word (productKind, not newProductKind).let for nullable chains, apply to configure an object, also for a side effect that keeps the value. run and
with mostly make code harder to search. Three chained scope functions are one function that wants a name.
A lambda with a receiver shadows the class around it: in a reducer that takes the State as receiver
(updateState { copy(...) }), a ViewModel field named like a State property, computed ones included, reads the
State's. Name ViewModel fields apart from the State's properties.
Inside a lambda with a receiver, an unqualified name is the receiver's first. In updateState { copy(failure = failure) }
the right side is the State's own failure, not the ViewModel's property of that name, so the field never changes.
Read the property into a local before the lambda, or qualify it with this@MyViewModel.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub fractalx-technologies/claude-config --plugin mobile4 skills in this plugin
/code-swiftHow to write good Swift and SwiftUI beyond the iOS rules - view identity and diffing, concurrency and actor isolation, Sendable, value semantics, memory, and the traps at the Kotlin (KMP) boundary. Use when writing or reviewing Swift. The iOS rules decide how the app is shaped; if they and this skill disagree, the rule wins and you say so./code-swiftuiComprehensively reviews SwiftUI code for best practices on modern APIs, maintainability, and performance. Use when reading, writing, or reviewing SwiftUI projects./mobile-app-ui-designDesign high-quality mobile app UI/UX screens, flows, and components. Use this skill whenever the user asks to design a mobile app screen, create app mockups, build mobile UI components, improve an existing mobile app design, create onboarding flows, design mobile navigation, or requests any mobile-first interface work. Also trigger when the user mentions app design, mobile UI, mobile UX, screen design, app mockups, wireframes, or wants to build React Native / Flutter / SwiftUI style interfaces as visual prototypes. Even if the user just says "design an app" or "make this screen look better", use this skill.Other plugins' skills for the same job