kotlin-exposed-patterns

Implement Kotlin database access with JetBrains Exposed DSL, DAO, and coroutine-safe transactions.

1|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/xxih/ai-harness-zh --skill kotlin-exposed-patterns-xxih
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-exposed-patterns
Source: https://github.com/xxih/ai-harness-zh/tree/main/references/translations/everything-claude-code/docs/zh-CN/skills/kotlin-exposed-patterns
Command: npx skills add https://github.com/xxih/ai-harness-zh --skill kotlin-exposed-patterns-xxih

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a concise, production-oriented reference to implement reliable database access in Kotlin applications using JetBrains Exposed, reducing time spent designing repetitive persistence code and integration glue.

Core Features & Use Cases

  • DSL and DAO patterns: Examples and guidelines for when to use Exposed DSL queries versus DAO entity management.
  • Connection pooling and migrations: HikariCP configuration and Flyway migration integration for production deployments.
  • Coroutine-safe transactions and testing: Use of newSuspendedTransaction for coroutine safety, repository abstractions for testability, and H2 in-memory testing patterns.
  • Advanced data types: Handling JSONB columns with kotlinx.serialization and mapping complex joins, pagination, aggregation, and upserts.

Quick Start

Initialize HikariCP and run Flyway migrations, then implement a UserRepository using newSuspendedTransaction to perform coroutine-safe CRUD operations.

Frequently Asked Questions about kotlin-exposed-patterns

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

FAQPage Schema
How do I use Kotlin Exposed with coroutines for database transactions?

Configure HikariCP connection pooling by initializing it alongside Flyway migrations before executing Kotlin Exposed queries. This setup manages database connections efficiently and applies schema migrations for production-ready deployments.

How do I handle JSONB columns in Kotlin Exposed?

Handle JSONB columns in Kotlin Exposed by integrating kotlinx.serialization to serialize and deserialize complex data types. This allows you to map and store structured JSON data directly within your database entities.

What is the best way to structure Kotlin Exposed repository patterns for testing?

Abstract database access behind repository interfaces to improve testability for Kotlin Exposed operations. You can then substitute H2 in-memory databases during testing to validate CRUD queries and pagination without touching production data.

Can I perform complex joins and pagination using Kotlin Exposed DSL?

Kotlin Exposed DSL supports mapping complex joins, pagination, aggregation, and upsert operations. You can chain DSL query functions to build advanced data retrieval logic and map the results directly to your data classes.