Back to skills
SKILL.md
Kotlin Ktor Patterns
ASecurityUse when ktor server patterns including routing DSL, plugins, authentication, Koin DI, kotlinx.serialization, WebSockets, and testApplication testing. Only for Kotlin/Ktor — not for other frameworks. Triggers on \"kotlin-ktor-patterns\", \"kotlin ktor patterns\", \"patterns\".
- 2 stars
- 0 votes
- 0 copies
- 3 views
- Added September 19, 2026
Works with
Security analysis
100/100Pro scans all 7 files and shows the line behind each finding
npx -y skills add majinmagros/magros.ai-skills --skill kotlin-ktor-patterns --agent claude-codeAre you the author of Kotlin Ktor Patterns?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/majinmagros-kotlin-ktor-patterns)---
name: kotlin-ktor-patterns
description: "Use when ktor server patterns including routing DSL, plugins, authentication, Koin DI, kotlinx.serialization, WebSockets, and testApplication testing. Only for Kotlin/Ktor — not for other frameworks. Triggers on \"kotlin-ktor-patterns\", \"kotlin ktor patterns\", \"patterns\"."
metadata:
origin: ECC
---
# 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
## When NOT to Use
- Other frameworks (use `kotlin-ktor-patterns` only for Ktor; Spring Boot → `springboot-patterns`)
- Kotlin idioms in general (use `kotlin-patterns`)
- Kotlin testing in general (use `kotlin-testing`)
## Contents
| Topic | Reference |
|---|---|
| Project layout, entry point, routing | `references/structure-routing.md` |
| Serialization (kotlinx.serialization) | `references/serialization.md` |
| JWT auth, auth routes, StatusPages | `references/auth-errors.md` |
| CORS, Koin DI, validation | `references/cors-koin.md` |
| WebSockets, testApplication | `references/websockets-testing.md` |
| application.yaml config | `references/config.md` |
## Example
```kotlin
// Thin route → service (idiomatic Ktor)
routing {
authenticate("auth-jwt") {
get("/orders") {
call.respond(orderService.listRecent())
}
}
}
```
## Quick Reference: Ktor Patterns
| Pattern | Description |
|---------|-------------|
| `route("/path") { get { } }` | Route grouping with DSL |
| `call.receive<T>()` | Deserialize request body |
| `call.respond(status, body)` | Send response with status |
| `call.parameters["id"]` | Read path parameters |
| `call.request.queryParameters["q"]` | Read query parameters |
| `install(Plugin) { }` | Install and configure plugin |
| `authenticate("name") { }` | Protect routes with auth |
| `by inject<T>()` | Koin dependency injection |
| `testApplication { }` | Integration testing |
## ReferênciasFiles in this skill
- SKILL.md
- references/auth-errors.md
- references/config.md
- references/cors-koin.md
- references/serialization.md
- references/structure-routing.md
- references/websockets-testing.md
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.