kmp-api-services

Designs Kotlin Multiplatform API services with Ktor and strict DTO boundaries.

1|Updated Nov 26, 2025
One-click install
npx skills add https://github.com/niltsiar/kotlin_multiplatform_pokedex --skill kmp-api-services
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kmp-api-services
Source: https://github.com/niltsiar/kotlin_multiplatform_pokedex/tree/main/.agents/kmp-api-services
Command: npx skills add https://github.com/niltsiar/kotlin_multiplatform_pokedex --skill kmp-api-services

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

API service patterns for Kotlin Multiplatform using Ktor to keep remote APIs structured, testable, and decoupled from domain models.

Core Features & Use Cases

  • API service boundaries: API services return raw DTOs for network calls; repositories handle mapping and error handling.
  • DTO design & serialization: Use @Serializable with @SerialName for request/response DTOs and provide asDomain() mappings.
  • Ktor client configuration: Centralized setup for JSON serialization, timeouts, and logging, with DI integration.
  • Use Cases: Create feature modules that define API contracts and map them into domain models for repositories.

Quick Start

Create a new API service using Ktor, define DTOs for requests/responses, and wire it into the repository.

Frequently Asked Questions about kmp-api-services

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure Ktor API services in Kotlin Multiplatform to keep remote data decoupled?

Structure Ktor API services by enforcing strict DTO boundaries where API services return raw DTOs for network calls, while repositories handle domain mapping and error handling to keep the remote data layer decoupled and testable.

What is the best way to map JSON responses to domain models in a KMP project?

The best way to map JSON responses is using @Serializable DTOs with @SerialName for request and response payloads, then providing asDomain() mapping functions to convert the DTOs into domain models within the repository layer.

How do I centralize Ktor client configuration for JSON serialization and timeouts across KMP modules?

Centralize Ktor client configuration by setting up JSON serialization, timeouts, and logging in a single location, integrating it with dependency injection to apply consistent HTTP client behavior across KMP feature modules.

Do I need dependency injection to use centralized HTTP client setup in Kotlin Multiplatform?

Dependency injection is used to integrate the centralized HTTP client configuration, ensuring that JSON serialization, timeouts, and logging setups are consistently provided and wired into KMP API service modules.

Why does my Ktor API service return raw DTOs instead of domain models directly?

Ktor API services return raw DTOs instead of domain models to maintain strict boundaries, ensuring the remote data layer remains testable and decoupled from domain logic while repositories handle the actual mapping.