Skip to content
Back to skills

Kotlin Knowledge Patch

ASecurity

Kotlin

  • 25 stars
  • 0 votes
  • 0 copies
  • 7 views
  • Added September 5, 2026
developmentjavascripttypescriptjavaswiftkotlinnodetestingdebuggingapi

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill kotlin-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Kotlin Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Kotlin Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-kotlin-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-kotlin-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: kotlin-knowledge-patch
description: Kotlin
version: "2.4.21"
license: MIT
metadata:
  author: Nevaberry
---


# Kotlin knowledge patch

Load this skill when migrating Kotlin code or builds, diagnosing compiler
regressions, or working with the platform and library APIs indexed below.
Read the relevant reference for full examples, version-specific conditions,
and source links.

## Reference index

| Reference | Topics |
| --- | --- |
| [Language and compiler](references/language-and-compiler.md) | Context parameters, backing fields, destructuring, contracts, type checks, annotations, diagnostics |
| [JVM and build tooling](references/jvm-and-build-tooling.md) | Java interop, Gradle and AGP migration, ABI validation, Maven, Build Tools API, scripts, Kotlin Toolchain |
| [Multiplatform and Native](references/multiplatform-and-native.md) | Source sets, dependencies, Apple targets, allocation, C/Objective-C interop, Swift export |
| [JavaScript and Wasm](references/javascript-and-wasm.md) | Build environments, exports, TypeScript, npm, browser tests, debugging, exceptions, WASI |
| [Standard library](references/standard-library.md) | Time, UUIDs, atomics, arrays, collection semantics, Base64, assertions |
| [Compose Multiplatform](references/compose-multiplatform.md) | Compiler behavior, dependencies, navigation, resources, previews, Hot Reload, platform UI, tests |
| [Ecosystem libraries](references/ecosystem-libraries.md) | Serialization, coroutines, Ktor, Exposed, Koog |

## Breaking changes and deprecations

### Language and Java interoperability

- Context receivers are removed in Kotlin 2.3.20; migrate to context parameters.
  At language version 2.4, context parameters are stable and need no preview flag.
- Kotlin 2.3.0 rejects `-language-version=1.8` on every target;
  `-language-version=1.9` remains available only on JVM.
- K2 rejects constructor calls and supertypes through aliases expanding to
  projected types. Use the original class with a valid type argument.
- An inferred intersection type for a `reified` parameter is rejected;
  supply an explicit type argument satisfying the function's bounds.
- `@JvmSerializableLambda` on an inlined or `crossinline` lambda is an error.
  Use a `noinline` parameter or a non-inline function when serialization is needed.
- The Java synthetic property-reference experiment was revoked. Use
  `Person::getName` where the receiving API accepts a function reference.

### Gradle and Android configuration

- Reads and writes through `kotlinOptions` properties now error, including in
  task configuration. Migrate to `compilerOptions`.
- On AGP 9, Android-only modules use built-in Kotlin; remove
  `org.jetbrains.kotlin.android`. Multiplatform Android libraries use
  `com.android.kotlin.multiplatform.library` and `kotlin { android { … } }`.
  Staying on AGP 8.x with Kotlin 2.3.10 retains `androidTarget`.
- Applying `kotlin-android-extensions` fails at Gradle configuration time.
- Replace `testApi()` with `testImplementation()`, or use
  `commonTest.dependencies { implementation(...) }` instead of `api(...)`.
- `KotlinCompileTool.setSource(...)` replaces sources; use `source(...)` to append.
- Register resources through `KotlinSourceSet.resources`; generated Kotlin code
  uses experimental `generatedKotlin`. Read handwritten and generated Kotlin files through
  `sourceSet.allKotlinSources`.
- Remove `kotlin.incremental.classpath.snapshot.enabled`,
  `kotlin.compiler.preciseCompilationResultsBackup`, and
  `kotlin.compiler.keepIncrementalCompilationCachesInMemory`.
- Kotlin 2.3.0 removes Ant build support; migrate those builds to Gradle or Maven.

### JVM defaults, reflection, and metadata

- Stable `-jvm-default` replaces `-Xjvm-default`; `enable` emits default methods,
  compatibility bridges, and `DefaultImpls`. Use `disable` if Java implementations
  encounter conflicting defaults from unrelated interfaces, or
  `no-compatibility` to generate only JVM default methods.
- Annotated JVM lambdas use `invokedynamic` by default. Compile with
  `-Xindy-allow-annotated-lambdas=false` if reflection relies on annotations
  on generated lambda classes.
- Kotlin 2.4.0 emits annotations in Kotlin metadata by default, without
  `-Xannotations-in-metadata`. The reference covers metadata API opt-ins and accessors.

### Web and Native migration

- Replace `jsRun` and `jsBrowserRun` with `jsBrowserDevelopmentRun`, `jsNodeRun`
  with `jsNodeDevelopmentRun`, and `jsBrowserWebpack` with
  `jsBrowserProductionWebpack` or `jsBrowserDistribution`.
  Wasm uses the same mappings with the `wasmJs` prefix.
- Wasm modules initialize during instantiation; remove post-instantiation
  `_initialize()` calls. Review `@EagerInitialization` because initializer code
  can run before module initialization finishes.
- Move D8 and Binaryen imports from `org.jetbrains.kotlin.gradle.targets.js`
  to `org.jetbrains.kotlin.gradle.targets.wasm`.
- Remove `kotlin.native.enableKlibsCrossCompilation=true`; supported hosts can
  produce publishable KLIBs by default. A Mac is still needed for cinterop
  dependencies in the library or dependent modules, CocoaPods integration,
  and building or testing final Darwin binaries.
- Replace deprecated `kotlin.native.cacheKind` with `disableNativeCache` on
  the affected binary, supplying a Kotlin version and reason.

### Compose migration

- Replace deprecated Compose Gradle aliases such as `compose.ui` with the Maven
  coordinates from their deprecation notices in the version catalog.
- Replace `PredictiveBackHandler` with `NavigationBackHandler`; remember its
  event state, handle cancellation and completion separately, and read progress
  from the in-progress transition. See the complete reference example.
- In `commonMain`, use `androidx.compose.ui.tooling.preview.Preview`.
- Set `CADisableMinimumFrameDurationOnPhone` to Boolean `true` in `Info.plist`.
  Compose crashes if it is missing or false; `enforceStrictPlistSanityCheck = false`
  in the `ComposeUIViewController` configuration bypasses the check.
- Migrate deprecated browser `window.bindToNavigation(navController)` calls
  to the suspending `navController.bindToBrowserNavigation()` extension.
- On non-Android targets, migrate deprecated Compose UI test runners to v2;
  they queue coroutine work on `StandardTestDispatcher` by default.

## Language features and diagnostics

### Context and property declarations

Use `with` to provide a nearer receiver when compatible context values at the
same scope make a call ambiguous. Contextual properties need explicit computed
accessors and cannot have backing fields, initializers, or delegation.
A context parameter no longer makes an overload more specific in Kotlin 2.3.20;
give otherwise ambiguous overloads distinct names where needed.

Explicit backing fields are stable at language version 2.4 without a preview flag.
They can give a property a field more specific than its public type; property
access is smart-cast to the field's type within the backing field's private scope.

### Result checking and warning control

Enable experimental `-Xreturn-value-checker=check` for discarded results from
marked APIs, or `-Xreturn-value-checker=full` to treat every compiled file as marked.
Use `@MustUseReturnValues` or `@file:MustUseReturnValues` and exempt functions with
`@IgnorableReturnValue`. `val _ = computeValue()` explicitly discards a result.

Use `-Xwarning-level=UNCHECKED_CAST:error` for an individual error, `:disabled`
to suppress a diagnostic, or `:warning` to emit it even under `-Werror` or `-nowarn`.
The reference also covers annotation targets, destructuring modes, and contract opt-ins.

## Build and publication tools

Use `checkKotlinAbi`, `updateKotlinAbi`, and `internalDumpKotlinAbi` in place of
`checkLegacyAbi`, `updateLegacyAbi`, and `dumpLegacyAbi`. The old names still work
in Kotlin 2.3.20; enabling validation makes `check` run `checkKotlinAbi` automatically.
The ABI validator also supports `com.android.kotlin.multiplatform.library` modules.

Kotlin Gradle plugin JVM compilation uses the experimental Build Tools API by
default. The reference covers independent compiler selection, operation builders,
best-effort cancellation, metrics, and compiler plugin configuration.

For Kotlin Toolchain projects, `kotlin update` updates an existing project.
`kotlin run --compose-hot-reload-mode` starts an app with Hot Reload; the reference
contains the wrapper-based MCP configuration and library publication settings.

## Native and Swift integration

Experimental Swift export with direct Xcode integration uses
`./gradlew :shared:embedSwiftExportForXcode` in the Run Script phase, with the
shared module's Gradle path. `swiftExport.export(...)` exposes dependencies as
separate Swift modules; `flattenPackage` strips the specified package prefix.

Swift export erases generic parameters to their upper bounds and skips types
inheriting from `List`, `Set`, or `Map`. Function values cross from Swift to Kotlin
only. Nullable primitives map directly to Swift optionals.
The reference covers enum conformances, variadic parameters, inheritance, and opt-ins.

Kotlin/Native uses CMS garbage collection by default. Its incremental compilation
is enabled by default; `kotlin.incremental.native=false` disables it in Gradle.

## JavaScript and Wasm integration

Enable `-Xenable-suspend-function-exporting` for Kotlin/JS suspend exports;
JavaScript can await them. With experimental `-Xes-long-as-bigint`, `LongArray`
uses `BigInt64Array`; update JavaScript callers to pass typed arrays.

Default `wasmJs` builds require browser support for WebAssembly garbage collection
and the legacy exception-handling proposal. `wasmWasi` uses the new exception
instructions by default; `wasmJs` opts in with `-Xwasm-use-new-exception-proposal`.
The Kotlin/JS browser-test DSL integrates Playwright; the Wasm plugin rejects it.

## Standard-library and ecosystem APIs

`kotlin.time.Clock` and `kotlin.time.Instant` are stable in Kotlin 2.3.0; remove
`ExperimentalTime` where used only for them. The stabilized `kotlin.uuid.Uuid` API
can drop `ExperimentalUuidApi`. `Uuid.generateV7()` provides monotonic ordering;
`Uuid.generateV7NonMonotonicAt` can produce out-of-order IDs for one timestamp.

`Iterable.intersect()` and `Iterable.subtract()` use the argument's membership
semantics for receiver elements before deduplicating with ordinary equality.
The reference includes atomic array updates, array resizing, and collection checks.

In kotlinx.serialization 1.10.0, a transformed property name colliding with the
class discriminator throws `SerializationException` during encoding. Decoding
permits the conflicting key in open and sealed polymorphic hierarchies.
See the reference for transformed names, default serializers, stabilized APIs,
ProtoBuf, CBOR, HOCON, and kotlinx-io streaming.

In kotlinx.coroutines 1.10.2, suspending `flow.stateIn(scope)` no longer hangs when
upstream completes without emitting or the scope was already cancelled.
`runTest` defaults to 60 seconds; set
`-Dkotlinx.coroutines.test.default_timeout=10s` on the test JVM to change the suite default.

## Compose resources and testing

Use `./gradlew composeCompatibilityBrowserDistribution` to package Wasm and JS
web targets together, with JS fallback for browsers lacking the required Wasm features.
Compose web font fallback downloads matching Noto subsets on demand and recomposes text.
Hot Reload's experimental MCP server supports reloads, screenshots, semantics-tree
inspection, clicks, text input, and application logs.

Compose test idleness can occur while composition coroutines are in `delay()`.
Advance virtual time explicitly after the effect starts. Rendering occurs at virtual
frame boundaries, 16 ms apart. After `runOnIdle` schedules UI work, call `waitForIdle()`
if the next assertion depends on it. Return `runComposeUiTest`'s result from web tests.

Files in this skill

  • SKILL.md12.4 KB
  • coverage.json2 KB
  • references/compose-multiplatform.md12.4 KB
  • references/ecosystem-libraries.md5 KB
  • references/javascript-and-wasm.md7.6 KB
  • references/jvm-and-build-tooling.md9.1 KB
  • references/language-and-compiler.md11.1 KB
  • references/multiplatform-and-native.md7.8 KB
  • references/standard-library.md2.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.