/kortex:ktorfrom kortex
Provides Ktor 3.5.x guidance for building, debugging, and deploying Kotlin HTTP servers and clients, including routing, serialization, authentication, WebSockets, SSE, and multiplatform client work.
Ships in kortex. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use this skill for Ktor framework work: Kotlin HTTP servers, HTTP clients, multiplatform clients, REST APIs, WebSockets, SSE, serialization, authentication, plugins, testing, and deployment.
Do not confuse Ktor with generic Kotlin, Spring Boot, ktorfit, Retrofit, OkHttp-only usage, or Kotlin Toolchain build
configuration. If the task is about module.yaml or the ./kotlin build CLI, load kotlin-toolchain too. If the task is
a standalone .main.kts script using Ktor, load main-kts too.
This skill is generated from the official Ktor documentation:
https://github.com/ktorio/ktor-documentationmain at the Ktor 3.5.x documentation lined118418a65e03d73ad7c2d33bb68e979cebcb4e53.5.12.3.211.11.0references/server.mdreferences/client.mdgeneration/generation-steps.mdVersion this skill by the Ktor minor line, like kotlin-toolchain: this default SKILL.md targets Ktor 3.5.x and
should keep immediate operational guidance here instead of becoming only a version index. If maintaining future docs,
create or update a minor-line snapshot such as Ktor 3.6.x; do not silently mix breaking or behavior-changing guidance
from a different minor line.
Ktor APIs move between minor releases. When exact syntax matters, inspect the project dependencies/build files first and prefer the docs for the project's installed Ktor version.
When working in a repository:
build.gradle.kts, settings.gradle.kts, gradle/libs.versions.toml, pom.xml,
module.yaml, or .main.kts annotations.references/server.md.references/client.md.Ktor artifacts use Maven group io.ktor. In Gradle examples, use one version source:
val ktorVersion = "3.5.1"
implementation("io.ktor:ktor-server-core:$ktorVersion")
implementation("io.ktor:ktor-client-core:$ktorVersion")
Common server dependencies:
ktor-server-corektor-server-cio, ktor-server-netty, ktor-server-jetty-jakarta, or ktor-server-tomcat-jakartaktor-server-content-negotiation + one of ktor-serialization-kotlinx-json, gson, jackson,
kotlinx-xml, kotlinx-cbor, kotlinx-protobufktor-server-auth, optional ktor-server-auth-jwt, ktor-server-auth-ldapktor-server-sessionsktor-server-test-hostktor-server-diCommon client dependencies:
ktor-client-corektor-client-cio, ktor-client-okhttp, ktor-client-apache5, ktor-client-java,
ktor-client-jetty-jakarta, ktor-client-android, ktor-client-darwin, ktor-client-curl, ktor-client-winhttp,
or ktor-client-jsktor-client-content-negotiation + one of the serialization artifacts abovektor-client-authktor-client-loggingktor-client-mockFor .main.kts, prefer JVM/platform leaf artifacts where needed, for example io.ktor:ktor-client-cio-jvm:3.5.1,
because script dependency resolution can miss Gradle module metadata for multiplatform root artifacts.
Load references/server.md before non-trivial server edits.
import io.ktor.http.*
import io.ktor.serialization.kotlinx.json.*
import io.ktor.server.application.*
import io.ktor.server.cio.*
import io.ktor.server.engine.*
import io.ktor.server.plugins.contentnegotiation.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
fun main() {
embeddedServer(CIO, port = 8080, host = "0.0.0.0") {
install(ContentNegotiation) { json() }
routing {
get("/health") { call.respondText("OK") }
get("/") { call.respond(mapOf("status" to "up")) }
}
}.start(wait = true)
}
Prefer route extension functions once routing grows:
fun Application.module() {
configureSerialization()
configureRouting()
}
fun Application.configureRouting() = routing {
route("/api") { get("/health") { call.respond(HttpStatusCode.OK) } }
}
Load references/client.md before non-trivial client edits.
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.engine.cio.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.client.request.*
import io.ktor.serialization.kotlinx.json.*
suspend fun main() {
val client = HttpClient(CIO) {
install(ContentNegotiation) { json() }
}
try {
val body: String = client.get("https://example.com").body()
println(body)
} finally {
client.close()
}
}
Use a singleton/DI-managed HttpClient in applications. Do not create and dispose a new client per request.
Ktor is plugin-oriented:
Application installs plugins and registers routes. The current request/response is an ApplicationCall.HttpClient installs plugins and makes suspending requests. The current response is an HttpResponse.install(PluginName) { ... }.ContentNegotiation and choose a serializer.authenticate { ... }; on the client it is request-scoped/provider-
selected through the Auth plugin.install(ContentNegotiation) needs ktor-server-content-negotiation or
ktor-client-content-negotiation plus serializer artifacts.io.ktor.server.*; client packages under io.ktor.client.*.DoubleReceive fails.@Serializable or the Kotlin serialization compiler plugin when using kotlinx.serialization.HttpClient per request leaks resources and defeats pooling.DigestAlgorithm, DigestQop, algorithm-aware digest provider) over
stringly legacy MD5-only examples.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
ktor, kotlin-http, server-framework, http-client, kotlin-multiplatform
npx claudepluginhub heapy/kortex --plugin kortex5 skills in this plugin
/jshellUse when running Java snippets in JShell or using JShell as a Java REPL or scratchpad./kotlin-toolchainUse when working with JetBrains Kotlin Toolchain v0.14.x, formerly Amper, including module.yaml, project.yaml, module templates, nested templates, libs.versions.toml, the kotlin CLI wrapper, `//` project paths, Kotlin/JVM, Android, iOS, Kotlin Multiplatform, Kotlin/JS, Kotlin/Wasm (wasm-js, wasm-wasi), Kotlin/Native, Apple platform support and deprecations, macOS/Xcode compatibility, ARM64 hosts and cross-compilation, GitHub Actions runners, server-side apps, dependencies, testing, SwiftPM dependencies, KMP library publishing, Maven Central, TestFlight, Android desugaring, download mirrors, build plugins, built-in technologies (Compose, Ktor, Spring Boot, serialization, kotlinx.rpc, DataFrame, Power Assert, KSP, Lombok), Maven and Gradle migration, JDK provisioning, and toolchain caches./main-ktsOther plugins' skills for the same job