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.

referencesexports-and-generated-code.md

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

Framework Exports and Generated Code

Framework exports

Every exported module grows the API surface the compiler and linker must keep.

  • Remove transitiveExport = true. It exports the entire transitive closure and disables dead code elimination in many cases — it is almost never what the project actually needs.
  • Keep an explicit export(...) only for modules whose API Swift or Objective-C code calls directly.
// Before: exports everything analytics depends on, defeats DCE
binaries.framework {
    export(project(":analytics"))
    transitiveExport = true
}

// After: exports exactly the Swift-facing API
binaries.framework {
    export(project(":analytics"))
}

If Swift code stops compiling after narrowing exports, add back only the specific modules it references — that is the export list the project really needs.

Generated code

If ksp* tasks dominate the measured time, report the bottleneck as generated-code work — do not present a Kotlin/Native tweak as the fix.

  • Scope KSP to the targets or source sets that need generated code instead of a broad ksp(...) dependency:

    dependencies {
        add("kspCommonMainMetadata", libs.myprocessor)
        add("kspIosSimulatorArm64", libs.myprocessor)
    }
  • Confirm the generated sources are consumed by the corresponding native compilation before adding another target-specific KSP configuration.

Docs: https://kotlinlang.org/docs/ksp-multiplatform.html and https://kotlinlang.org/docs/native-improving-compilation-time.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