# Kotlin Tooling Java To Kotlin

Use when converting Java source files to idiomatic Kotlin, when user mentions "java to...

- Repository: https://github.com/Kotlin/kotlin-agent-skills (1104 stars)
- Category: Mobile
- License: Apache-2.0
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add Kotlin/kotlin-agent-skills --skill kotlin-tooling-java-to-kotlin -g -a claude-code -y`
Codex: `npx skills add Kotlin/kotlin-agent-skills --skill kotlin-tooling-java-to-kotlin -g -a codex -y`
Cursor: `npx skills add Kotlin/kotlin-agent-skills --skill kotlin-tooling-java-to-kotlin -g -a cursor -y`
Gemini CLI: `npx skills add Kotlin/kotlin-agent-skills --skill kotlin-tooling-java-to-kotlin -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add Kotlin/kotlin-agent-skills`

## Description

Use 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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Java to Kotlin Conversion

Convert Java source files to idiomatic Kotlin using a disciplined 4-step conversion
methodology with 5 invariants checked at each step. Supports framework-aware conversion
that handles annotation site targets, library idioms, and API preservation.

## Workflow

```dot
digraph j2k_workflow {
  rankdir=TB;
  "User specifies files" -> "Step 0: Scan & Detect";
  "Step 0: Scan & Detect" -> "Load framework guides";
  "Load framework guides" -> "Step 1: Convert";
  "Step 1: Convert" -> "Step 2: Write .kt";
  "Step 2: Write .kt" -> "Step 3: Git rename";
  "Step 3: Git rename" -> "Step 4: Verify";
  "Step 4: Verify" -> "Next file?" [label="pass"];
  "Step 4: Verify" -> "Fix issues" [label="fail"];
  "Fix issues" -> "Step 1: Convert";
  "Next file?" -> "Step 0: Scan & Detect" [label="batch: yes"];
  "Next file?" -> "Done" [label="no more files"];
}
```

## Step 0: Scan & Detect Frameworks

Before converting, scan the Java file's import statements to detect which frameworks
are in use. Load ONLY the matching framework reference files to keep context focused.

### Framework Detection Table

The rest: https://github.com/Kotlin/kotlin-agent-skills/blob/HEAD/skills/kotlin-tooling-java-to-kotlin/SKILL.md
