Write, update, and audit KDoc documentation for the Multik library. Handles the full cycle: KDoc comments on source code, syncing with Writerside user docs in docs/topics/, and creating/updating Korro code samples.
npx skills add https://github.com/Kotlin/multik --skill multik-kdoc
Multik documentation lives at three layers. When documenting public API, always consider all three:
docs/topics/ — the user-facing documentation sitemultik-core/src/commonTest/kotlin/samples/docs/ — executable @Test methods linked into the Writerside markdownKorro samples exist to serve Writerside docs — they aren't needed for every KDoc, only for API elements that have (or should have) corresponding user documentation topics.
The user points to a specific file, class, or function.
docs/topics/ for references to this API element.The user asks to scan a module, package, or file for gaps.
public, internal, and private./** */), or KDoc that just restates the signature.override functions — project convention is to omit KDoc on overrides.Public KDoc should fit in a single IDE hover popup. This is the primary constraint — be thorough but not verbose.
Structure (in this order):
@property / @param — one per property/parameter. Describe what it represents and valid range.@return — when the return value isn't obvious from the name + type. Especially important for view-vs-copy semantics and shape changes.@throws — document exceptions and the conditions that trigger them. Multik uses require() and check(), so IllegalArgumentException and IllegalStateException are common.@see — link to 1-3 closely related functions for discoverability (e.g., reshape ↔ flatten). Don't overuse.Example — function with parameters:
/**
* Appends the given [value] elements to this array, returning a new flattened 1D array.
*
* The source array is flattened before appending. The original is not modified.
*
* ```
* val a = mk.ndarray(mk[1, 2, 3])
* a.append(4, 5) // [1, 2, 3, 4, 5]
* ```
*
* @param value elements to append.
* @return a new [D1Array] with size `this.size + value.size`.
* @throws IllegalArgumentException if [value] contains elements incompatible with the array's [DataType].
* @see [cat] for concatenation along a specific axis.
*/
public fun <T, D : Dimension> MultiArray<T, D>.append(vararg value: T): D1Array<T>
Example — class:
/**
* Applies batched math operations to a [MutableMultiArray] in-place without allocating new arrays.
*
* Use the [math] block to chain operations sequentially:
* ```
* mk.math.inplace(array) {
* math { sin() }
* }
* ```
*
* @param T the numeric element type.
* @param D the dimension type.
* @param base the mutable array to modify.
*/
public open class InplaceOperation<T : Number, D : Dimension>(base: MutableMultiArray<T, D>)
For internal and private elements, keep KDoc concise — one or two sentences explaining *why* this exists and what it does. No @param tags unless parameters are non-obvious. No examples.
/** Computes strides from [shape] in row-major (C) order. Last dimension has stride 1. */
internal fun computeStrides(shape: IntArray): IntArray
/** Checks that [index] is within bounds for [axis] of size [size]. Throws [IndexOutOfBoundsException] if not. */
@PublishedApi
internal inline fun checkBounds(value: Boolean, index: Int, axis: Int, size: Int)
[ClassName] and [functionName] for cross-references — they enable IDE navigation and Dokka links.T, D), document constraints beyond the type bound only if they exist.override functions to avoid duplication.After writing or updating KDoc on public API, check whether user docs need updating.
Search docs/topics/**/*.md for the class/function name. Check docs/mk.tree for the topic hierarchy.
If a topic references the element:
Korro is a build plugin that keeps code snippets in Writerside markdown in sync with actual Kotlin test code.
How it works: The gradle task korro scans markdown files listed in the korro { docs = ... } block of multik-core/build.gradle.kts. For each <!---FUN name--> ... <!---END--> block, it finds the matching @Test fun name() in sample test files and replaces the markdown code block with code between // SampleStart and // SampleEnd.
Markdown side (docs/topics/):
<!---IMPORT samples.docs.userGuide.CreatingMultidimensionalArrays-->
## Literal Construction
<!---FUN literal_construction-->
val a = mk.ndarray(mk[1, 2, 3])
// [1, 2, 3]
<!---END-->
Kotlin side (multik-core/src/commonTest/kotlin/samples/docs/userGuide/):
package samples.docs.userGuide
import org.jetbrains.kotlinx.multik.api.mk
import org.jetbrains.kotlinx.multik.api.*
import kotlin.test.Test
class CreatingMultidimensionalArrays {
@Test
fun literal_construction() {
// SampleStart
val a = mk.ndarray(mk[1, 2, 3])
// [1, 2, 3]
// SampleEnd
}
}
Everything between // SampleStart and // SampleEnd is injected into the markdown — including output comments. This is intentional: output comments show users the expected result directly in the documentation.
Output comment conventions:
a[2] // 3/* ... */ below the expressionprintln() + output comment to be explicitRules:
<!---FUN name--> must match the test function name exactly.<!---IMPORT package.ClassName--> must match the test class FQN.@Test methods.samples/docs/userGuide/, API reference in samples/docs/apiDocs/.When to create/update samples:
<!---FUN--> blocks.After updating samples, remind the user to run:
./gradlew :multik-core:jvmTest --tests "samples.docs.*"
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Take kotlin/multik-kdoc from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.