All skills
kotlin avatar

/kotlin-tooling-native-build-performance

@87bec33 official
by kotlinkotlin/kotlin-agent-skills1.1k stars
42

Diagnoses and fixes slow Kotlin/Native compilation and linking in Kotlin Multiplatform projects that target iOS. Use when the user reports slow iOS or shared-framework builds, long linkDebug*/linkRelease* or XCFramework tasks, cold CI builds that re-download the Kotlin/Native toolchain, KSP or other generated code on the native path, transitiveExport usage, or asks for a local-development versus CI build performance plan.

Use this Skill: https://skilld.dev/gh/kotlin/kotlin-agent-skills/kotlin-tooling-native-build-performance

This session only. Nothing lands on disk.

referencescaching-and-gradle.md

≈671 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Caching and Gradle Configuration

Safe for every scenario; apply these before anything else.

Update Kotlin

The latest Kotlin version is the first official recommendation for Kotlin/Native compilation time — each release improves compiler performance. Check gradle/libs.versions.toml or the plugin block and propose an upgrade if the project is behind. Read the compatibility guide for the target release before upgrading; for example, use the Kotlin 2.4 compatibility guide when moving to Kotlin 2.4.x. Each target release has a corresponding compatibility guide. See the Kotlin 2.3.20 release notes for the related cache change.

Remove stale workarounds

Projects accumulate workarounds for long-fixed compiler issues. Upgrade Kotlin first, then inspect:

  • kotlin.native.disableCompilerDaemon=true
  • org.gradle.daemon=false

Each disables a performance feature. Remove stale workarounds and check whether the build completes successfully.

Enable Gradle caching

# gradle.properties
org.gradle.caching=true
org.gradle.configuration-cache=true
  • Trial the configuration cache with the user's real task before committing it. If Gradle reports configuration-cache problems, fix the blockers listed in the HTML report instead of abandoning the cache.
  • The configuration cache implicitly enables parallel task execution, which can run several link* tasks at once and overload the machine (KT-70915). If that happens, bound it with org.gradle.workers.max in gradle.properties or --max-workers on the command line — do not turn the cache off for this reason alone.
  • Delete org.gradle.configureondemand=true. Kotlin Multiplatform does not support Configuration on Demand, and it is not the same feature as the configuration cache.
  • For CI, a remote Gradle build cache extends org.gradle.caching across machines.

Keep ~/.konan warm in CI

Kotlin/Native stores its compiler distribution and caches in $HOME/.konan. Ephemeral CI machines and containers that lose it pay the cold-start cost on every build. On GitHub Actions:

- uses: actions/cache@v4
  with:
    path: ~/.konan
    key: konan-${{ runner.os }}-${{ hashFiles('**/libs.versions.toml') }}

Use the konan.data.dir Gradle property only when the project intentionally relocates that directory (for example, to a cacheable path on a CI runner).

Docs: https://kotlinlang.org/docs/native-improving-compilation-time.html and https://kotlinlang.org/docs/gradle-compilation-and-caches.html

Source: SKILL.md on GitHub

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    This skill provides a diagnostic framework and an audit script to optimize Kotlin/Native build performance. It is safe for its intended purpose, but it carries a low risk of indirect prompt injection due to the processing of untrusted project files during the analysis phase.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 87bec33. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 3 months ago
Other metadata
metadata
{
  "author": "JetBrains",
  "version": "1.0.0",
  "tested_models": "openai/gpt-5.5, openai/gpt-5.4-mini",
  "last_eval": "2026-07-06"
}

README badge

README badge for kotlin/kotlin-agent-skills/kotlin-tooling-native-build-performance