/kotlin-compiler-plugin-skills:kotlin-compiler-pluginfrom kotlin-compiler-plugin-skills
Scaffolds, implements, tests, and ships Kotlin compiler plugins targeting K2 (FIR) frontend extensions and IR backend transformations. Use when building or modifying compiler plugins, custom diagnostics, synthetic declarations, or .kts/REPL dialects.
Ships in kotlin-compiler-plugin-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill bundles the how-to for every supported topic into one directory of reference guides. Load only what the current task needs.
references/<topic>/guide.md — that's the topic's full skill content.EVIDENCE.md (primary-source citations) or CHANGES.md (Kotlin-version migration notes) and you need them, Read those too. They are only present when there is something worth recording.../<other-topic>/guide.md. Follow them when the current task spans multiple topics.For non-trivial plugin work (more than a single-file change), use a spec-first, fan-out workflow. Compiler plugins decompose cleanly into FIR / IR / Gradle / sample parts that are largely independent once the shared scaffolding is fixed — so wall-clock time drops a lot if you parallelise.
Freeze the spec first. Before writing code, write a short intent.md (or reuse the task's SPEC.md) capturing: feature name, user-visible API shape, what FIR does, what IR does, the sample code that exercises it, and the verification commands. One page is enough. Without this, parallel agents will redesign the API mid-flight and collide.
Settle the shared bottlenecks sequentially. These touch files every parallel branch will read, so do them in one place first:
settings.gradle.kts (every module added must be enumerated here)plugin/build.gradle.kts dependencies { } blockplugin/src/main/resources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar and …CommandLineProcessorregisterExtensions(...) body that wires every FIR/IR extensionPluginNames / PluginKey constantsFan out the rest in parallel. Once the bottlenecks are frozen, these branches are usually safe to run as concurrent sub-agents (use the Agent tool with run_in_background: true):
sample/ source — exercises the public API contract; depends only on the contract, not on internalsBrief each agent on exactly which subdir / file / class it owns. Two agents must never touch the same file. If you find yourself wanting two agents to edit the same Gradle script or registrar, that work belongs in step 2, not step 3.
Integrate sequentially. Once all sub-agents return, you (the parent) run the verification commands from step 1. Don't trust agent self-reports — actually build the plugin and the sample, compile box tests, grep the output. If a build collides on a file two agents touched, the decomposition was wrong; redo step 2 with that file pulled into the sequential phase.
When the change is small (one file, one fix, one new diagnostic on an existing checker), skip this whole flow — the planning overhead exceeds the speedup.
| Topic | When to read |
|---|---|
compiler-plugin-bootstrap | Scaffolding a new Kotlin compiler plugin from scratch |
compiler-plugin-debugging | Setting up MessageCollector, IR dumps, debugger attach |
compiler-plugin-testing | Writing diagnostic / IR-box tests with the official infrastructure |
gradle-plugin-integration | Packaging via KotlinCompilerPluginSupportPlugin for distribution |
multi-version-kotlin-support | Supporting multiple Kotlin compiler versions in one plugin |
| Topic | What it covers |
|---|---|
fir-extensions-overview | Architecture, the 17 extension points, FirSession lifecycle, how to choose |
fir-predicate-system | Declarative annotation matching DSL (annotated, parentAnnotated, etc.) |
fir-additional-checkers-extension | Emit custom compile-time diagnostics (warnings/errors) on user code |
fir-declaration-generation-extension | Synthesise classes/functions/properties/constructors visible to source |
fir-supertype-generation-extension | Inject supertypes (interfaces, base classes) onto existing classes |
fir-status-transformer-extension | Modify modifiers on existing declarations (visibility, modality, inline, etc.) |
fir-expression-resolution-extension | Inject implicit extension receivers into call resolution |
fir-session-components | Share computed state across FIR extensions |
fir-type-attribute-extension | Attach plugin-defined attributes to types (e.g. @Positive Int) so they participate in inference and metadata |
fir-sam-conversion-transformer-extension | Customise SAM conversion — e.g. promote first parameter to a receiver (sam-with-receiver pattern) |
fir-assign-expression-alterer-extension | Rewrite property assignments to an arbitrary statement (e.g. x = v → x.assign(v)) |
fir-function-type-kind-extension | Declare new function-type families (e.g. @Composable () -> Unit) |
fir-function-call-refinement-extension | Refine a call's return type at the call site by generating local declarations (data-frame schema-inference pattern, advanced/unstable) |
fir-scripting-extensions | Define a .kts-style script dialect |
fir-repl-snippet-extensions | Implement a REPL / Jupyter-style dialect with cross-snippet visibility |
| Topic | What it covers |
|---|---|
ir-plugincontext-usage | Symbol lookup, diagnostic reporting, and metadata registration — the foundation API for any IR extension |
ir-call-rewriting | Replace function calls in user code with calls to a different function |
ir-body-modification | Modify existing function bodies, including filling in stubs declared by FIR |
ir-synthetic-class-generation | Synthesise new IR classes — typically the IR-side counterpart of FIR-generated declarations |
For someone new to compiler plugins:
compiler-plugin-bootstrap — project layout, hello-world plugincompiler-plugin-debugging — visibility setup before you do anything non-trivialfir-extensions-overview — architectural overview of K2 pluginsfir-predicate-system — used by every FIR extensionfir-additional-checkers-extensionfir-declaration-generation-extensionfir-supertype-generation-extensionfir-status-transformer-extensionfir-session-components — for plugins that share state across extensionsir-plugincontext-usage — foundation for any IR workir-call-rewritingir-body-modificationir-synthetic-class-generationcompiler-plugin-testing — once you have non-trivial behaviourgradle-plugin-integration — when ready to shipmulti-version-kotlin-support — only if you need itreferences/<topic>/
├── guide.md # current best practice for the supported Kotlin range
├── CHANGES.md # what changed across Kotlin versions (only when there's something to record)
└── EVIDENCE.md # primary-source citations for non-obvious claims (file:line in JetBrains/kotlin)
EVIDENCE.md lets a reviewer (or a future Claude session) spot-check any claim in guide.md against the upstream Kotlin compiler source without re-grepping. Each entry pairs a claim with a kotlin/<path>:line citation; some include a code snippet. Not all guides have one — only those with claims a careful reader would want to verify.
When a plugin author upgrades their Kotlin compiler and their plugin stops compiling, the relevant CHANGES.md walks them through the API migration. Guides with no CHANGES.md had no API churn worth singling out.
references/compiler-plugin-bootstrap/guide.md for the workaround.references/compiler-plugin-bootstrap/CHANGES.md (opens in a new tab)references/compiler-plugin-bootstrap/EVIDENCE.md (opens in a new tab)references/compiler-plugin-bootstrap/example/build.gradle.kts (opens in a new tab)references/compiler-plugin-bootstrap/example/gradle/wrapper/gradle-wrapper.jar (opens in a new tab)references/compiler-plugin-bootstrap/example/gradle/wrapper/gradle-wrapper.properties (opens in a new tab)references/compiler-plugin-bootstrap/example/gradlew (opens in a new tab)references/compiler-plugin-bootstrap/example/gradlew.bat (opens in a new tab)references/compiler-plugin-bootstrap/example/plugin/build.gradle.kts (opens in a new tab)references/compiler-plugin-bootstrap/example/plugin/src/main/kotlin/com/example/hello/HelloCommandLineProcessor.kt (opens in a new tab)references/compiler-plugin-bootstrap/example/plugin/src/main/kotlin/com/example/hello/HelloComponentRegistrar.kt (opens in a new tab)references/compiler-plugin-bootstrap/example/plugin/src/main/kotlin/com/example/hello/HelloIrGenerationExtension.kt (opens in a new tab)references/compiler-plugin-bootstrap/example/plugin/src/main/resources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor (opens in a new tab)references/compiler-plugin-bootstrap/example/plugin/src/main/resources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar (opens in a new tab)references/compiler-plugin-bootstrap/example/sample/build.gradle.kts (opens in a new tab)references/compiler-plugin-bootstrap/example/sample/src/main/kotlin/Hello.kt (opens in a new tab)references/compiler-plugin-bootstrap/example/sample/src/main/kotlin/Main.kt (opens in a new tab)references/compiler-plugin-bootstrap/example/settings.gradle.kts (opens in a new tab)references/compiler-plugin-bootstrap/guide.md (opens in a new tab)references/compiler-plugin-debugging/CHANGES.md (opens in a new tab)references/compiler-plugin-debugging/EVIDENCE.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub kitakkun/kotlin-compiler-plugin-skills --plugin kotlin-compiler-plugin-skillsOther plugins' skills for the same job