kotlin-fundamentals
11
总安装量
5
周安装量
#28020
全站排名
安装命令
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-kotlin --skill kotlin-fundamentals
Agent 安装分布
opencode
3
cursor
3
github-copilot
3
antigravity
3
gemini-cli
3
Skill 文档
Kotlin Fundamentals Skill
Master Kotlin programming fundamentals with production-ready patterns.
Topics Covered
Null Safety
// Safe call + Elvis
val name = user?.name ?: "Anonymous"
// requireNotNull for validation
requireNotNull(user) { "User required" }
Data Classes
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")