Claude-skill-registry kotlin-ktor

Ktor framework - routing, authentication, WebSockets

install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/kotlin-ktor" ~/.claude/skills/majiayu000-claude-skill-registry-kotlin-ktor && rm -rf "$T"
manifest: skills/data/kotlin-ktor/SKILL.md
source content

Kotlin Ktor Skill

Build production-ready backends with Ktor.

Topics Covered

Routing

fun Application.module() {
    install(ContentNegotiation) { json() }
    routing {
        route("/api/v1") {
            get("/users") { call.respond(userService.findAll()) }
            get("/users/{id}") {
                val id = call.parameters["id"]?.toLongOrNull()
                    ?: throw BadRequestException("Invalid ID")
                call.respond(userService.findById(id) ?: throw NotFoundException())
            }
        }
    }
}

JWT Authentication

install(Authentication) {
    jwt("auth") {
        verifier(JWT.require(Algorithm.HMAC256(secret)).build())
        validate { credential ->
            if (credential.payload.getClaim("userId").asString().isNotEmpty())
                UserPrincipal(credential.payload)
            else null
        }
    }
}

authenticate("auth") { userRoutes() }

Testing

@Test
fun `GET users returns list`() = testApplication {
    application { module() }
    client.get("/api/v1/users").apply {
        assertThat(status).isEqualTo(HttpStatusCode.OK)
    }
}

Troubleshooting

IssueResolution
404 for valid routeOrder specific routes before wildcards
JSON not parsedInstall ContentNegotiation plugin

Usage

Skill("kotlin-ktor")