Kotlin Specialist

Implements idiomatic Kotlin — structured coroutine concurrency, Flow streams, Kotlin Multiplatform architecture, Compose UI, Ktor servers, and type-safe DSL design.

Development / Languagesdevelopmentlanguages
by AgentVoltv1.0.0Published 1y ago1 install
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

PromptHow do I structure a Kotlin service using coroutines
Beforegeneric AI agent
Kotlin and coroutines are great for building scalable services. There are several patterns you could use depending on your specific needs — you might want to consider structured concurrency, launch vs async, proper exception handling, and flow for streams. Coroutines are fairly flexible, so the best approach depends on your architecture and requirements. Do you have a specific use case in mind? For instance, are you building an HTTP server, a background worker, or something else? That would help me tailor the recommendation.
Afterwith Kotlin Specialist
KOTLIN COROUTINE SERVICE PATTERN

FOUNDATION: STRUCTURED CONCURRENCY
• Use CoroutineScope for lifecycle management. Never GlobalScope — it has no cancellation.
• Pair scope with Job for clean shutdown. Example: val scope = CoroutineScope(Job() + Dispatchers.Default)
• On service shutdown, call scope.cancel() to propagate cancellation to all children.

CONCURRENCY MODEL: LAUNCH VS ASYNC
• launch() → fire-and-forget work (no return value). Use for logging, metrics, side effects.
• async() → suspendable work with Result. Use when you need .await() and exception handling.
• Never mix — launching an async that you forget to await() is a memory leak.

FLOW FOR STREAMS
• Flow<T> replaces callback hell. Build with flow { emit(data) }
• Collect safely: catch { e -> log.error() } then emit a fallback or rethrow.
• Use .buffer() if downstream is slow — otherwise backpressure stalls.

EXCEPTION HANDLING
• launch { try/catch } wraps each coroutine — unhandled exceptions crash the scope.
• Use CoroutineExceptionHandler on the scope dispatcher, not inside try/catch.
• async().await() surfaces exceptions to the caller (don't swallow with try/catch at launch).

TYPE-SAFE EXAMPLE: KTOR SERVER
embedApplication {
  install(StatusPages) { exception<Exception> { e -> respond(...) } }
  routing { get("/data") { val data = repository.fetchAsync().await(); respond(data) } }
}

About this skill


name: kotlin-specialist description: Use when Provides idiomatic Kotlin implementation patterns including coroutine concurrency, Flow stream handling, multiplatform architecture, Compose UI construction, Ktor server setup, and type-safe DSL de...

Kotlin Specialist

Provides idiomatic Kotlin implementation patterns including coroutine concurrency, Flow stream handling, multiplatform architecture, Compose UI construction, Ktor server setup, and type-safe DSL design. Use when building Kotlin applications requiring coroutines, multiplatform development, or Android with Compose. Invoke for Flow API, KMP projects, Ktor servers, DSL design, sealed classes, suspend function, Android Kotlin, Kotlin Multiplatform.

What you get

  • Public GitHub repo
  • the skills/kotlin-specialist folder with SKILL.md and references.

Customize your output

  • Fork the repo and extend the skill's reference files for your own stack conventions.

Example output

Activates on a matching request (e.g. building or reviewing Kotlin Specialist code) and can chain with other skills in the pack.

Best for

Full-stack developers and engineering teams using Claude Code.

SKILL.md preview

SKILL.md
---
name: kotlin-specialist
description: Use this skill when building Kotlin applications that require coroutines, multiplatform development, or Android with Compose, including Flow, Ktor servers, and DSL design.
version: 1.0.0
category: Development / Languages
author: AgentVolt
license: proprietary
tags:
  - development
  - languages
---

# Kotlin Specialist

Implements idiomatic Kotlin — structured coroutine concurrency, Flow streams, Kotlin Multiplatform architecture, Compose UI, Ktor servers, and type-safe DSL design.

## When to use

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →