用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/G1Joshi/Agent-Skills --skill kotlin命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | kotlin |
| description | Kotlin programming for Android, coroutines, and JVM development. Use for .kt files. |
Modern Kotlin development with coroutines, null safety, and idiomatic patterns.
.kt filesdata class User(
val id: String,
val name: String,
val email: String,
val createdAt: Instant = Clock.System.now()
)
suspend fun fetchUser(id: String): User? {
return apiService.getUser(id)
}
// Nullable types
val name: String? = null
// Safe calls
val length = name?.length
// Elvis operator
val len = name?.length ?: 0
// Smart casts
if (name != null) {
println(name.length) // Smart cast to String
}
// Not-null assertion (use sparingly)
val len = name!!.length
data class User(
val id: String,
val name: String,
val email: String
)
sealed class Result<out T> {
data class Success<T>(val data: T) : Result<T>()
data class Error(val message: String) : Result<Nothing>()
object Loading : Result<Nothing>()
}
// Exhaustive when
fun handleResult(result: Result<User>) = when (result) {
is Result.Success -> println(result.data)
is Result.Error -> println(result.message)
Result.Loading -> println("Loading...")
}
// Suspend function
suspend fun fetchData(): List<Item> {
return withContext(Dispatchers.IO) {
api.fetchItems()
}
}
// Parallel execution
suspend fun loadDashboard(): Dashboard {
return coroutineScope {
val user = async { fetchUser() }
val orders = async { fetchOrders() }
Dashboard(user.await(), orders.await())
}
}
// Flow for streams
fun observeUsers(): Flow<List<User>> = flow {
while (true) {
emit(fetchUsers())
delay(5000)
}
}.flowOn(Dispatchers.IO)
fun String.isValidEmail(): Boolean {
return Regex("^[\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4}\$").matches(this)
}
fun <T> List<T>.secondOrNull(): T? = getOrNull(1)
inline fun <T> Result<T>.onSuccess(action: (T) -> Unit): Result<T> {
if (this is Result.Success) action(data)
return this
}
Do:
val over var)Don't:
!! without null checkrunBlocking| Error | Cause | Solution |
|---|---|---|
NullPointerException | Force unwrap on null | Use safe call ?. |
CancellationException | Coroutine cancelled | Handle or propagate |
IllegalStateException | Invalid state access | Check state before access |