Kotlin Java Library Design
SkillMediaHelps agents design and review Kotlin library APIs for Java consumers. Use when building Kotlin code intended for Java callers, shaping JVM signatures with @JvmName, @JvmOverloads, @JvmStatic, @JvmField, @Throws, @JvmRecord, nullability, records, and backward/binary compatibility rules.
Use Kotlin Java Library Design in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Kotlin Java Library Design and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the Kotlin Java Library Design skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; Ahel provides instructions and does not run this skill.
No other account needed.
Add Ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
What this skill tells your AI
The instructions your AI receives, as published by alexandru/skills in skills/kotlin-java-library/SKILL.md and read by Ahel’s review.
Quick start
- Read
references/kotlin-java-library.mdbefore changing public Kotlin APIs for Java consumers. - Design Kotlin APIs as if the primary caller is Java: explicit overloads, stable names, and predictable nullability.
- Use JVM interop annotations (
@JvmOverloads,@JvmStatic,@JvmField,@JvmName) to shape the Java surface. - Prefer Java-friendly top-level functions with
@file:JvmName, and use@file:JvmMultifileClasswhen splitting across files. - Use
fun interfacefor Java callbacks; avoid function types that returnUnit. - Document checked exceptions with
@Throwsand return defensive copies for read-only collections. - Follow binary compatibility rules: add overloads or new members instead of changing published signatures.
- Validate examples with
scripts/verify-examples.javawhen changing the reference or public API patterns.
Workflow
- Identify which public APIs must be Java-friendly (constructors, factories, utilities, callbacks, records).
- Shape the Java surface with JVM annotations and explicit overloads.
- Audit public signatures for Java stability (names, nullability, overload sets, and collection exposure).
- Apply backward-compatibility rules before publishing; treat
@PublishedApimembers as public. - Validate with Java call-site examples.
- Run
jbang skills/kotlin-java-library/scripts/verify-examples.java; if it fails, fix the sample or document why it cannot be tested.
Rules of thumb
- Avoid Kotlin-only surface features in public API: default args without overloads, extension-only entry points, and name clashes.
- Explicitly declare public return and property types.
- Use
@JvmOverloadsfor Java-callable optional parameters, and provide explicit overloads when behavior differs. - Use
@JvmStaticfor companion/object members meant to be static in Java. - Use
const valfor compile-time constants and@JvmFieldonly for immutable non-constfields you want exposed as fields. - Use
@JvmNameto resolve signature clashes or to provide a stable Java name. - Use
@JvmRecordonly for new Java-record value carriers targeting JVM 16+; do not retrofit it onto published classes. - Avoid
Nothingin public generic signatures; it becomes raw types in Java.
Output expectations
- Offer Java-call-site examples when proposing API changes.
- Call out binary compatibility risks and safer alternatives.
- Include validation results for non-trivial snippets.
References
- Load
references/kotlin-java-library.mdfor interop details, examples, and testing prompts.
Signals
- GitHub stars
- 53
- Forks
- 3
- Last commit
- Oct 2026
Advanced
- Item type
- skill
- Key
kotlin-java-library- Source
- github.com/alexandru/skills
Related picks
Skill · a5c-ai
The pick for Java110-java-maven-best-practices
Skill · jabrena
The pick for Javakotlin-tooling-agp9-migration
Skill · kotlin
The pick for Kotlinapollo-kotlin
Skill · apollographql
The pick for Kotlinprototype
Skill · mattpocock
More in Mediabrand-guidelines
Skill · anthropics
More in Media