kotlin-specialist
What it does
It guides the AI agent to write clean Kotlin code for Android, shared multiplatform code, and backend servers. It is for developers who use Kotlin in their apps or services.
When to use it
- ✓When you are building an Android screen with Jetpack Compose.
- ✓When you need to share code across platforms with Kotlin Multiplatform.
- ✓When you need asynchronous work done safely with coroutines and Flow.
Skill link
https://github.com/Jeffallan/claude-skills/blob/main/skills/kotlin-specialist/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Build a Jetpack Compose screen that loads a list of items with coroutines and shows a loading state.”
5 new skills a week. 1 minute to read.
How it works
The agent designs the data models, implements the code with coroutines and Flow, and checks that cancellation and null safety are handled. It then runs detekt and ktlint and writes tests.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Kotlin Specialist
Senior Kotlin developer with deep expertise in coroutines, Kotlin Multiplatform (KMP), and modern Kotlin 1.9+ patterns.
Core Workflow
- Analyze architecture - Identify platform targets, coroutine patterns, shared code strategy
- Design models - Create sealed classes, data classes, type hierarchies
- Implement - Write idiomatic Kotlin with coroutines, Flow, extension functions
- Checkpoint: Verify coroutine cancellation is handled (parent scope cancelled on teardown) and null safety is enforced before proceeding
- Validate - Run
detektandktlint; verify coroutine cancellation handling and null safety- If detekt/ktlint fails: Fix all reported issues and re-run both tools before proceeding to step 5
- Optimize - Apply inline classes, sequence operations, compilation strategies
- Test - Write multiplatform tests with coroutine test support (
runTest, Turbine)
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Coroutines & Flow | references/coroutines-flow.md |
Async operations, structured concurrency, Flow API |
| Multiplatform | references/multiplatform-kmp.md |
Shared code, expect/actual, platform setup |
| Android & Compose | references/android-compose.md |
Jetpack Compose, ViewModel, Material3, navigation |
| Ktor Server | references/ktor-server.md |
Routing, plugins, authentication, serialization |
| DSL & Idioms | references/dsl-idioms.md |
Type-safe builders, scope functions, delegates |
Key Patterns
Sealed Classes for State Modeling
sealed class UiState<out T> {
data object Loading : UiState<Nothing>()
data class Success<T>(val data: T) : UiState<T>()
data class Error(val message: String, val cause: Throwable? = null) : UiState<Nothing>()
}
// Consume exhaustively — compiler enforces all branches
fun render(state: UiState<User>) = when (state) {
is UiState.Loading -> showSpinner()
is UiState.Success -> showUser(state.data)
is UiState.Error -> showError(state.message)
}
Coroutines & Flow
// Use structured concurrency — never GlobalScope
class UserRepository(private val api: UserApi, private val scope: CoroutineScope) {
fun userUpdates(id: String): Flow<UiState<User>> = flow {
emit(UiState.Loading)
try {
emit(UiState.Success(api.fetchUser(id)))
} catch (e: IOException) {
emit(UiState.Error("Network error", e))
}
}.flowOn(Dispatchers.IO)
private val _user = MutableStateFlow<UiState<User>>(UiState.Loading)
val user: StateFlow<UiState<User>> = _user.asStateFlow()
}
// Anti-pattern — blocks the calling thread; avoid in production
// runBlocking { api.fetchUser(id) }
Null Safety
// Prefer safe calls and elvis operator
val displayName = user?.profile?.name ?: "Anonymous"
// Use let to scope nullable operations
user?.email?.let { email -> sendNotification(email) }
// !! only when the null case is a true contract violation and documented
val config = requireNotNull(System.getenv("APP_CONFIG")) { "APP_CONFIG must be set" }
Scope Functions
// apply — configure an object, returns receiver
val request = HttpRequest().apply {
url = "https://api.example.com/users"
headers["Authorization"] = "Bearer $token"
}
// let — transform nullable / introduce a local scope
val length = name?.let { it.trim().length } ?: 0
// also — side-effects without changing the chain
val user = createUser(form).also { logger.info("Created user ${it.id}") }
Constraints
MUST DO
- Use null safety (
?,?.,?:,!!only when contract guarantees non-null) - Prefer
sealed classfor state modeling - Use
suspendfunctions for async operations - Leverage type inference but be explicit when needed
- Use
Flowfor reactive streams - Apply scope functions appropriately (
let,run,apply,also,with) - Document public APIs with KDoc
- Use explicit API mode for libraries
- Run
detektandktlintbefore committing - Verify coroutine cancellation is handled (cancel parent scope on teardown)
MUST NOT DO
- Block coroutines with
runBlockingin production code - Use
!!without documented justification - Mix platform-specific code in common modules
- Skip null safety checks
- Use
GlobalScope.launch(use structured concurrency) - Ignore coroutine cancellation
- Create memory
FAQ
What does Kotlin Multiplatform cover?
It covers shared code across platforms using expect and actual declarations.
Which linters does it run?
It runs detekt and ktlint and fixes what they report.
How does it test coroutine code?
It uses runTest and Turbine for coroutine and Flow tests.
Details
Original description by the author
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.
repo: Jeffallan/claude-skills
Popularity
- GitHub stars
- 12k
- Ranking position
- #11432
- License
- MIT
- Updated
- 10/30/2026
Comments
- …
More skills from this repository
angular-architect
12kHelps your agent build Angular 17 and newer apps with standalone components, lazy-loaded routing, NgRx state, RxJS patterns, and performance tuning.
api-designer
12kHelps your agent design REST or GraphQL APIs and write OpenAPI 3.1 specs, with rules for resources, pagination, error formats, and versioning.
architecture-designer
12kHelps your agent design system architecture, compare patterns and technologies, and write Architecture Decision Records that explain each choice.
atlassian-mcp
12kHelps your agent search and update Jira issues and Confluence pages through MCP, including JQL and CQL queries, sprints, and documentation sync.
Similar skills
android-clean-architecture
280kMakes your agent organize Android projects efficiently. It structures the code to make maintenance and new feature development easier.
compose-multiplatform-patterns
280kHelps your agent use Compose Multiplatform and Jetpack Compose patterns in KMP projects, covering state, navigation, theming, and performance.
dart-flutter-patterns
280kMakes your agent write code for Dart and Flutter apps. It uses modern patterns to create robust and manageable apps.