Table of content
Advanced Kotlin programming skills for coroutines and DSL patterns
Installation
npx claude-plugins install @TheBushidoCollective/han/jutsu-kotlin
Contents
Folders: scripts, skills
Files: CHANGELOG.md, README.md, han-plugin.yml
Documentation
Advanced Kotlin programming skills for coroutines and DSL patterns
Skills
This plugin provides the following skills:
- Kotlin Coroutines
- Kotlin Dsl Patterns
- Kotlin Null Safety
Usage
Once enabled, Claude will automatically apply these skills when working with relevant code. The plugin provides context and expertise that Claude uses to:
- Write idiomatic code following best practices
- Suggest appropriate patterns and architectures
- Catch common mistakes and anti-patterns
- Provide framework-specific guidance
Installation
Install with npx (no installation required):
han plugin install jutsu-kotlin
License
Licensed under MIT - see repository for details.
Included Skills
This plugin includes 3 skill definitions:
kotlin-coroutines
Use when kotlin coroutines for structured concurrency including suspend functions, coroutine builders, Flow, channels, and patterns for building efficient asynchronous code with cancellation and exception handling.
View skill definition
Kotlin Coroutines
Introduction
Kotlin coroutines provide a powerful framework for asynchronous programming that is lightweight, expressive, and built on structured concurrency principles. Coroutines enable writing asynchronous code that looks and behaves like sequential code, eliminating callback hell and improving readability.
Unlike threads, coroutines are extremely lightweight—millions can run on limited resources. The coroutine framework includes suspend functions for non-blocking operations, builders for launching work, Flow for reactive streams, and comprehensive cancellation and exception handling mechanisms.
This skill covers coroutine fundamentals, builders, contexts, Flow, channels, and production patterns for Android development and server-side Kotlin.
Suspend Functions
Suspend functions are the building blocks of coroutines, enabling non-blocking operations that can be paused and resumed without blocking threads.
// Basic suspend function
suspend fun fetchUser(id: Int): User {
delay(1000) // Suspends without blocking
return User(id, "Alice")
}
data class User(val id: Int, val name: String)
// Calling suspend functions
suspend fun loadUserProfile(id: Int): UserProfile {
val user = fetchUser(id)
val posts = fetchPosts(user.id)
return UserProfile(user, posts)
}
suspend fun fetchPosts(userId: Int): List<Post> {
delay(500)
return emptyList()
}
data class Post(val id: Int, val title: String)
data class UserProfile
...(truncated)
</details>
### kotlin-dsl-patterns
> Use when domain-specific language design in Kotlin using type-safe builders, infix functions, operator overloading, lambdas with receivers, and patterns for creating expressive, readable DSLs for configuration and domain modeling.
<details>
<summary>View skill definition</summary>
# Kotlin DSL Patterns
## Introduction
Kotlin's language features enable creation of expressive domain-specific
languages (DSLs) that feel like natural extensions of the language itself. DSLs
improve code readability, reduce boilerplate, and provide type-safe APIs for
configuration, builders, and domain modeling.
Key features supporting DSL design include lambdas with receivers, extension
functions, infix notation, operator overloading, and scope control. These
features combine to create fluent, intuitive APIs that express domain concepts
clearly without sacrificing type safety or IDE support.
This skill covers type-safe builders, lambda receivers, infix functions,
operator overloading, and practical patterns for designing maintainable DSLs in
Android, testing, and configuration contexts.
## Type-Safe Builders
Type-safe builders use lambdas with receivers to create hierarchical structures
with compile-time validation and IDE support.
```kotlin
// HTML DSL example
class HTML {
private val elements = mutableListOf<Element>()
fun head(init: Head.() -> Unit) {
val head = Head()
head.init()
elements.add(head)
}
fun body(init: Body.() -> Unit) {
val body = Body()
body.init()
elements.add(body)
}
override fun toString(): String {
return "<html>\n${elements.joinToString("\n")}\n</html>"
}
}
abstract class Element(val name: String) {
private val children = mutableListOf<Element>()
pr
...(truncated)
</details>
### kotlin-null-safety
> Use when kotlin's null safety system including nullable types, safe calls, Elvis operator, smart casts, and patterns for eliminating NullPointerExceptions while maintaining code expressiveness and clarity.
<details>
<summary>View skill definition</summary>
# Kotlin Null Safety
## Introduction
Kotlin's null safety system eliminates NullPointerExceptions at compile time by
distinguishing between nullable and non-nullable types in the type system. This
approach makes null handling explicit and forces developers to consciously
handle potential null values.
Unlike Java where any reference can be null, Kotlin requires explicit
declaration of nullability with the `?` operator. The compiler enforces null
checks before dereferencing nullable values, preventing the vast majority of
null-related crashes that plague Java applications.
This skill covers nullable types, safe call operators, smart casts, nullability
in generic types, and patterns for designing null-safe APIs while maintaining
code clarity.
## Nullable Types
Nullable types explicitly indicate that a variable or property can hold null,
while non-nullable types provide compile-time guarantees of non-null values.
```kotlin
// Non-nullable types
var name: String = "Alice"
// name = null // Compilation error
// Nullable types
var nullableName: String? = "Bob"
nullableName = null // OK
// Function parameters
fun greet(name: String) {
println("Hello, $name")
}
fun greetNullable(name: String?) {
if (name != null) {
println("Hello, $name")
} else {
println("Hello, guest")
}
}
// greet(null) // Compilation error
greetNullable(null) // OK
// Nullable return types
fun findUser(id: Int): User? {
return if (id > 0) User(id, "Alice") else null
...(truncated)
</details>
## Source
[View on GitHub](https://github.com/TheBushidoCollective/han)