kotlin-ktor-patterns

kotlin-ktor-patterns is a skill for Claude Code, Codex from ronmkr/PromptBook. It costs 34 tokens per session (4,028 once invoked), scanned A, a copy of kotlin-ktor-patterns, Apache-2.0.

A guide to building Ktor web servers in Kotlin, including HTTP routes, authentication, dependency injection, JSON handling, WebSockets, and application tests.

In plain words
What is it for?
Use it when creating REST APIs or WebSocket services with Ktor, configuring authentication or plugins, organizing routes, or writing integration tests.
Why use it?
It helps keep server setup, request handling, business services, and error handling separated and easier to maintain. It also covers testing server behavior without relying on a live deployment.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when creating REST APIs or WebSocket services with Ktor, configuring authentication or plugins, organizing routes, or writing integration tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ronmkr/promptbook/kotlin-ktor-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ronmkr/PromptBook --skill kotlin-ktor-patterns
Clone the repo
git clone --depth 1 https://github.com/ronmkr/PromptBook

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for kotlin-ktor-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/ronmkr/promptbook/kotlin-ktor-patterns/github.svg)](https://agentmods.dev/skills/ronmkr/promptbook/kotlin-ktor-patterns)
Your own site
<a href="https://agentmods.dev/skills/ronmkr/promptbook/kotlin-ktor-patterns"><img src="https://agentmods.dev/badge/skills/ronmkr/promptbook/kotlin-ktor-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for kotlin-ktor-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/ronmkr/promptbook/kotlin-ktor-patterns"><img src="https://agentmods.dev/badge/skills/ronmkr/promptbook/kotlin-ktor-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,028 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 91% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00034 $0.04028
Opus 5.5 $0.00014 $0.01611
Sonnet 5.5 $0.00007 $0.00806
Haiku 4.5 $0.00003 $0.00403

Measured 3mo ago against content hash 5f8ac5d3a01f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

kotlin-ktor-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

91% identical to kotlin-ktor-patterns — 2 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/patterns/kotlin-ktor-patterns/SKILL.md · 690 lines

How it starts

The opening of the file, as written. The whole thing — 690 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Ktor Server Patterns

Comprehensive Ktor patterns for building robust, maintainable HTTP servers with Kotlin coroutines.

When to Activate

  • Building Ktor HTTP servers
  • Configuring Ktor plugins (Auth, CORS, ContentNegotiation, StatusPages)
  • Implementing REST APIs with Ktor
  • Setting up dependency injection with Koin
  • Writing Ktor integration tests with testApplication
  • Working with WebSockets in Ktor

Application Structure

Standard Ktor Project Layout

src/main/kotlin/
├── com/example/
│   ├── Application.kt           # Entry point, module configuration
│   ├── plugins/
│   │   ├── Routing.kt           # Route definitions
│   │   ├── Serialization.kt     # Content negotiation setup
│   │   ├── Authentication.kt    # Auth configuration
│   │   ├── StatusPages.kt       # Error handling
│   │   └── CORS.kt              # CORS configuration
│   ├── routes/
│   │   ├── UserRoutes.kt        # /users endpoints
│   │   ├── AuthRoutes.kt        # /auth endpoints
│   │   └── HealthRoutes.kt      # /health endpoints
│   ├── models/
│   │   ├── User.kt              # Domain models
│   │   └── ApiResponse.kt       # Response envelopes
│   ├── services/
│   │   ├── UserService.kt       # Business logic
│   │   └── AuthService.kt       # Auth logic
│   ├── repositories/
│   │   ├── UserRepository.kt    # Data access interface
│   │   └── ExposedUserRepository.kt
│   └── di/
│       └── AppModule.kt         # Koin modules
src/test/kotlin/
├── com/example/
│   ├── routes/
│   │   └── UserRoutesTest.kt
│   └── services/
│       └── UserServiceTest.kt

Application Entry Point

// Application.kt
fun main() {
    embeddedServer(Netty, port = 8080, module = Application::module).start(wait = true)
}

fun Application.module() {
    configureSerialization()
    configureAuthentication()
    configureStatusPages()
    configureCORS()
    configureDI()
    configureRouting()
}

Routing DSL

Basic Routes

// plugins/Routing.kt
fun Application.configureRouting() {
    routing {
        userRoutes()
        authRoutes()
        healthRoutes()
    }
}

// routes/UserRoutes.kt
fun Route.userRoutes() {
    val userService by inject<UserService>()

    route("/users") {
        get {
            val users = userService.getAll()
            call.respond(users)
        }

        get("/{id}") {
            val id = call.parameters["id"]
                ?: return@get call.respond(HttpStatusCode.BadRequest, "Missing id")
            val user = userService.getById(id)
                ?: return@get call.respond(HttpStatusCode.NotFound)
            call.respond(user)
        }

        post {
            val request = call.receive<CreateUserRequest>()
            val user = userService.create(request)
            call.respond(HttpStatusCode.Created, user)
        }

        put("/{id}") {
            val id = call.parameters["id"]
                ?: return@put call.respond(HttpStatusCode.BadRequest, "Missing id")
            val request = call.receive<UpdateUserRequest>()
            val user = userService.update(id, request)
                ?: return@put call.respond(HttpStatusCode.NotFound)
            call.respond(user)
        }

        delete("/{id}") {
            val id = call.parameters["id"]
                ?: return@delete call.respond(HttpStatusCode.BadRequest, "Missing id")
            val deleted = userService.delete(id)
            if (deleted) call.respond(HttpStatusCode.NoContent)
            else call.respond(HttpStatusCode.NotFound)
        }
    }
}

Read the full file on GitHub · 690 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 690 lines · 34 tokens per session scan A 5f8ac5d3a01f

Subscribe to this mod's changes

kotlin-ktor-patterns is a skill published in the GitHub repository ronmkr/PromptBook (2 stars, last pushed 6mo ago), licensed Apache-2.0. It adds 34 tokens to every session and 4,028 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 91% identical to kotlin-ktor-patterns, differing in 2 lines, and is treated as a copy.

Related

kotlin-ktor-patterns compared with skills from other repositories

kotlin-ktor-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
kotlin-ktor-patternsronmkr/PromptBookSkill26mo agoApache-2.0A34Claude Code, Codex
bun-file-iosynthetic-sciences/openscienceSkill4.5ktodayApache-2.0A49Claude Code, Codex
protocolsio-integrationsynthetic-sciences/openscienceSkill4.5ktodayApache-2.0B85Claude Code, Codex
opensrcvercel-labs/opensrcSkill3.0k2mo agoApache-2.0A103Claude Code
arkcli-infer-endpointvolcengine/ark-cliSkill157todayApache-2.0A443Claude Code, Codex
arkcli-api-explorervolcengine/ark-cliSkill157todayApache-2.0A42Claude Code, Codex
knowledge-shared-api-and-runtime-schemasechoVic/blade-codeSkill18117d agoMITA149Claude Code, Codex