Kotlin Tooling Kotlin Toolchain Plugin Authoring logo

Kotlin Tooling Kotlin Toolchain Plugin Authoring

OrganizationPopular
Kotlin
kotlin-tooling-kotlin-toolchain-plugin-authoring

Load when authoring, writing, or designing a Kotlin Toolchain local plugin to extend the declarative build with code generation, build-time processing, custom verification, or packaging that module.yaml cannot express, or when referencing @TaskAction, @Configurable, plugin.yaml, or jvm/amper-plugin. Skip for porting an existing Gradle plugin.

Overview

PublisherKotlin
Repositorykotlin-agent-skills
Skill namekotlin-tooling-kotlin-toolchain-plugin-authoring
Stars
1.1K
Forks
43
Bundled files
1
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by Kotlin on GitHub. Read the source before you install it.

Installation

Install the Kotlin Tooling Kotlin Toolchain Plugin Authoring AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Kotlin/kotlin-agent-skills/tree/main/skills/kotlin-tooling-kotlin-toolchain-plugin-authoring
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Kotlin/kotlin-agent-skills.git /tmp/kotlin-agent-skills
mkdir -p .claude/skills
cp -r /tmp/kotlin-agent-skills/skills/kotlin-tooling-kotlin-toolchain-plugin-authoring .claude/skills/kotlin-tooling-kotlin-toolchain-plugin-authoring
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Kotlin Tooling Kotlin Toolchain Plugin Authoring in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Kotlin Tooling Kotlin Toolchain Plugin Authoring on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Kotlin Tooling Kotlin Toolchain Plugin Authoring is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Kotlin Toolchain Plugin Authoring

Local plugins are the official escape hatch from declarative YAML: a jvm/amper-plugin module shipping task actions, settings, and generated sources/resources alongside your project. Code patterns to adapt are in references/examples.md.

When to write a plugin

Write one when you need:

  • A build-time step a library's workflow expects (code generation, schema compilation, resource transformation, version stamping).
  • Custom verification wired into the build (pre-release checks, schema validation, contract tests).
  • A build-time value published into the JAR classpath or downstream tasks — the closest analog to Gradle's project.version.
  • A named CLI command for a repeated workflow (./kotlin do release).

Don't write one when module.yaml already covers it (dependencies, JDK provisioning, source layouts, basic packaging), and never to reuse a Gradle plugin — the Kotlin Toolchain cannot consume them.

Layout

repo-root/
├── kotlin, kotlin.bat            # wrappers (from `kotlin init`)
├── project.yaml                  # registers the plugin
├── plugins/<name>/
│   ├── module.yaml               # product: jvm/amper-plugin
│   ├── plugin.yaml               # tasks: + commands: + generated:
│   └── src/
│       ├── Settings.kt           # @Configurable interface
│       ├── tasks/                # one @TaskAction per file
│       │   ├── Foo.kt
│       │   └── FooSteps.kt       # internal shared helpers (not @TaskAction)
│       └── <domain logic>/
└── <consumer-module>/
    └── module.yaml               # plugins: { <name>: enabled: true, ... }

Keep at least one consumer module in the repo — it is the only way to exercise the plugin end-to-end, and plugins cannot be published to any public registry yet.

project.yaml

yaml
modules:
  - consumer-app
  - plugins/<name>

plugins:
  - ./plugins/<name>

Without the top-level plugins: block the plugin id is unresolvable from any consumer.

module.yaml — the plugin module

yaml
product: jvm/amper-plugin          # marks the module as a plugin

dependencies:
  - <coordinate>:<version>
  - <coordinate>:<version>: runtime-only   # required only at runtime
  - <coordinate>:<version>: compile-only

pluginInfo:
  id: <plugin-id>                                  # what consumers write under `plugins:`
  settingsClass: <fully.qualified.Settings>        # the @Configurable interface

settings:
  jvm:
    jdk:
      version: 21
  kotlin:
    languageVersion: 2.1

@Configurable interface Settings

Defaults go in interface property getters; nested blocks become nested @Configurable interfaces.

kotlin
@Configurable
interface Settings {
    val someValue: String get() = "default"
    val checks: ChecksSettings
}

@Configurable
interface ChecksSettings {
    val strict: Boolean get() = true
}

Consumers override what they need in module.yaml; omitted values fall back to the getter default:

yaml
plugins:
  <plugin-id>:
    enabled: true
    someValue: "override"
    checks:
      strict: false

@TaskAction

Task actions are top-level funs, called when the matching plugin.yaml entry executes.

kotlin
@TaskAction
fun foo(
    @Input moduleRootDir: Path,
    @Output outputDir: Path,
    settings: Settings,
) {
    // body
}
  • @Input path: Path — declared input; Kotlin Toolchain snapshots its contents for execution avoidance.
  • @Output path: Path — declared output directory; Kotlin Toolchain creates it and passes the path in. Write to the exact Path you received, or downstream references won't find the result.
  • settings: Settings (or any @Configurable) — typed configuration, wired in plugin.yaml.
  • Plain Path / primitives — passed literally from plugin.yaml.
  • println(...) is the output channel; Kotlin Toolchain captures stdout.

Execution avoidance

A @TaskAction is skipped when its declared inputs are unchanged. Tasks whose real inputs are Git history, the network, or environment variables cannot be fingerprinted, so opt out:

kotlin
@TaskAction(executionAvoidance = ExecutionAvoidance.Disabled)
fun foo(@Output outputDir: Path, settings: Settings) { /* ... */ }

Tasks with no @Output are never cached and always re-run — correct for purely side-effecting tasks (releases, deployments, pushes).

plugin.yaml

yaml
tasks:
  foo:
    action: !<fully.qualified.foo>
      moduleRootDir: ${module.rootDir}
      outputDir: ${taskOutputDir}
      settings: ${pluginSettings}

  bar:
    action: !<fully.qualified.bar>
      input: ${tasks.foo.action.outputDir}/result.txt
      settings: ${pluginSettings}

generated:
  resources:
    - directory: ${tasks.foo.action.outputDir}

commands:
  - foo
ReferenceResolves to
${module.rootDir}Directory containing the consumer's module.yaml. Pass as @Input to inspect the consumer's tree.
${taskOutputDir}Toolchain-managed per-task output directory. Pass as @Output.
${pluginSettings}The @Configurable object built from the consumer's module.yaml.
${tasks.<task>.action.<param>}Another task's parameter — used in generated.* and to wire one task's @Input to another's @Output.

generated.resources / generated.sources

Both register a directory (usually a task's @Output) as a contribution to the consumer's build, and both auto-wire the producing task to run first:

  • generated.resources — added to the JAR classpath, reachable via getResourceAsStream("/path/in/jar").
  • generated.sources — added as a Kotlin source root and compiled with the consumer's src/.

Tasks vs commands

Tasks are the implementation, addressed as ./kotlin task :<module>:<task>@<plugin-id> — the docs advise against relying on that mangled name. Commands are the public API: ./kotlin do <command-name>, listed via ./kotlin show commands (-m <module> to scope).

  • A task whose @Output feeds generated.resources/generated.sources is a build-graph contributor. Keep it out of commands:; it runs automatically and exposing it invites users to run it by hand.
  • A task users invoke directly must be in commands:.

File-based task communication

There is no shared mutable build state — no project.version, no extension property maps. Tasks talk through matched paths:

  1. The producer takes @Output outputDir: Path and writes files into it.
  2. plugin.yaml points a consumer task's @Input at ${tasks.<producer>.action.outputDir}/<file>.
  3. The Toolchain infers the dependency from the path match — no dependsOn API needed.

The same @Output directory can serve build-time consumers (via @Input) and runtime consumers (registered under generated.resources, read via getResourceAsStream) simultaneously.

Runtime overrides via environment variables

There is no -Pkey=value. Read env vars inside the action for ephemeral overrides:

kotlin
val forced = System.getenv("MYPLUGIN_FORCE_VALUE")?.takeIf { it.isNotBlank() }
val skipChecks = System.getenv("MYPLUGIN_SKIP_CHECKS")?.equals("true", ignoreCase = true) == true

Pass the env map in as a constructor parameter rather than calling System.getenv() deep in the call stack, so logic stays unit-testable. Document every recognised variable in the plugin's README. Env vars are ephemeral overrides, not a trust boundary — validate a value before using it in a file path or process argument.

Sharing logic across task actions

Tasks often share steps (verify → create → push). Don't compose an atomic user-facing task from a chain of build-graph tasks: separate invocations re-open shared resources and open a window where another process observes intermediate state.

Limitations to design around

  • Plugins are local-only; no public registry publishing yet.
  • Plugins are module-level; there is no project-wide plugin. Every consumer module lists it under plugins:, and cross-module effects flow through files.
  • No ${...} interpolation in module.yaml (as of 0.11) — consumer settings are literal values.
  • No Project.afterEvaluate, no lazy Provider/Property graph. Compute derived values in the action body.
  • -h/--help does not list plugin commands; use ./kotlin show commands.

Validate against a consumer

  1. Add a small consumer module (demo-app/, sample/) enabling the plugin with realistic settings.
  2. Have its main.kt or a test read whatever the plugin publishes.
  3. Put the exact commands and expected output in the plugin's README, so a fresh clone can paste and compare.

Plugin docs: https://kotlin-toolchain.org/dev/user-guide/plugins/

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Kotlin Tooling Kotlin Toolchain Plugin Authoring AI skill do?

Load when authoring, writing, or designing a Kotlin Toolchain local plugin to extend the declarative build with code generation, build-time processing, custom verification, or packaging that module.yaml cannot express, or when referencing @TaskAction, @Configurable, plugin.yaml, or jvm/amper-plugin. Skip for porting an existing Gradle plugin.

Why use Kotlin Tooling Kotlin Toolchain Plugin Authoring on TypingMind?

Because you install it once and use it with any model. Kotlin Tooling Kotlin Toolchain Plugin Authoring is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Kotlin Tooling Kotlin Toolchain Plugin Authoring in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Kotlin/kotlin-agent-skills/tree/main/skills/kotlin-tooling-kotlin-toolchain-plugin-authoring. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Kotlin Tooling Kotlin Toolchain Plugin Authoring?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Kotlin Tooling Kotlin Toolchain Plugin Authoring?

As many as you like. As long as a model supports skills, you can use Kotlin Tooling Kotlin Toolchain Plugin Authoring with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Kotlin Tooling Kotlin Toolchain Plugin Authoring AI skill free?

Yes. It is published on GitHub by Kotlin under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇