Skip to content
Back to skills

Kotlin Ktor Patterns

ASecurity

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\".

  • 2 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 19, 2026
ai-agentsgokotlinspringtestingapi

Works with

  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned September 19, 2026

npx -y skills add majinmagros/magros.ai-skills --skill kotlin-ktor-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Kotlin Ktor Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Kotlin Ktor Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majinmagros-kotlin-ktor-patterns/badge)](https://www.skillsdirectory.com/skills/majinmagros-kotlin-ktor-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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ências

Files in this skill

  • SKILL.md2.2 KB
  • references/auth-errors.md4 KB
  • references/config.md855 B
  • references/cors-koin.md2.7 KB
  • references/serialization.md1.6 KB
  • references/structure-routing.md3.8 KB
  • references/websockets-testing.md4.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.