Skip to main content
BuildOfficialCertifiedReviewed Jul 21, 2026

Kotlin Tooling Native Build Performance

v1.0.0New

Install this skill

No account required. Pick your tool, then copy.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install kotlin-kotlin-tooling-native-build-performance

What this does: 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.

Or get the file:
Browse all CLI commands →
Manual setup by platform

Claude Code

~/.claude/skills/kotlin-kotlin-tooling-native-build-performance/SKILL.md

Setup guide →

Signing

SignedSLSA L2
Signed by
skills-hub.ai distributor
Method
Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
Key
skills-hub-ed25519-2026-11
Signed
0Save

Instructions

Kotlin/Native Build Performance

Turn "the iOS build is slow" into a measured diagnosis and a small set of safe
fixes. Two rules apply throughout:

  1. Never trade away required release behavior. A faster local loop must not
    change what CI publishes.
  2. Measure before and after with the same command and the same build state.
    An unmeasured fix is a guess.

Step 0: Classify the Slow Scenario

Establish four facts before editing anything: where (local or CI),
what (debug feedback loop or release/distribution artifact), state
(first build, clean, warm, or no-op), and phase (which tasks dominate the
log). Then match the dominant symptom:

Symptom in the build logLikely causeRead
linkRelease* or *ReleaseXCFramework tasks in a local development loopBuilding distribution artifacts for developmentartifacts-and-targets
Kotlin/Native compiler distribution downloaded on every CI run~/.konan not preserved between runscaching-and-gradle
Long pause before the first task startsConfiguration phase, no configuration cachecaching-and-gradle
All iOS targets build when only one simulator is neededBroad task (build, assemble, assemble*XCFramework) or unused targetsartifacts-and-targets
ksp* tasks ahead of compileKotlinIos*Generated-code work on the native pathexports-and-generated-code
Small source edit recompiles and relinks everythingCompiler caches disabled, or missing incrementalitycaching-and-gradle, experimental
Machine overloaded while several link* tasks run at onceParallel native linkingcaching-and-gradle, worker-limit caveat

Step 1: Audit and Measure

  1. Run the static audit from the project root:

    scripts/audit-native-build.sh /path/to/project
    

    It is read-only and prints file:line findings (disabled caches, broad
    local tasks, transitiveExport, broad KSP configuration, missing CI
    .konan cache), each pointing at the reference file with the fix.
    Findings are leads, not verdicts — confirm each against project policy.

  2. Find the command the user actually waits for: a script, a CI step, or the
    Gradle invocation inside an Xcode build phase. Optimize that command, not
    a task you picked yourself.

  3. Run it twice when practical. The first build downloads Kotlin/Native
    components and fills caches; only the second and later runs are
    representative. Attribute time per task before blaming the compiler:

    kotlin.build.report.output=file   # writes build/reports/kotlin-build/
    

    Gradle's --scan or --profile work too.

  4. If you cannot run the build (no macOS host, no Xcode), analyze logs, build
    scans, or checked-in metrics instead — and state explicitly that the
    conclusion is static.

Step 2: Fix in Safe Order

Apply fixes one at a time, re-measuring as you go:

  1. Restore healthy defaults — remove cache/daemon workarounds, enable
    Gradle build and configuration caches, keep ~/.konan warm in CI, update
    Kotlin: references/caching-and-gradle.md
  2. Build only what the feedback loop needs — one specific task per loop,
    correct integration method, justified target matrix:
    references/artifacts-and-targets.md
  3. Cut export and generated-code cost — drop transitiveExport, narrow
    export(...), scope KSP work to the native compilations that need it:
    references/exports-and-generated-code.md
  4. Experimental switches last, with the user's agreement:
    references/experimental.md

Worked Example

A developer on an Apple Silicon Mac complains that "every shared-module
change costs 12 minutes". Their loop runs ./gradlew :shared:assembleXCFramework.
A build scan of the second (warm) run shows:

:shared:linkReleaseFrameworkIosArm64             348s
:shared:linkReleaseFrameworkIosX64               341s
:shared:compileKotlinIosX64                       96s
:shared:linkDebugFrameworkIosSimulatorArm64       41s
:shared:compileKotlinIosSimulatorArm64            38s
configuration phase                               64s

Reasoning chain:

  • The loop is local + debug + warm, but ~690s goes to linkRelease* —
    release linking is an order of magnitude slower than debug and only CI
    needs it. Replace the local command with
    :shared:linkDebugFrameworkIosSimulatorArm64 (or the Xcode embed task if
    Xcode drives the build). (artifacts-and-targets)
  • All iosX64 work serves Intel simulators; ask whether the team still
    supports them before removing the target. (artifacts-and-targets)
  • 64s of configuration on every run disappears behind
    org.gradle.configuration-cache=true once trialed. (caching-and-gradle)
  • Expected loop after the change: ~40s compile + ~40s link on warm builds —
    confirm by re-running the new command twice and comparing.
  • CI keeps assembleXCFramework untouched; note that explicitly in the
    report.

Verify

  • Re-run the exact baseline command; compare warm build against warm
    build, not warm against cold.
  • Second run with the configuration cache reports it is being reused.
  • The local development log no longer contains linkRelease*,
    *ReleaseXCFramework, or removed generator tasks.
  • CI still produces every required release artifact, unchanged.
  • Tests pass and the app still runs from Xcode.
  • scripts/audit-native-build.sh reports no findings you have not
    consciously accepted and documented.

Report Your Changes

Close with a short performance note:

  • The slow scenario (local/CI, debug/release, cold/warm) and the measured
    evidence — or a statement that the analysis was static.
  • Each change, and why it is safe for release behavior.
  • The before/after commands the user can run to confirm the win.
  • Remaining tradeoffs: experimental flags enabled, targets removed under a
    policy assumption, worker limits, or generated-code work deferred.
  • Links to the relevant official documentation below.

Official Documentation

TopicLink
Improving Kotlin/Native compilation timehttps://kotlinlang.org/docs/native-improving-compilation-time.html
Kotlin Gradle plugin compilation and cacheshttps://kotlinlang.org/docs/gradle-compilation-and-caches.html
iOS integration methodshttps://kotlinlang.org/docs/multiplatform-ios-integration-overview.html
Direct integration with Xcodehttps://kotlinlang.org/docs/multiplatform/multiplatform-direct-integration.html
Building final native binaries and XCFrameworkshttps://kotlinlang.org/docs/multiplatform/multiplatform-build-native-binaries.html
Kotlin/Native binary optionshttps://kotlinlang.org/docs/native-binary-options.html
KSP with Kotlin Multiplatformhttps://kotlinlang.org/docs/ksp-multiplatform.html
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Browse all →

More from Kotlin

View source →
kotlin-backend-jpa-entity-mappingModel Kotlin persistence code correctly for Spring Data JPA and Hibernate. Covers entity design, identity and equality, uniqueness constraints, relationships, fetch plans, and common ORM (Object-Relational Mapping) traps specific to Kotlin. Use when creating or reviewing JPA (Java Persistence API) entities, diagnosing N+1 or LazyInitializationException, placing indexes and uniqueness rules, or preventing Kotlin-specific bugs such as data class entities and broken equals/hashCode.1 installskotlin-tooling-agp9-migrationMigrates Kotlin Multiplatform (KMP) projects to Android Gradle Plugin 9.0+. Handles plugin replacement (com.android.kotlin.multiplatform.library), module splitting, DSL migration, and the new default project structure. Use when upgrading AGP, when build fails due to KMP+AGP incompatibility, or when the user mentions AGP 9.0, android multiplatform plugin, KMP migration, or com.android.kotlin.multiplatform.library.1 installskotlin-tooling-java-to-kotlinUse when converting Java source files to idiomatic Kotlin, when user mentions "java to kotlin", "j2k", "convert java", "migrate java to kotlin", or when working with .java files that need to become .kt files. Handles framework-aware conversion for Spring, Lombok, Hibernate, Jackson, Micronaut, Quarkus, Dagger/Hilt, RxJava, JUnit, Guice, Retrofit, and Mockito.1 installskotlin-tooling-gradle-to-kotlin-toolchain-projectLoad when migrating or converting an entire Gradle Kotlin project (build.gradle(.kts), wrapper, libs.versions.toml, buildSrc) to the Kotlin Toolchain, including rewriting CI and replacing Gradle plugins that have no native Toolchain equivalent. Skip for porting one Gradle plugin or general Toolchain work once Gradle is gone.1 installskotlin-tooling-immutable-collections-0-5-x-migrationMigrate Kotlin (and Java) code from kotlinx.collections.immutable 0.3.x / 0.4.x to the latest 0.5.x. The 0.5.x line renames every copy-returning method on PersistentList / PersistentMap / PersistentSet / PersistentCollection to a participial form per KEEP-0459 (add→adding, removeAt→removingAt, set→replacingAt, put→putting, clear→cleared, …) and deprecates the old names (WARNING, with ReplaceWith). Driven by the compiler: bump the version, recompile, and apply the rename each deprecation warning names. Use when the user mentions kotlinx.collections.immutable 0.5.x, PersistentList migration, "Use adding() instead", KEEP-0459, or sees deprecation warnings from kotlinx.collections.immutable.0 installskotlin-tooling-cocoapods-spm-migrationMigrate KMP projects from CocoaPods (kotlin("native.cocoapods")) to Swift Package Manager (swiftPMDependencies DSL) — replaces pod() with swiftPackage(), transforms cocoapods.* imports to swiftPMImport.*, and reconfigures the Xcode project.0 installs

More Build skills

Browse category →
senior-frontendBuild and review React, Next.js, TypeScript or Tailwind frontends: components, scaffolding, performance and bundle size. Use whenever the user wants a new component or app, a page feels slow, the bundle is too big, or asks for a frontend code review.653 installsui-design-systemUse when building a design system: tokens, component docs, responsive scales or developer handoff. Generates tokens with design_token_generator.py.553 installsfrontend-designGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.365 installssenior-backendBuild and fix backend services: REST or GraphQL APIs, auth, microservices, PostgreSQL queries, migrations and load tests. Use whenever the user's API is slow or broken, needs login or auth added, a schema change, or a new endpoint or service scaffolded.266 installsself-improving-agentCurate what the agent has learned into durable project knowledge. Reviews Claude Code auto-memory (MEMORY.md and its topic files) for learnings worth keeping, promotes proven ones into CLAUDE.md or .claude/rules/, records a correction as a lesson that persists across sessions, prunes stale or duplicate entries, and turns a recurring fix into a reusable skill. Use whenever the user asks what you have learned or saved about the project, which memories should become permanent rules, to remember a lesson or stop repeating a mistake, or to clean up, audit or check memory health.185 installsusing-superpowersUse when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions149 installs

Frequently asked questions about kotlin-tooling-native-build-performance

What does the kotlin-tooling-native-build-performance skill do?

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. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the kotlin-tooling-native-build-performance skill?

Run `npx @skills-hub-ai/cli install kotlin-kotlin-tooling-native-build-performance` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/kotlin-kotlin-tooling-native-build-performance/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does kotlin-tooling-native-build-performance work with?

kotlin-tooling-native-build-performance runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the kotlin-tooling-native-build-performance skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use kotlin-tooling-native-build-performance after installing it?

In Claude Code, type `/kotlin-kotlin-tooling-native-build-performance` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the kotlin-tooling-native-build-performance skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.