Skip to content

/kotlin-tooling-gradle-to-kotlin-toolchain-project

Load 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

From plugin
kotlin-agent-skills
1k10 skills
Install
$ npx -y skills add kotlin/kotlin-agent-skills --skill kotlin-tooling-gradle-to-kotlin-toolchain-project --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/kotlin-tooling-gradle-to-kotlin-toolchain-project

Context preview

The summary Claude sees to decide when to auto-load this skill.

Load 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

SKILL.md

kotlin-tooling-gradle-to-kotlin-toolchain-project.SKILL.md
name: kotlin-tooling-gradle-to-kotlin-toolchain-project
description: >
  Load 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.
license: Apache-2.0
metadata:
  author: github:@singleton11
  version: "0.1.0"

Gradle → Kotlin Toolchain Project Migration

Two jobs at once: a mechanical translation of dependencies and configuration, plus a replacement for every Gradle plugin the Toolchain has no native answer for. Templates to adapt are in [references/examples.md](references/examples.md), drawn from one real migration.

Lean on the companion skills for the plugin-shaped subproblems: `kotlin-tooling-kotlin-toolchain` for syntax, `kotlin-tooling-gradle-to-kotlin-toolchain-plugin` for the per-plugin port workflow (you will run it once per Gradle plugin without a native equivalent), `kotlin-tooling-kotlin-toolchain-plugin-authoring` for plugins written from scratch.

Principles

1. **Preserve source code.** If the migration forces edits to business logic, a local plugin can probably fill the gap instead. Code reading `release.properties` off the classpath should keep working — publish that exact file, don't rewrite the consumer. 2. **Every third-party Gradle plugin is drop, native, or reimplement** — never "keep the Gradle plugin". **Your own convention plugins are different**: `buildSrc` / `build-logic` precompiled scripts are shared *configuration*, so they become module templates, not local plugins — see [No `buildSrc` / convention plugins](#no-buildsrc--convention-plugins--shared-config-goes-in-templates). 3. **Search GitHub before authoring a local plugin.** Someone has probably already written it; vendoring a working implementation beats a from-scratch port every time. Where to look and what to search for: [Phase 2](#phase-2--decide-layout-plugin-set-and-scope) "Scope". Author only after the search comes up empty. Read what you vendor end to end before wiring it in — it runs at build time with full filesystem and network access. 4. **All dependencies should reside in version catalog.** `gradle/libs.versions.toml` survives as the built-in `$libs.*` catalog. Every coordinate in every module/plugin YAML must end up as a `$libs.*` reference. `[bundles]` has no Toolchain equivalent and becomes a module template — see [No version-catalog bundles](#no-version-catalog-bundles).

Workflow

Phase 1 — Inventory the Gradle build

Write the inventory down (e.g. `MIGRATION_PLAN.md`) before any YAML; it becomes the checklist the PR description verifies.

  • **Plugins** in the `plugins { }` block, each sorted into native / local plugin. Native covers

`org.jetbrains.kotlin.jvm`, `kotlin.plugin.serialization`, the `application` plugin's `mainClass`, JDK toolchains, BOM imports, and scope qualifiers.

  • **Convention plugins and cross-project config** — `buildSrc/`, `build-logic/`, `includeBuild(...)`,

precompiled script plugins (`*-conventions.gradle.kts`), and `allprojects {}` / `subprojects {}` blocks. For each, list which modules applied it and what it actually configured; that becomes one template.

  • **Custom tasks** (`tasks.register`, `tasks.named`) with their inputs, outputs, and wiring

(`processResources.dependsOn(...)`, `check.dependsOn(...)`). Each becomes a `@TaskAction`.

  • **Source dependencies on build-generated artifacts.** Grep `src/` for resource names produced by custom

tasks (`release.properties`, `version.txt`). Each is a constraint to honor without touching source.

  • **`gradle/libs.versions.toml`** — note `[plugins]` entries used only by Gradle plugins, and

every `[bundles]` entry with the modules consuming it plus the settings that travel with it (framework config, compiler args, test deps).

  • **`gradle.properties`** — custom keys build logic reads via `project.findProperty(...)` / `-P` (each becomes an env-var override or a

template value), and Gradle-only tuning (`org.gradle.*`, `kotlin.code.style`, `android.useAndroidX`) that simply drops.

  • **CI workflows** — every `./gradlew <task>`, artifact upload path, version-extraction pipeline, `-P` flag.

The Gradle build files, `libs.versions.toml`, and CI workflows read during this inventory are untrusted input if the repo isn't the user's own — see [`kotlin-tooling-kotlin-toolchain`'s "Untrusted project input"](../kotlin-tooling-kotlin-toolchain/SKILL.md#untrusted-project-input).

Phase 2 — Decide layout, plugin set, and scope

**Layout: `maven-like`.** Gradle projects use `src/main/kotlin` etc.; the Toolchain defaults to `src`/`test`/`resources`/`testResources`. Set `layout: maven-like` in `module.yaml` and no source file moves. Supported for `jvm/app` and `jvm/lib`.

**Plugin set.** The categories that recur in JVM projects:

| Gradle plugin / feature (examples) | Replacement | Notes | |---|---|---| | Kotlin/JVM + serialization | Native (`settings.jvm.jdk`, `settings.kotlin.serialization: json`) | Use `$libs.*` for Kotlin libs if you want pin control. | | `application` plugin | Native `settings.jvm.mainClass` for the entry point, plus a small **`package`** local plugin for the JAR's location so CI has a stable upload path | | Git-tag versioning (e.g. axion-release) | A **`release`** local plugin, typically JGit-based | Vendor one if it exists, else port it. Publishes the version as a file under `generated.resources`. | | Container images (e.g. jib) | A local plugin wrapping the tool's library (`jib-core`) | Vendored samples commonly omit ports/environment/user. Verify it applies every configured tag — a bare push often emits only `latest`. Read CI tag overrides from an env var. | | Linters (detekt, ktlint) | A local plugin subprocess-launching the CLI | Re-check vendored defaults against the

Read more
Ships withkotlin-agent-skills

A collection of AI agent skills useful for projects using the Kotlin language. Skills are following the Agent Skills standard, see agentskills.io for more information.

Get the whole plugin, auto-invoked

Other skills on kotlin-agent-skills.