Agent skill
kotlin-fundamentals
Kotlin language fundamentals - syntax, null safety, data classes, extensions
Stars
163
Forks
31
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/kotlin-fundamentals
SKILL.md
Kotlin Fundamentals Skill
Master Kotlin programming fundamentals with production-ready patterns.
Topics Covered
Null Safety
kotlin
// Safe call + Elvis
val name = user?.name ?: "Anonymous"
// requireNotNull for validation
requireNotNull(user) { "User required" }
Data Classes
kotlin
data class User(val id: Long, val name: String) {
init { require(name.isNotBlank()) }
}
Scope Functions
| Function | Context | Returns | Use Case |
|---|---|---|---|
let |
it | Lambda result | Null-safe transforms |
apply |
this | Same object | Object configuration |
run |
this | Lambda result | Object scope + result |
also |
it | Same object | Side effects |
Troubleshooting
| Issue | Resolution |
|---|---|
| NPE despite null check | Check platform types from Java |
| Smart cast fails | Use local variable or let |
Usage
Skill("kotlin-fundamentals")
Didn't find tool you were looking for?