java-to-kotlin

java-to-kotlin is a skill for Claude Code, Codex from navikt/copilot. It costs 35 tokens per session (3,620 once invoked), scanned A, original, MIT.

A step-by-step guide for converting Java code to Kotlin while preserving its behavior. It also covers Kotlin-specific cleanup and changes between related technologies, such as Spring to Ktor and JUnit to Kotest.

In plain words
What is it for?
Use it to convert individual Java files or mixed Java/Kotlin services, review null handling and collections, remove Lombok, and plan a phased migration for a Nav service.
Why use it?
It supports gradual migration, so a team can move an existing codebase without changing everything at once. Keeping tests passing during each step helps reveal behavior changes early.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to convert individual Java files or mixed Java/Kotlin services, review null handling and collections, remove Lombok, and plan a phased migration for a Nav service.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/navikt/copilot/java-to-kotlin
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add navikt/copilot --skill java-to-kotlin
Clone the repo
git clone --depth 1 https://github.com/navikt/copilot

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for java-to-kotlin

README.md
[![agentmods](https://agentmods.dev/badge/skills/navikt/copilot/java-to-kotlin/github.svg)](https://agentmods.dev/skills/navikt/copilot/java-to-kotlin)
Your own site
<a href="https://agentmods.dev/skills/navikt/copilot/java-to-kotlin"><img src="https://agentmods.dev/badge/skills/navikt/copilot/java-to-kotlin/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for java-to-kotlin

Your own site · 80×15
<a href="https://agentmods.dev/skills/navikt/copilot/java-to-kotlin"><img src="https://agentmods.dev/badge/skills/navikt/copilot/java-to-kotlin.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,620 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00035 $0.03620
Opus 5.5 $0.00014 $0.01448
Sonnet 5.5 $0.00007 $0.00724
Haiku 4.5 $0.00003 $0.00362

Measured 1mo ago against content hash b646e646c61b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

java-to-kotlin scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/java-to-kotlin/SKILL.md · 506 lines

How it starts

The opening of the file, as written. The whole thing — 506 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Java to Kotlin Migration

Systematic conversion of Java codebases to idiomatic Kotlin, with framework-aware transformations for Nav services. Covers the full journey from faithful translation through nullability audit, collection migration, and idiomatic transforms — plus framework-specific patterns for Spring→Ktor, JPA→Kotliquery, JUnit→Kotest, and Lombok elimination.

When to Use

  • Migrating existing Java services to Kotlin
  • Converting Java files in mixed Java/Kotlin codebases
  • Onboarding teams from Java to Kotlin patterns
  • Planning a phased migration strategy for a Nav service

4-Step Conversion Methodology

Step 1: Faithful Translation

Direct Java → Kotlin conversion preserving exact behavior. Use IntelliJ's built-in converter as a starting point, then fix compilation errors. Keep all existing tests passing. No idiomatic changes yet — correctness first.

// Java — before
public class UserService {
    private final UserRepository repository;
    private final Logger log = LoggerFactory.getLogger(UserService.class);

    public UserService(UserRepository repository) {
        this.repository = repository;
    }

    public User findById(Long id) {
        User user = repository.findById(id);
        if (user == null) {
            throw new NotFoundException("User not found: " + id);
        }
        log.info("Found user: {}", user.getName());
        return user;
    }

    public List<User> findActive() {
        return repository.findAll().stream()
            .filter(u -> u.getStatus().equals("active"))
            .collect(Collectors.toList());
    }
}
// Kotlin — Step 1: faithful translation (no idiomatic changes)
class UserService(private val repository: UserRepository) {
    private val log = LoggerFactory.getLogger(UserService::class.java)

    fun findById(id: Long): User {
        val user = repository.findById(id)
        if (user == null) {
            throw NotFoundException("User not found: $id")
        }
        log.info("Found user: {}", user.name)
        return user
    }

    fun findActive(): List<User> {
        return repository.findAll().stream()
            .filter { u -> u.status == "active" }
            .collect(Collectors.toList())
    }
}

Read the full file on GitHub · 506 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · -1 lines b646e646c61b
  2. 1mo ago First seen · 507 lines · 35 tokens per session scan A b8305c1d1251

Subscribe to this mod's changes

java-to-kotlin is a skill published in the GitHub repository navikt/copilot (56 stars, last pushed today), licensed MIT. It adds 35 tokens to every session and 3,620 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.