Back to skills
SKILL.md
Kotlin
ASecurityBuild robust Android and multiplatform apps with Kotlin idioms, coroutines, and null safety.
- 14 stars
- 0 votes
- 0 copies
- 4 views
- Added September 7, 2026
Works with
Security analysis
100/100Pro scans all 8 files and shows the line behind each finding
npx -y skills add modbender/skill-library-mcp --skill kotlin --agent claude-codeAre you the author of Kotlin?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/modbender-kotlin)---
name: Kotlin
slug: kotlin
version: 1.0.1
description: Build robust Android and multiplatform apps with Kotlin idioms, coroutines, and null safety.
metadata: {"clawdbot":{"emoji":"π ","requires":{"bins":["kotlin"]},"os":["linux","darwin","win32"]}}
---
## Quick Reference
| Topic | File |
|-------|------|
| Null safety operators and patterns | `nullsafety.md` |
| Coroutines, flows, structured concurrency | `coroutines.md` |
| Collections, sequences, data classes | `collections.md` |
| Scope functions, extensions, sealed classes | `idioms.md` |
| Java interop and common Kotlin mistakes | `interop.md` |
| Android lifecycle, Compose state | `android.md` |
| Delegation, inline, reified, multiplatform | `advanced.md` |
## Critical Rules
### Null Safety
- `!!` asserts non-null β crashes on null, use only when you've already checked
- Platform types from Java are risky β add null checks or use `@Nullable`/`@NonNull` annotations
- Elvis with `return`/`throw` for early exit β `val name = user?.name ?: return`
### Coroutines
- `viewModelScope` auto-cancels on ViewModel clear β don't use `GlobalScope` in Android
- Structured concurrency: child coroutine failure cancels parent β use `supervisorScope` to isolate
- `StateFlow` needs initial value and never completes β `SharedFlow` for one-shot events
- Inject dispatchers for testability β don't hardcode `Dispatchers.IO`
### Collections & Data Classes
- `first()` throws on empty β use `firstOrNull()` for safe access
- Only constructor properties in `equals`/`hashCode` β body properties ignored
- `mutableStateListOf` for Compose β wrapping `mutableListOf` in state won't track changes
### Scope Functions & Extensions
- Don't nest scope functions β readability drops fast, extract to named functions
- Extensions are resolved statically β not polymorphic, receiver type matters at compile time
### Android/Compose
- `repeatOnLifecycle(STARTED)` for flow collection β `launchWhenStarted` is deprecated
- `remember` survives recomposition only β use `rememberSaveable` for config changes
- `collectAsStateWithLifecycle` is the gold standard β lifecycle-aware + Compose state
### Java Interop
- `==` is structural equality in Kotlin β `===` for reference, opposite of Java
- SAM conversion only for Java interfaces β Kotlin interfaces need explicit `fun interface`
- `@JvmStatic`, `@JvmOverloads`, `@JvmField` for Java-friendly APIs
Files in this skill
- SKILL.md
- advanced.md
- android.md
- collections.md
- coroutines.md
- idioms.md
- interop.md
- nullsafety.md
Attribution
Comments
Loading commentsβ¦