java-to-kotlin

Convert Java source code into idiomatic Kotlin with preserved behavior and API semantics.

2|Updated May 28, 2021
One-click install
npx skills add https://github.com/SpineEventEngine/validation --skill java-to-kotlin-spineeventengine
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: java-to-kotlin
Source: https://github.com/SpineEventEngine/validation/tree/main/.agents/skills/java-to-kotlin
Command: npx skills add https://github.com/SpineEventEngine/validation --skill java-to-kotlin-spineeventengine

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It converts Java code into idiomatic Kotlin while preserving behavior and API intent, saving time and reducing mistakes during migration.

Core Features & Use Cases

  • Javadoc to KDoc conversion with preserved wording: Translates Java API documentation into Kotlin documentation format, keeping the original wording meaningfully intact.
  • Nullability-aware type migration: Applies Kotlin nullable types only when Java types are annotated as @Nullable, helping prevent incorrect null handling.
  • Behavior-preserving Kotlin refactoring: Converts common Java constructs (getters/setters, static members, anonymous classes, builders) into Kotlin equivalents while keeping the same functionality.

Use cases include migrating a Java module to Kotlin, converting individual classes or methods, and modernizing documentation and API surfaces during a gradual adoption of Kotlin in a JVM codebase.

Quick Start

Ask the skill to convert the provided Java file(s) to Kotlin, preserving nullability and converting Javadoc to KDoc.

Frequently Asked Questions about java-to-kotlin

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert Java code to idiomatic Kotlin while preserving behavior?

Java @Nullable annotations are converted into Kotlin nullable types during migration, ensuring nullability-aware type conversion that aligns with Kotlin's null safety system and prevents incorrect null handling.

Can I migrate Javadoc to KDoc automatically during a Java to Kotlin conversion?

Yes, Javadoc is converted to KDoc during a Java to Kotlin migration, preserving the original wording and meaning to maintain consistent API documentation throughout the modernization process.

What is the best way to handle Java static constructs and anonymous classes when migrating to Kotlin?

You can migrate individual Java classes or methods to Kotlin by applying behavior-preserving refactoring techniques that convert nullability, documentation, and common Java patterns into their idiomatic Kotlin equivalents.

Does converting Java to Kotlin support gradual migration of a JVM module?

Yes, converting Java to Kotlin supports gradual migration of a JVM module by allowing you to modernize individual classes, methods, and API surfaces incrementally while maintaining behavioral compatibility across the codebase.