KO

kotlin-ktor

Provides standardized patterns for Ktor routing, logging, error handling, and dependency injection.

Install

mkdir -p .claude/skills/kotlin-ktor && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10749" && unzip -o skill.zip -d .claude/skills/kotlin-ktor && rm skill.zip

Installs to .claude/skills/kotlin-ktor

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Ktor-applikasjoner i Kotlin — routes, plugins, Koin DI, JWT-claims som NAVident, CallLogging/MDC, StatusPages/ApiError, paginering og input-validering. Brukes via /kotlin-ktor ved Ktor-arbeid.
192 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Implement JWT authentication with NAVident claims
  • Configure Koin for dependency injection
  • Set up structured call logging with MDC
  • Handle API errors using StatusPages and ApiError hierarchy
  • Implement pagination with a standard wrapper
  • Validate input parameters in routes

How it works

The skill provides code examples and guidelines for implementing standard practices in Ktor applications, including authentication, dependency injection, logging, and error handling.

Inputs & outputs

You give it
Ktor application code, authentication details, logging requirements
You get back
Ktor application with implemented authentication, logging, error handling, pagination, and validation

When to use kotlin-ktor

  • Configuring Ktor authentication
  • Setting up DI with Koin
  • Standardizing error responses

About this skill

Ktor — Nav-spesifikt

Autentisering

authenticate("azureAd") {
    get("/api/protected") {
        val principal = call.principal<JWTPrincipal>()
        val navIdent = principal?.getClaim("NAVident", String::class)
    }
}

Avhengighetsinjeksjon

Koin er standard DI-rammeverk for Ktor-repoer i teamet (hvis io.insert-koin finnes i avhengighetene).

Logging

install(CallLogging) {
    mdc("x_request_id") { call.request.header("X-Request-Id") ?: UUID.randomUUID().toString() }
}

Feilhåndtering — StatusPages + ApiError

Team-standard mønster for strukturerte feilresponser: sealed ApiErrorException-hierarki + StatusPages-plugin som mapper til en enhetlig ApiError-payload. Se references/error-handling.md for full implementasjon (ErrorType-enum, ApiErrorException-klasser, installStatusPages(), determineApiError()).

Paginering og input-validering

Team-standard PaginatedResponse<T>-wrapper og route-validering med tidlig-retur på ugyldige parametre. Se references/paginering-og-validering.md.

Graceful shutdown

embeddedServer { ... }.start(wait = true) håndterer SIGTERM via shutdown-hook automatisk i Ktor. Trenger ikke manuell readiness-toggling i applikasjonen. Plattformkonteksten er felles — se nais-manifest-skillen for hvordan NAIS preStop-hook fungerer. Anti-mønstre: manuell readiness=false og lav terminationGracePeriodSeconds.

When not to use it

  • When working with non-Ktor Kotlin applications
  • When not using Koin for dependency injection

Limitations

  • Focuses on Nav-specific Ktor practices
  • Assumes Koin as the standard DI framework if present
  • Graceful shutdown is handled automatically by Ktor

How it compares

This skill offers specific, standardized implementations for common Ktor features, which differs from building these components from scratch or using varied approaches.

Compared to similar skills

kotlin-ktor side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
kotlin-ktor (this skill)03moNo flagsIntermediate
android-kotlin-development2685moReviewAdvanced
nostr-expert32moReviewAdvanced
mqtt-kmp03moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

android-kotlin-development

aj-geddes

Develop native Android apps with Kotlin. Covers MVVM with Jetpack, Compose for modern UI, Retrofit for API calls, Room for local storage, and navigation architecture.

268679

nostr-expert

vitorpamplona

Nostr protocol implementation patterns in Quartz (AmethystMultiplatform's KMP Nostr library). Use when working with: (1) Nostr events (creating, parsing, signing), (2) Event kinds and tags, (3) NIP implementations (57 NIPs in quartz/), (4) Event builders and TagArrayBuilder DSL, (5) Nostr cryptography (secp256k1, NIP-44 encryption), (6) Relay communication patterns, (7) Bech32 encoding (npub, nsec, note, nevent). Complements nostr-protocol agent (NIP specs) - this skill provides Quartz codebase patterns and implementation details.

323

mqtt-kmp

meshtastic

MQTTastic Client KMP — Kotlin Multiplatform MQTT 5.0 client library project knowledge

00

vertigram-telegram-api-bump

gagarski

Update Vertigram's vertigram-telegram-client module for a requested Telegram Bot API version. Use when the user asks to bump supported Telegram Bot API versions, apply Telegram Bot API changelog entries, add Telegram API types/methods/json body definitions, update Telegram markup builders, or add se

00

kafka

navikt

Rapids & Rivers, eventdrevet arkitektur, Kafka-mønstre og schema-design for Nav-applikasjoner

00

kotlin-multiplatform

vitorpamplona

Platform abstraction decision-making for Amethyst KMP project. Guides when to abstract vs keep platform-specific, source set placement (commonMain, jvmAndroid, platform-specific), expect/actual patterns. Covers primary targets (Android, JVM/Desktop, iOS) with web/wasm future considerations. Integrates with gradle-expert for dependency issues. Triggers on: abstraction decisions ("should I share this?"), source set placement questions, expect/actual creation, build.gradle.kts work, incorrect placement detection, KMP dependency suggestions.

32156

Search skills

Search the agent skills registry