kotlin-craft

Refactor Java-style Kotlin code to idiomatic null-safe patterns.

5|1|Updated Jun 17, 2026
One-click install
npx skills add https://github.com/roanbrasil/engineer-grade-agent-skills --skill kotlin-craft
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-craft
Source: https://github.com/roanbrasil/engineer-grade-agent-skills/tree/main/skills/kotlin-craft
Command: npx skills add https://github.com/roanbrasil/engineer-grade-agent-skills --skill kotlin-craft

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the common pain point of writing non-idiomatic, error-prone Kotlin code that leans on Java patterns, ignores built-in null safety, and misuses coroutines and Flow, leading to frequent NullPointerExceptions, unmaintainable async logic, and technical debt in Kotlin codebases.

Core Features & Use Cases

  • Idiomatic Kotlin Patterns: Leverage null safety, data classes, sealed classes, scope functions, and extension functions to write concise, expressive, bug-resistant code instead of verbose Java-style Kotlin.
  • Coroutine & Flow Mastery: Implement structured concurrency, proper dispatcher usage, and cold/hot Flow streams for reliable async and event-driven applications, avoiding common pitfalls like unhandled cancellation or thread blocking.
  • Production-Grade Practices: Use Java interop annotations, Kotest/MockK testing patterns, and anti-pattern checklists to build maintainable, testable Kotlin services that integrate seamlessly with existing Java codebases.
  • Use Case Example: If you are building a real-time Android dashboard or a Kotlin microservice that consumes Kafka events, use this Skill to implement type-safe state handling with sealed classes, debounced search with StateFlow, and null-safe API clients that eliminate NPE risks.

Quick Start

Use the kotlin-craft skill to refactor your existing Java-style Kotlin user service to use idiomatic null-safe types, coroutine-based repository calls, and sealed class result wrappers for error handling.

Frequently Asked Questions about kotlin-craft

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

FAQPage Schema
How do I refactor Java-style Kotlin code to use idiomatic null safety and sealed classes?

Refactor Java-style Kotlin code by enforcing null-safe type usage and exhaustive sealed class hierarchies. This eliminates non-idiomatic patterns and NullPointerExceptions, resulting in concise, bug-resistant production-grade codebases.

What's the best way to implement structured concurrency and Flow streams in Kotlin coroutines?

Implement structured concurrency and Flow streams by applying proper dispatcher usage and cold/hot stream management. This ensures reliable async event processing in Kotlin applications, avoiding unhandled cancellation and thread blocking pitfalls.

Can I use this approach for Kotlin multiplatform and backend microservices consuming Kafka events?

Yes, this approach applies to Kotlin multiplatform and backend microservices. You can implement type-safe state handling with sealed classes and debounced search with StateFlow for reliable event-driven architectures.

How does Kotlin interoperate with existing Java codebases without losing null safety?

Kotlin interoperates with existing Java codebases using specific Java interop annotations. This maintains null-safe type usage and ensures seamless integration while eliminating technical debt from error-prone Java patterns.

Why should I use Kotest and MockK for testing Kotlin coroutines instead of Java patterns?

Use Kotest and MockK for idiomatic Kotlin-native testing of coroutines and Flow. This replaces error-prone Java patterns, ensuring maintainable, testable Kotlin services that enforce structured concurrency and exhaustive type checking.

Why does my Kotlin code keep throwing NullPointerExceptions despite using coroutines?

Kotlin code throws NullPointerExceptions when relying on Java patterns that ignore built-in null safety. Enforcing null-safe type usage, structured concurrency, and idiomatic data classes eliminates these runtime errors and async logic technical debt.