[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75EX6X76EZWM9Q2FBFYKBXZ":3,"skill-same:01M75EX6X76EZWM9Q2FBFYKBXZ":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M75EX6X76EZWM9Q2FBFYKBXZ","kotlin-patterns",null,"Idiomatic Kotlin patterns, best practices, and conventions for building robust, efficient, and maintainable Kotlin applications with coroutines, null safety, and DSL builders.","agisota\u002Fold-one","agisota","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F121413592?v=4","01M75B4BRNT67EC1NDRT8QZEP2","01M75B4BS7QR9VP580MSCPTS3X",3,"MIT","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fkotlin-patterns\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: kotlin-patterns\ndescription: Idiomatic Kotlin patterns, best practices, and conventions for building robust, efficient, and maintainable Kotlin applications with coroutines, null safety, and DSL builders.\norigin: ECC\n---\n\n# Kotlin Development Patterns\n\nIdiomatic Kotlin patterns and best practices for building robust, efficient, and maintainable applications.\n\n## When to Use\n\n- Writing new Kotlin code\n- Reviewing Kotlin code\n- Refactoring existing Kotlin code\n- Designing Kotlin modules or libraries\n- Configuring Gradle Kotlin DSL builds\n\n## How It Works\n\nThis skill enforces idiomatic Kotlin conventions across seven key areas: null safety using the type system and safe-call operators, immutability via `val` and `copy()` on data classes, sealed classes and interfaces for exhaustive type hierarchies, structured concurrency with coroutines and `Flow`, extension functions for adding behaviour without inheritance, type-safe DSL builders using `@DslMarker` and lambda receivers, and Gradle Kotlin DSL for build configuration.\n\n## Examples\n\n**Null safety with Elvis operator:**\n```kotlin\nfun getUserEmail(userId: String): String {\n    val user = userRepository.findById(userId)\n    return user?.email ?: \"unknown@example.com\"\n}\n```\n\n**Sealed class for exhaustive results:**\n```kotlin\nsealed class Result\u003Cout T> {\n    data class Success\u003CT>(val data: T) : Result\u003CT>()\n    data class Failure(val error: AppError) : Result\u003CNothing>()\n    data object Loading : Result\u003CNothing>()\n}\n```\n\n**Structured concurrency with async\u002Fawait:**\n```kotlin\nsuspend fun fetchUserWithPosts(userId: String): UserProfile =\n    coroutineScope {\n        val user = async { userService.getUser(userId) }\n        val posts = async { postService.getUserPosts(userId) }\n        UserProfile(user = user.await(), posts = posts.await())\n    }\n```\n\n## Core Principles\n\n### 1. Null Safety\n\nKotlin's type system distinguishes nullable and non-nullable types. Leverage it fully.\n\n```kotlin\n\u002F\u002F Good: Use non-nullable types by default\nfun getUser(id: String): User {\n    return userRepository.findById(id)\n        ?: throw UserNotFoundException(\"User $id not found\")\n}\n\n\u002F\u002F Good: Safe calls and Elvis operator\nfun getUserEmail(userId: String): String {\n    val user = userRepository.findById(userId)\n    return user?.email ?: \"unknown@example.com\"\n}\n\n\u002F\u002F Bad: Force-unwrapping nullable types\nfun getUserEmail(userId: String): String {\n    val user = userRepository.findById(userId)\n    return user!!.email \u002F\u002F Throws NPE if null\n}\n```\n\n### 2. Immutability by Default\n\nPrefer `val` over `var`, immutable collections over mutable ones.\n\n```kotlin\n\u002F\u002F Good: Immutable data\ndata class User(\n    val id: String,\n    val name: String,\n    val email: String,\n)\n\n\u002F\u002F Good: Transform with copy()\nfun updateEmail(user: User, newEmail: String): User =\n    user.copy(email = newEmail)\n\n\u002F\u002F Good: Immutable collections\nval users: List\u003CUser> = listOf(user1, user2)\nval filtered = users.filter { it.email.isNotBlank() }\n\n\u002F\u002F Bad: Mutable state\nvar currentUser: User? = null \u002F\u002F Avoid mutable global state\nval mutableUsers = mutableListOf\u003CUser>() \u002F\u002F Avoid unless truly needed\n```\n\n### 3. Expression Bodies and Single-Expression Functions\n\nUse expression bodies for concise, readable functions.\n\n```kotlin\n\u002F\u002F Good: Expression body\nfun isAdult(age: Int): Boolean = age >= 18\n\nfun formatFullName(first: String, last: String): String =\n    \"$first $last\".trim()\n\nfun User.displayName(): String =\n    name.ifBlank { email.substringBefore('@') }\n\n\u002F\u002F Good: When as expression\nfun statusMessage(code: Int): String = when (code) {\n    200 -> \"OK\"\n    404 -> \"Not Found\"\n    500 -> \"Internal Server Error\"\n    else -> \"Unknown status: $code\"\n}\n\n\u002F\u002F Bad: Unnecessary block body\nfun isAdult(age: Int): Boolean {\n    return age >= 18\n}\n```\n\n### 4. Data Classes for Value Objects\n\nUse data classes for types that primarily hold data.\n\n```kotlin\n\u002F\u002F Good: Data class with copy, equals, hashCode, toString\ndata class CreateUserRequest(\n    val name: String,\n    val email: String,\n    val role: Role = Role.USER,\n)\n\n\u002F\u002F Good: Value class for type safety (zero overhead at runtime)\n@JvmInline\nvalue class UserId(val value: String) {\n    init {\n        require(value.isNotBlank()) { \"UserId cannot be blank\" }\n    }\n}\n\n@JvmInline\nvalue class Email(val value: String) {\n    init {\n        require('@' in value) { \"Invalid email: $value\" }\n    }\n}\n\nfun getUser(id: UserId): User = userRepository.findById(id)\n```\n\n## Sealed Classes and Interfaces\n\n### Modeling Restricted Hierarchies\n\n```kotlin\n\u002F\u002F Good: Sealed class for exhaustive when\nsealed class Result\u003Cout T> {\n    data class Success\u003CT>(val data: T) : Result\u003CT>()\n    data class Failure(val error: AppError) : Result\u003CNothing>()\n    data object Loading : Result\u003CNothing>()\n}\n\nfun \u003CT> Result\u003CT>.getOrNull(): T? = when (this) {\n    is Result.Success -> data\n    is Result.Failure -> null\n    is Result.Loading -> null\n}\n\nfun \u003CT> Result\u003CT>.getOrThrow(): T = when (this) {\n    is Result.Success -> data\n    is Result.Failure -> throw error.toException()\n    is Result.Loading -> throw IllegalStateException(\"Still loading\")\n}\n```\n\n### Sealed Interfaces for API Responses\n\n```kotlin\nsealed interface ApiError {\n    val message: String\n\n    data class NotFound(override val message: String) : ApiError\n    data class Unauthorized(override val message: String) : ApiError\n    data class Validation(\n        override val message: String,\n        val field: String,\n    ) : ApiError\n    data class Internal(\n        override val message: String,\n        val cause: Throwable? = null,\n    ) : ApiError\n}\n\nfun ApiError.toStatusCode(): Int = when (this) {\n    is ApiError.NotFound -> 404\n    is ApiError.Unauthorized -> 401\n    is ApiError.Validation -> 422\n    is ApiError.Internal -> 500\n}\n```\n\n## Scope Functions\n\n### When to Use Each\n\n```kotlin\n\u002F\u002F let: Transform nullable or scoped result\nval length: Int? = name?.let { it.trim().length }\n\n\u002F\u002F apply: Configure an object (returns the object)\nval user = User().apply {\n    name = \"Alice\"\n    email = \"alice@example.com\"\n}\n\n\u002F\u002F also: Side effects (returns the object)\nval user = createUser(request).also { logger.info(\"Created user: ${it.id}\") }\n\n\u002F\u002F run: Execute a block with receiver (returns result)\nval result = connection.run {\n    prepareStatement(sql)\n    executeQuery()\n}\n\n\u002F\u002F with: Non-extension form of run\nval csv = with(StringBuilder()) {\n    appendLine(\"name,email\")\n    users.forEach { appendLine(\"${it.name},${it.email}\") }\n    toString()\n}\n```\n\n### Anti-Patterns\n\n```kotlin\n\u002F\u002F Bad: Nesting scope functions\nuser?.let { u ->\n    u.address?.let { addr ->\n        addr.city?.let { city ->\n            println(city) \u002F\u002F Hard to read\n        }\n    }\n}\n\n\u002F\u002F Good: Chain safe calls instead\nval city = user?.address?.city\ncity?.let { println(it) }\n```\n\n## Extension Functions\n\n### Adding Functionality Without Inheritance\n\n```kotlin\n\u002F\u002F Good: Domain-specific extensions\nfun String.toSlug(): String =\n    lowercase()\n        .replace(Regex(\"[^a-z0-9\\\\s-]\"), \"\")\n        .replace(Regex(\"\\\\s+\"), \"-\")\n        .trim('-')\n\nfun Instant.toLocalDate(zone: ZoneId = ZoneId.systemDefault()): LocalDate =\n    atZone(zone).toLocalDate()\n\n\u002F\u002F Good: Collection extensions\nfun \u003CT> List\u003CT>.second(): T = this[1]\n\nfun \u003CT> List\u003CT>.secondOrNull(): T? = getOrNull(1)\n\n\u002F\u002F Good: Scoped extensions (not polluting global namespace)\nclass UserService {\n    private fun User.isActive(): Boolean =\n        status == Status.ACTIVE && lastLogin.isAfter(Instant.now().minus(30, ChronoUnit.DAYS))\n\n    fun getActiveUsers(): List\u003CUser> = userRepository.findAll().filter { it.isActive() }\n}\n```\n\n## Coroutines\n\n### Structured Concurrency\n\n```kotlin\n\u002F\u002F Good: Structured concurrency with coroutineScope\nsuspend fun fetchUserWithPosts(userId: String): UserProfile =\n    coroutineScope {\n        val userDeferred = async { userService.getUser(userId) }\n        val postsDeferred = async { postService.getUserPosts(userId) }\n\n        UserProfile(\n            user = userDeferred.await(),\n            posts = postsDeferred.await(),\n        )\n    }\n\n\u002F\u002F Good: supervisorScope when children can fail independently\nsuspend fun fetchDashboard(userId: String): Dashboard =\n    supervisorScope {\n        val user = async { userService.getUser(userId) }\n        val notifications = async { notificationService.getRecent(userId) }\n        val recommendations = async { recommendationService.getFor(userId) }\n\n        Dashboard(\n            user = user.await(),\n            notifications = try {\n                notifications.await()\n            } catch (e: CancellationException) {\n                throw e\n            } catch (e: Exception) {\n                emptyList()\n            },\n            recommendations = try {\n                recommendations.await()\n            } catch (e: CancellationException) {\n                throw e\n            } catch (e: Exception) {\n                emptyList()\n            },\n        )\n    }\n```\n\n### Flow for Reactive Streams\n\n```kotlin\n\u002F\u002F Good: Cold flow with proper error handling\nfun observeUsers(): Flow\u003CList\u003CUser>> = flow {\n    while (currentCoroutineContext().isActive) {\n        val users = userRepository.findAll()\n        emit(users)\n        delay(5.seconds)\n    }\n}.catch { e ->\n    logger.error(\"Error observing users\", e)\n    emit(emptyList())\n}\n\n\u002F\u002F Good: Flow operators\nfun searchUsers(query: Flow\u003CString>): Flow\u003CList\u003CUser>> =\n    query\n        .debounce(300.milliseconds)\n        .distinctUntilChanged()\n        .filter { it.length >= 2 }\n        .mapLatest { q -> userRepository.search(q) }\n        .catch { emit(emptyList()) }\n```\n\n### Cancellation and Cleanup\n\n```kotlin\n\u002F\u002F Good: Respect cancellation\nsuspend fun processItems(items: List\u003CItem>) {\n    items.forEach { item ->\n        ensureActive() \u002F\u002F Check cancellation before expensive work\n        processItem(item)\n    }\n}\n\n\u002F\u002F Good: Cleanup with try\u002Ffinally\nsuspend fun acquireAndProcess() {\n    val resource = acquireResource()\n    try {\n        resource.process()\n    } finally {\n        withContext(NonCancellable) {\n            resource.release() \u002F\u002F Always release, even on cancellation\n        }\n    }\n}\n```\n\n## Delegation\n\n### Property Delegation\n\n```kotlin\n\u002F\u002F Lazy initialization\nval expensiveData: List\u003CUser> by lazy {\n    userRepository.findAll()\n}\n\n\u002F\u002F Observable property\nvar name: String by Delegates.observable(\"initial\") { _, old, new ->\n    logger.info(\"Name changed from '$old' to '$new'\")\n}\n\n\u002F\u002F Map-backed properties\nclass Config(private val map: Map\u003CString, Any?>) {\n    val host: String by map\n    val port: Int by map\n    val debug: Boolean by map\n}\n\nval config = Config(mapOf(\"host\" to \"localhost\", \"port\" to 8080, \"debug\" to true))\n```\n\n### Interface Delegation\n\n```kotlin\n\u002F\u002F Good: Delegate interface implementation\nclass LoggingUserRepository(\n    private val delegate: UserRepository,\n    private val logger: Logger,\n) : UserRepository by delegate {\n    \u002F\u002F Only override what you need to add logging to\n    override suspend fun findById(id: String): User? {\n        logger.info(\"Finding user by id: $id\")\n        return delegate.findById(id).also {\n            logger.info(\"Found user: ${it?.name ?: \"null\"}\")\n        }\n    }\n}\n```\n\n## DSL Builders\n\n### Type-Safe Builders\n\n```kotlin\n\u002F\u002F Good: DSL with @DslMarker\n@DslMarker\nannotation class HtmlDsl\n\n@HtmlDsl\nclass HTML {\n    private val children = mutableListOf\u003CElement>()\n\n    fun head(init: Head.() -> Unit) {\n        children += Head().apply(init)\n    }\n\n    fun body(init: Body.() -> Unit) {\n        children += Body().apply(init)\n    }\n\n    override fun toString(): String = children.joinToString(\"\\n\")\n}\n\nfun html(init: HTML.() -> Unit): HTML = HTML().apply(init)\n\n\u002F\u002F Usage\nval page = html {\n    head { title(\"My Page\") }\n    body {\n        h1(\"Welcome\")\n        p(\"Hello, World!\")\n    }\n}\n```\n\n### Configuration DSL\n\n```kotlin\ndata class ServerConfig(\n    val host: String = \"0.0.0.0\",\n    val port: Int = 8080,\n    val ssl: SslConfig? = null,\n    val database: DatabaseConfig? = null,\n)\n\ndata class SslConfig(val certPath: String, val keyPath: String)\ndata class DatabaseConfig(val url: String, val maxPoolSize: Int = 10)\n\nclass ServerConfigBuilder {\n    var host: String = \"0.0.0.0\"\n    var port: Int = 8080\n    private var ssl: SslConfig? = null\n    private var database: DatabaseConfig? = null\n\n    fun ssl(certPath: String, keyPath: String) {\n        ssl = SslConfig(certPath, keyPath)\n    }\n\n    fun database(url: String, maxPoolSize: Int = 10) {\n        database = DatabaseConfig(url, maxPoolSize)\n    }\n\n    fun build(): ServerConfig = ServerConfig(host, port, ssl, database)\n}\n\nfun serverConfig(init: ServerConfigBuilder.() -> Unit): ServerConfig =\n    ServerConfigBuilder().apply(init).build()\n\n\u002F\u002F Usage\nval config = serverConfig {\n    host = \"0.0.0.0\"\n    port = 443\n    ssl(\"\u002Fcerts\u002Fcert.pem\", \"\u002Fcerts\u002Fkey.pem\")\n    database(\"jdbc:postgresql:\u002F\u002Flocalhost:5432\u002Fmydb\", maxPoolSize = 20)\n}\n```\n\n## Sequences for Lazy Evaluation\n\n```kotlin\n\u002F\u002F Good: Use sequences for large collections with multiple operations\nval result = users.asSequence()\n    .filter { it.isActive }\n    .map { it.email }\n    .filter { it.endsWith(\"@company.com\") }\n    .take(10)\n    .toList()\n\n\u002F\u002F Good: Generate infinite sequences\nval fibonacci: Sequence\u003CLong> = sequence {\n    var a = 0L\n    var b = 1L\n    while (true) {\n        yield(a)\n        val next = a + b\n        a = b\n        b = next\n    }\n}\n\nval first20 = fibonacci.take(20).toList()\n```\n\n## Gradle Kotlin DSL\n\n### build.gradle.kts Configuration\n\n```kotlin\n\u002F\u002F Check for latest versions: https:\u002F\u002Fkotlinlang.org\u002Fdocs\u002Freleases.html\nplugins {\n    kotlin(\"jvm\") version \"2.3.10\"\n    kotlin(\"plugin.serialization\") version \"2.3.10\"\n    id(\"io.ktor.plugin\") version \"3.4.0\"\n    id(\"org.jetbrains.kotlinx.kover\") version \"0.9.7\"\n    id(\"io.gitlab.arturbosch.detekt\") version \"1.23.8\"\n}\n\ngroup = \"com.example\"\nversion = \"1.0.0\"\n\nkotlin {\n    jvmToolchain(21)\n}\n\ndependencies {\n    \u002F\u002F Ktor\n    implementation(\"io.ktor:ktor-server-core:3.4.0\")\n    implementation(\"io.ktor:ktor-server-netty:3.4.0\")\n    implementation(\"io.ktor:ktor-server-content-negotiation:3.4.0\")\n    implementation(\"io.ktor:ktor-serialization-kotlinx-json:3.4.0\")\n\n    \u002F\u002F Exposed\n    implementation(\"org.jetbrains.exposed:exposed-core:1.0.0\")\n    implementation(\"org.jetbrains.exposed:exposed-dao:1.0.0\")\n    implementation(\"org.jetbrains.exposed:exposed-jdbc:1.0.0\")\n    implementation(\"org.jetbrains.exposed:exposed-kotlin-datetime:1.0.0\")\n\n    \u002F\u002F Koin\n    implementation(\"io.insert-koin:koin-ktor:4.2.0\")\n\n    \u002F\u002F Coroutines\n    implementation(\"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2\")\n\n    \u002F\u002F Testing\n    testImplementation(\"io.kotest:kotest-runner-junit5:6.1.4\")\n    testImplementation(\"io.kotest:kotest-assertions-core:6.1.4\")\n    testImplementation(\"io.kotest:kotest-property:6.1.4\")\n    testImplementation(\"io.mockk:mockk:1.14.9\")\n    testImplementation(\"io.ktor:ktor-server-test-host:3.4.0\")\n    testImplementation(\"org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2\")\n}\n\ntasks.withType\u003CTest> {\n    useJUnitPlatform()\n}\n\ndetekt {\n    config.setFrom(files(\"config\u002Fdetekt\u002Fdetekt.yml\"))\n    buildUponDefaultConfig = true\n}\n```\n\n## Error Handling Patterns\n\n### Result Type for Domain Operations\n\n```kotlin\n\u002F\u002F Good: Use Kotlin's Result or a custom sealed class\nsuspend fun createUser(request: CreateUserRequest): Result\u003CUser> = runCatching {\n    require(request.name.isNotBlank()) { \"Name cannot be blank\" }\n    require('@' in request.email) { \"Invalid email format\" }\n\n    val user = User(\n        id = UserId(UUID.randomUUID().toString()),\n        name = request.name,\n        email = Email(request.email),\n    )\n    userRepository.save(user)\n    user\n}\n\n\u002F\u002F Good: Chain results\nval displayName = createUser(request)\n    .map { it.name }\n    .getOrElse { \"Unknown\" }\n```\n\n### require, check, error\n\n```kotlin\n\u002F\u002F Good: Preconditions with clear messages\nfun withdraw(account: Account, amount: Money): Account {\n    require(amount.value > 0) { \"Amount must be positive: $amount\" }\n    check(account.balance >= amount) { \"Insufficient balance: ${account.balance} \u003C $amount\" }\n\n    return account.copy(balance = account.balance - amount)\n}\n```\n\n## Collection Operations\n\n### Idiomatic Collection Processing\n\n```kotlin\n\u002F\u002F Good: Chained operations\nval activeAdminEmails: List\u003CString> = users\n    .filter { it.role == Role.ADMIN && it.isActive }\n    .sortedBy { it.name }\n    .map { it.email }\n\n\u002F\u002F Good: Grouping and aggregation\nval usersByRole: Map\u003CRole, List\u003CUser>> = users.groupBy { it.role }\n\nval oldestByRole: Map\u003CRole, User?> = users.groupBy { it.role }\n    .mapValues { (_, users) -> users.minByOrNull { it.createdAt } }\n\n\u002F\u002F Good: Associate for map creation\nval usersById: Map\u003CUserId, User> = users.associateBy { it.id }\n\n\u002F\u002F Good: Partition for splitting\nval (active, inactive) = users.partition { it.isActive }\n```\n\n## Quick Reference: Kotlin Idioms\n\n| Idiom | Description |\n|-------|-------------|\n| `val` over `var` | Prefer immutable variables |\n| `data class` | For value objects with equals\u002FhashCode\u002Fcopy |\n| `sealed class\u002Finterface` | For restricted type hierarchies |\n| `value class` | For type-safe wrappers with zero overhead |\n| Expression `when` | Exhaustive pattern matching |\n| Safe call `?.` | Null-safe member access |\n| Elvis `?:` | Default value for nullables |\n| `let`\u002F`apply`\u002F`also`\u002F`run`\u002F`with` | Scope functions for clean code |\n| Extension functions | Add behavior without inheritance |\n| `copy()` | Immutable updates on data classes |\n| `require`\u002F`check` | Precondition assertions |\n| Coroutine `async`\u002F`await` | Structured concurrent execution |\n| `Flow` | Cold reactive streams |\n| `sequence` | Lazy evaluation |\n| Delegation `by` | Reuse implementation without inheritance |\n\n## Anti-Patterns to Avoid\n\n```kotlin\n\u002F\u002F Bad: Force-unwrapping nullable types\nval name = user!!.name\n\n\u002F\u002F Bad: Platform type leakage from Java\nfun getLength(s: String) = s.length \u002F\u002F Safe\nfun getLength(s: String?) = s?.length ?: 0 \u002F\u002F Handle nulls from Java\n\n\u002F\u002F Bad: Mutable data classes\ndata class MutableUser(var name: String, var email: String)\n\n\u002F\u002F Bad: Using exceptions for control flow\ntry {\n    val user = findUser(id)\n} catch (e: NotFoundException) {\n    \u002F\u002F Don't use exceptions for expected cases\n}\n\n\u002F\u002F Good: Use nullable return or Result\nval user: User? = findUserOrNull(id)\n\n\u002F\u002F Bad: Ignoring coroutine scope\nGlobalScope.launch { \u002F* Avoid GlobalScope *\u002F }\n\n\u002F\u002F Good: Use structured concurrency\ncoroutineScope {\n    launch { \u002F* Properly scoped *\u002F }\n}\n\n\u002F\u002F Bad: Deeply nested scope functions\nuser?.let { u ->\n    u.address?.let { a ->\n        a.city?.let { c -> process(c) }\n    }\n}\n\n\u002F\u002F Good: Direct null-safe chain\nuser?.address?.city?.let { process(it) }\n```\n\n**Remember**: Kotlin code should be concise but readable. Leverage the type system for safety, prefer immutability, and use coroutines for concurrency. When in doubt, let the compiler help you.\n","# Kotlin Development Patterns\n\nIdiomatic Kotlin patterns and best practices for building robust, efficient, and maintainable applications.\n\n## When to Use\n\n- Writing new Kotlin code\n- Reviewing Kotlin code\n- Refactoring existing Kotlin code\n- Designing Kotlin modules or libraries\n- Configuring Gradle Kotlin DSL builds\n\n## How It Works\n\nThis skill enforces idiomatic Kotlin conventions across seven key areas: null safety using the type system and safe-call operators, immutability via `val` and `copy()` on data classes, sealed classes and interfaces for exhaustive type hierarchies, structured concurrency with coroutines and `Flow`, extension functions for adding behaviour without inheritance, type-safe DSL builders using `@DslMarker` and lambda receivers, and Gradle Kotlin DSL for build configuration.\n\n## Examples\n\n**Null safety with Elvis operator:**\n```kotlin\nfun getUserEmail(userId: String): String {\n    val user = userRepository.findById(userId)\n    return user?.email ?: \"unknown@example.com\"\n}\n```\n\n**Sealed class for exhaustive results:**\n```kotlin\nsealed class Result\u003Cout T> {\n    data class Success\u003CT>(val data: T) : Result\u003CT>()\n    data class Failure(val error: AppError) : Result\u003CNothing>()\n    data object Loading : Result\u003CNothing>()\n}\n```\n\n**Structured concurrency with async\u002Fawait:**\n```kotlin\nsuspend fun fetchUserWithPosts(userId: String): UserProfile =\n    coroutineScope {\n        val user = async { userService.getUser(userId) }\n        val posts = async { postService.getUserPosts(userId) }\n        UserProfile(user = user.await(), posts = posts.await())\n    }\n```\n\n## Core Principles\n\n### 1. Null Safety\n\nKotlin's type system distinguishes nullable and non-nullable types. Leverage it fully.\n\n```kotlin\n\u002F\u002F Good: Use non-nullable types by default\nfun getUser(id: String): User {\n    return userRepository.findById(id)\n        ?: throw UserNotFoundException(\"User $id not found\")\n}\n\n\u002F\u002F Good: Safe calls and Elvis operator\nfun getUserEmail(userId: String): String {\n    val user = userRepository.findById(userId)\n    return user?.email ?: \"unknown@example.com\"\n}\n\n\u002F\u002F Bad: Force-unwrapping nullable types\nfun getUserEmail(userId: String): String {\n    val user = userRepository.findById(userId)\n    return user!!.email \u002F\u002F Throws NPE if null\n}\n```\n\n### 2. Immutability by Default\n\nPrefer `val` over `var`, immutable collections over mutable ones.\n\n```kotlin\n\u002F\u002F Good: Immutable data\ndata class User(\n    val id: String,\n    val name: String,\n    val email: String,\n)\n\n\u002F\u002F Good: Transform with copy()\nfun updateEmail(user: User, newEmail: String): User =\n    user.copy(email = newEmail)\n\n\u002F\u002F Good: Immutable collections\nval users: List\u003CUser> = listOf(user1, user2)\nval filtered = users.filter { it.email.isNotBlank() }\n\n\u002F\u002F Bad: Mutable state\nvar currentUser: User? = null \u002F\u002F Avoid mutable global state\nval mutableUsers = mutableListOf\u003CUser>() \u002F\u002F Avoid unless truly needed\n```\n\n### 3. Expression Bodies and Single-Expression Functions\n\nUse expression bodies for concise, readable functions.\n\n```kotlin\n\u002F\u002F Good: Expression body\nfun isAdult(age: Int): Boolean = age >= 18\n\nfun formatFullName(first: String, last: String): String =\n    \"$first $last\".trim()\n\nfun User.displayName(): String =\n    name.ifBlank { email.substringBefore('@') }\n\n\u002F\u002F Good: When as expression\nfun statusMessage(code: Int): String = when (code) {\n    200 -> \"OK\"\n    404 -> \"Not Found\"\n    500 -> \"Internal Server Error\"\n    else -> \"Unknown status: $code\"\n}\n\n\u002F\u002F Bad: Unnecessary block body\nfun isAdult(age: Int): Boolean {\n    return age >= 18\n}\n```\n\n### 4. Data Classes for Value Objects\n\nUse data classes for types that primarily hold data.\n\n```kotlin\n\u002F\u002F Good: Data class with copy, equals, hashCode, toString\ndata class CreateUserRequest(\n    val name: String,\n    val email: String,\n    val role: Role = Role.USER,\n)\n\n\u002F\u002F Good: Value class for type safety (zero overhead at runtime)\n@JvmInline\nvalue class UserId(val value: String) {\n    init {\n        require(value.isNotBlank()) { \"UserId cannot be blank\" }\n    }\n}\n\n@JvmInline\nvalue class Email(val value: String) {\n    init {\n        require('@' in value) { \"Invalid email: $value\" }\n    }\n}\n\nfun getUser(id: UserId): User = userRepository.findById(id)\n```\n\n## Sealed Classes and Interfaces\n\n### Modeling Restricted Hierarchies\n\n```kotlin\n\u002F\u002F Good: Sealed class for exhaustive when\nsealed class Result\u003Cout T> {\n    data class Success\u003CT>(val data: T) : Result\u003CT>()\n    data class Failure(val error: AppError) : Result\u003CNothing>()\n    data object Loading : Result\u003CNothing>()\n}\n\nfun \u003CT> Result\u003CT>.getOrNull(): T? = when (this) {\n    is Result.Success -> data\n    is Result.Failure -> null\n    is Result.Loading -> null\n}\n\nfun \u003CT> Result\u003CT>.getOrThrow(): T = when (this) {\n    is Result.Success -> data\n    is Result.Failure -> throw error.toException()\n    is Result.Loading -> throw IllegalStateException(\"Still loading\")\n}\n```\n\n### Sealed Interfaces for API Responses\n\n```kotlin\nsealed interface ApiError {\n    val message: String\n\n    data class NotFound(override val message: String) : ApiError\n    data class Unauthorized(override val message: String) : ApiError\n    data class Validation(\n        override val message: String,\n        val field: String,\n    ) : ApiError\n    data class Internal(\n        override val message: String,\n        val cause: Throwable? = null,\n    ) : ApiError\n}\n\nfun ApiError.toStatusCode(): Int = when (this) {\n    is ApiError.NotFound -> 404\n    is ApiError.Unauthorized -> 401\n    is ApiError.Validation -> 422\n    is ApiError.Internal -> 500\n}\n```\n\n## Scope Functions\n\n### When to Use Each\n\n```kotlin\n\u002F\u002F let: Transform nullable or scoped result\nval length: Int? = name?.let { it.trim().length }\n\n\u002F\u002F apply: Configure an object (returns the object)\nval user = User().apply {\n    name = \"Alice\"\n    email = \"alice@example.com\"\n}\n\n\u002F\u002F also: Side effects (returns the object)\nval user = createUser(request).also { logger.info(\"Created user: ${it.id}\") }\n\n\u002F\u002F run: Execute a block with receiver (returns result)\nval result = connection.run {\n    prepareStatement(sql)\n    executeQuery()\n}\n\n\u002F\u002F with: Non-extension form of run\nval csv = with(StringBuilder()) {\n    appendLine(\"name,email\")\n    users.forEach { appendLine(\"${it.name},${it.email}\") }\n    toString()\n}\n```\n\n### Anti-Patterns\n\n```kotlin\n\u002F\u002F Bad: Nesting scope functions\nuser?.let { u ->\n    u.address?.let { addr ->\n        addr.city?.let { city ->\n            println(city) \u002F\u002F Hard to read\n        }\n    }\n}\n\n\u002F\u002F Good: Chain safe calls instead\nval city = user?.address?.city\ncity?.let { println(it) }\n```\n\n## Extension Functions\n\n### Adding Functionality Without Inheritance\n\n```kotlin\n\u002F\u002F Good: Domain-specific extensions\nfun String.toSlug(): String =\n    lowercase()\n        .replace(Regex(\"[^a-z0-9\\\\s-]\"), \"\")\n        .replace(Regex(\"\\\\s+\"), \"-\")\n        .trim('-')\n\nfun Instant.toLocalDate(zone: ZoneId = ZoneId.systemDefault()): LocalDate =\n    atZone(zone).toLocalDate()\n\n\u002F\u002F Good: Collection extensions\nfun \u003CT> List\u003CT>.second(): T = this[1]\n\nfun \u003CT> List\u003CT>.secondOrNull(): T? = getOrNull(1)\n\n\u002F\u002F Good: Scoped extensions (not polluting global namespace)\nclass UserService {\n    private fun User.isActive(): Boolean =\n        status == Status.ACTIVE && lastLogin.isAfter(Instant.now().minus(30, ChronoUnit.DAYS))\n\n    fun getActiveUsers(): List\u003CUser> = userRepository.findAll().filter { it.isActive() }\n}\n```\n\n## Coroutines\n\n### Structured Concurrency\n\n```kotlin\n\u002F\u002F Good: Structured concurrency with coroutineScope\nsuspend fun fetchUserWithPosts(userId: String): UserProfile =\n    coroutineScope {\n        val userDeferred = async { userService.getUser(userId) }\n        val postsDeferred = async { postService.getUserPosts(userId) }\n\n        UserProfile(\n            user = userDeferred.await(),\n            posts = postsDeferred.await(),\n        )\n    }\n\n\u002F\u002F Good: supervisorScope when children can fail independently\nsuspend fun fetchDashboard(userId: String): Dashboard =\n    supervisorScope {\n        val user = async { userService.getUser(userId) }\n        val notifications = async { notificationService.getRecent(userId) }\n        val recommendations = async { recommendationService.getFor(userId) }\n\n        Dashboard(\n            user = user.await(),\n            notifications = try {\n                notifications.await()\n            } catch (e: CancellationException) {\n                throw e\n            } catch (e: Exception) {\n                emptyList()\n            },\n            recommendations = try {\n                recommendations.await()\n            } catch (e: CancellationException) {\n                throw e\n            } catch (e: Exception) {\n                emptyList()\n            },\n        )\n    }\n```\n\n### Flow for Reactive Streams\n\n```kotlin\n\u002F\u002F Good: Cold flow with proper error handling\nfun observeUsers(): Flow\u003CList\u003CUser>> = flow {\n    while (currentCoroutineContext().isActive) {\n        val users = userRepository.findAll()\n        emit(users)\n        delay(5.seconds)\n    }\n}.catch { e ->\n    logger.error(\"Error observing users\", e)\n    emit(emptyList())\n}\n\n\u002F\u002F Good: Flow operators\nfun searchUsers(query: Flow\u003CString>): Flow\u003CList\u003CUser>> =\n    query\n        .debounce(300.milliseconds)\n        .distinctUntilChanged()\n        .filter { it.length >= 2 }\n        .mapLatest { q -> userRepository.search(q) }\n        .catch { emit(emptyList()) }\n```\n\n### Cancellation and Cleanup\n\n```kotlin\n\u002F\u002F Good: Respect cancellation\nsuspend fun processItems(items: List\u003CItem>) {\n    items.forEach { item ->\n        ensureActive() \u002F\u002F Check cancellation before expensive work\n        processItem(item)\n    }\n}\n\n\u002F\u002F Good: Cleanup with try\u002Ffinally\nsuspend fun acquireAndProcess() {\n    val resource = acquireResource()\n    try {\n        resource.process()\n    } finally {\n        withContext(NonCancellable) {\n            resource.release() \u002F\u002F Always release, even on cancellation\n        }\n    }\n}\n```\n\n## Delegation\n\n### Property Delegation\n\n```kotlin\n\u002F\u002F Lazy initialization\nval expensiveData: List\u003CUser> by lazy {\n    userRepository.findAll()\n}\n\n\u002F\u002F Observable property\nvar name: String by Delegates.observable(\"initial\") { _, old, new ->\n    logger.info(\"Name changed from '$old' to '$new'\")\n}\n\n\u002F\u002F Map-backed properties\nclass Config(private val map: Map\u003CString, Any?>) {\n    val host: String by map\n    val port: Int by map\n    val debug: Boolean by map\n}\n\nval config = Config(mapOf(\"host\" to \"localhost\", \"port\" to 8080, \"debug\" to true))\n```\n\n### Interface Delegation\n\n```kotlin\n\u002F\u002F Good: Delegate interface implementation\nclass LoggingUserRepository(\n    private val delegate: UserRepository,\n    private val logger: Logger,\n) : UserRepository by delegate {\n    \u002F\u002F Only override what you need to add logging to\n    override suspend fun findById(id: String): User? {\n        logger.info(\"Finding user by id: $id\")\n        return delegate.findById(id).also {\n            logger.info(\"Found user: ${it?.name ?: \"null\"}\")\n        }\n    }\n}\n```\n\n## DSL Builders\n\n### Type-Safe Builders\n\n```kotlin\n\u002F\u002F Good: DSL with @DslMarker\n@DslMarker\nannotation class HtmlDsl\n\n@HtmlDsl\nclass HTML {\n    private val children = mutableListOf\u003CElement>()\n\n    fun head(init: Head.() -> Unit) {\n        children += Head().apply(init)\n    }\n\n    fun body(init: Body.() -> Unit) {\n        children += Body().apply(init)\n    }\n\n    override fun toString(): String = children.joinToString(\"\\n\")\n}\n\nfun html(init: HTML.() -> Unit): HTML = HTML().apply(init)\n\n\u002F\u002F Usage\nval page = html {\n    head { title(\"My Page\") }\n    body {\n        h1(\"Welcome\")\n        p(\"Hello, World!\")\n    }\n}\n```\n\n### Configuration DSL\n\n```kotlin\ndata class ServerConfig(\n    val host: String = \"0.0.0.0\",\n    val port: Int = 8080,\n    val ssl: SslConfig? = null,\n    val database: DatabaseConfig? = null,\n)\n\ndata class SslConfig(val certPath: String, val keyPath: String)\ndata class DatabaseConfig(val url: String, val maxPoolSize: Int = 10)\n\nclass ServerConfigBuilder {\n    var host: String = \"0.0.0.0\"\n    var port: Int = 8080\n    private var ssl: SslConfig? = null\n    private var database: DatabaseConfig? = null\n\n    fun ssl(certPath: String, keyPath: String) {\n        ssl = SslConfig(certPath, keyPath)\n    }\n\n    fun database(url: String, maxPoolSize: Int = 10) {\n        database = DatabaseConfig(url, maxPoolSize)\n    }\n\n    fun build(): ServerConfig = ServerConfig(host, port, ssl, database)\n}\n\nfun serverConfig(init: ServerConfigBuilder.() -> Unit): ServerConfig =\n    ServerConfigBuilder().apply(init).build()\n\n\u002F\u002F Usage\nval config = serverConfig {\n    host = \"0.0.0.0\"\n    port = 443\n    ssl(\"\u002Fcerts\u002Fcert.pem\", \"\u002Fcerts\u002Fkey.pem\")\n    database(\"jdbc:postgresql:\u002F\u002Flocalhost:5432\u002Fmydb\", maxPoolSize = 20)\n}\n```\n\n## Sequences for Lazy Evaluation\n\n```kotlin\n\u002F\u002F Good: Use sequences for large collections with multiple operations\nval result = users.asSequence()\n    .filter { it.isActive }\n    .map { it.email }\n    .filter { it.endsWith(\"@company.com\") }\n    .take(10)\n    .toList()\n\n\u002F\u002F Good: Generate infinite sequences\nval fibonacci: Sequence\u003CLong> = sequence {\n    var a = 0L\n    var b = 1L\n    while (true) {\n        yield(a)\n        val next = a + b\n        a = b\n        b = next\n    }\n}\n\nval first20 = fibonacci.take(20).toList()\n```\n\n## Gradle Kotlin DSL\n\n### build.gradle.kts Configuration\n\n```kotlin\n\u002F\u002F Check for latest versions: https:\u002F\u002Fkotlinlang.org\u002Fdocs\u002Freleases.html\nplugins {\n    kotlin(\"jvm\") version \"2.3.10\"\n    kotlin(\"plugin.serialization\") version \"2.3.10\"\n    id(\"io.ktor.plugin\") version \"3.4.0\"\n    id(\"org.jetbrains.kotlinx.kover\") version \"0.9.7\"\n    id(\"io.gitlab.arturbosch.detekt\") version \"1.23.8\"\n}\n\ngroup = \"com.example\"\nversion = \"1.0.0\"\n\nkotlin {\n    jvmToolchain(21)\n}\n\ndependencies {\n    \u002F\u002F Ktor\n    implementation(\"io.ktor:ktor-server-core:3.4.0\")\n    implementation(\"io.ktor:ktor-server-netty:3.4.0\")\n    implementation(\"io.ktor:ktor-server-content-negotiation:3.4.0\")\n    implementation(\"io.ktor:ktor-serialization-kotlinx-json:3.4.0\")\n\n    \u002F\u002F Exposed\n    implementation(\"org.jetbrains.exposed:exposed-core:1.0.0\")\n    implementation(\"org.jetbrains.exposed:exposed-dao:1.0.0\")\n    implementation(\"org.jetbrains.exposed:exposed-jdbc:1.0.0\")\n    implementation(\"org.jetbrains.exposed:exposed-kotlin-datetime:1.0.0\")\n\n    \u002F\u002F Koin\n    implementation(\"io.insert-koin:koin-ktor:4.2.0\")\n\n    \u002F\u002F Coroutines\n    implementation(\"org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2\")\n\n    \u002F\u002F Testing\n    testImplementation(\"io.kotest:kotest-runner-junit5:6.1.4\")\n    testImplementation(\"io.kotest:kotest-assertions-core:6.1.4\")\n    testImplementation(\"io.kotest:kotest-property:6.1.4\")\n    testImplementation(\"io.mockk:mockk:1.14.9\")\n    testImplementation(\"io.ktor:ktor-server-test-host:3.4.0\")\n    testImplementation(\"org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.2\")\n}\n\ntasks.withType\u003CTest> {\n    useJUnitPlatform()\n}\n\ndetekt {\n    config.setFrom(files(\"config\u002Fdetekt\u002Fdetekt.yml\"))\n    buildUponDefaultConfig = true\n}\n```\n\n## Error Handling Patterns\n\n### Result Type for Domain Operations\n\n```kotlin\n\u002F\u002F Good: Use Kotlin's Result or a custom sealed class\nsuspend fun createUser(request: CreateUserRequest): Result\u003CUser> = runCatching {\n    require(request.name.isNotBlank()) { \"Name cannot be blank\" }\n    require('@' in request.email) { \"Invalid email format\" }\n\n    val user = User(\n        id = UserId(UUID.randomUUID().toString()),\n        name = request.name,\n        email = Email(request.email),\n    )\n    userRepository.save(user)\n    user\n}\n\n\u002F\u002F Good: Chain results\nval displayName = createUser(request)\n    .map { it.name }\n    .getOrElse { \"Unknown\" }\n```\n\n### require, check, error\n\n```kotlin\n\u002F\u002F Good: Preconditions with clear messages\nfun withdraw(account: Account, amount: Money): Account {\n    require(amount.value > 0) { \"Amount must be positive: $amount\" }\n    check(account.balance >= amount) { \"Insufficient balance: ${account.balance} \u003C $amount\" }\n\n    return account.copy(balance = account.balance - amount)\n}\n```\n\n## Collection Operations\n\n### Idiomatic Collection Processing\n\n```kotlin\n\u002F\u002F Good: Chained operations\nval activeAdminEmails: List\u003CString> = users\n    .filter { it.role == Role.ADMIN && it.isActive }\n    .sortedBy { it.name }\n    .map { it.email }\n\n\u002F\u002F Good: Grouping and aggregation\nval usersByRole: Map\u003CRole, List\u003CUser>> = users.groupBy { it.role }\n\nval oldestByRole: Map\u003CRole, User?> = users.groupBy { it.role }\n    .mapValues { (_, users) -> users.minByOrNull { it.createdAt } }\n\n\u002F\u002F Good: Associate for map creation\nval usersById: Map\u003CUserId, User> = users.associateBy { it.id }\n\n\u002F\u002F Good: Partition for splitting\nval (active, inactive) = users.partition { it.isActive }\n```\n\n## Quick Reference: Kotlin Idioms\n\n| Idiom | Description |\n|-------|-------------|\n| `val` over `var` | Prefer immutable variables |\n| `data class` | For value objects with equals\u002FhashCode\u002Fcopy |\n| `sealed class\u002Finterface` | For restricted type hierarchies |\n| `value class` | For type-safe wrappers with zero overhead |\n| Expression `when` | Exhaustive pattern matching |\n| Safe call `?.` | Null-safe member access |\n| Elvis `?:` | Default value for nullables |\n| `let`\u002F`apply`\u002F`also`\u002F`run`\u002F`with` | Scope functions for clean code |\n| Extension functions | Add behavior without inheritance |\n| `copy()` | Immutable updates on data classes |\n| `require`\u002F`check` | Precondition assertions |\n| Coroutine `async`\u002F`await` | Structured concurrent execution |\n| `Flow` | Cold reactive streams |\n| `sequence` | Lazy evaluation |\n| Delegation `by` | Reuse implementation without inheritance |\n\n## Anti-Patterns to Avoid\n\n```kotlin\n\u002F\u002F Bad: Force-unwrapping nullable types\nval name = user!!.name\n\n\u002F\u002F Bad: Platform type leakage from Java\nfun getLength(s: String) = s.length \u002F\u002F Safe\nfun getLength(s: String?) = s?.length ?: 0 \u002F\u002F Handle nulls from Java\n\n\u002F\u002F Bad: Mutable data classes\ndata class MutableUser(var name: String, var email: String)\n\n\u002F\u002F Bad: Using exceptions for control flow\ntry {\n    val user = findUser(id)\n} catch (e: NotFoundException) {\n    \u002F\u002F Don't use exceptions for expected cases\n}\n\n\u002F\u002F Good: Use nullable return or Result\nval user: User? = findUserOrNull(id)\n\n\u002F\u002F Bad: Ignoring coroutine scope\nGlobalScope.launch { \u002F* Avoid GlobalScope *\u002F }\n\n\u002F\u002F Good: Use structured concurrency\ncoroutineScope {\n    launch { \u002F* Properly scoped *\u002F }\n}\n\n\u002F\u002F Bad: Deeply nested scope functions\nuser?.let { u ->\n    u.address?.let { a ->\n        a.city?.let { c -> process(c) }\n    }\n}\n\n\u002F\u002F Good: Direct null-safe chain\nuser?.address?.city?.let { process(it) }\n```\n\n**Remember**: Kotlin code should be concise but readable. Leverage the type system for safety, prefer immutability, and use coroutines for concurrency. When in doubt, let the compiler help you.\n",{"name":5,"origin":23,"description":7},"ECC","main","f37de8f681f0c0ca0e0ebab6e5fddf764ca7553d","skills\u002Fkotlin-patterns",1,"https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one","https:\u002F\u002Fagisota.github.io\u002Fold-one\u002F","https:\u002F\u002Fgithub.com\u002Fagisota","pzd.world","2026-07-04 22:32:06",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add agisota\u002Fold-one --skill kotlin-patterns",{"tool":39,"command":40},"bunx","bunx skills add agisota\u002Fold-one --skill kotlin-patterns",{"tool":42,"command":43},"pnpm","pnpm dlx skills add agisota\u002Fold-one --skill kotlin-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fkotlin-patterns\u002FSKILL.md",true,[],[48,55,62,71,78,85],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":18},"01M75KRGZWQWE9JDBS6RX42NWV","zoom-out","Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-out\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":18},"01M75KRCZHKE0ZYAQFFYHS0YNP","zeroize-audit","Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C\u002FC++\u002FRust code handling secrets, keys, passwords, or other sensitive data.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzeroize-audit\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":66,"licenseFileUrl":67,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":18},"01M75KR94KYQ30DTE1P9WNDAE0","yeet","Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":18},"01M75KR3H13YJ9QHMD49818FA1","yara-rule-authoring","Guides authoring of high-quality YARA-X detection rules for malware identification. Use when writing, reviewing, or optimizing YARA rules. Covers naming conventions, string selection, performance optimization, migration from legacy YARA, and false positive reduction. Triggers on: YARA, YARA-X, malware detection, threat hunting, IOC, signature, crx module, dex module.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyara-rule-authoring\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M75KQMPY8A4Y8XTDD2DT0M9T","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-twitter-growth\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":18},"01M75KQHNZ0ANZNJGZY6M8MDAK","x-api","X\u002FTwitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-api\u002FSKILL.md",[],[]]