coroutine

Installation
SKILL.md

Coroutine best practices

Overview

This document defines rules for using Kotlin coroutines safely and effectively in this project. All coroutine utilities are provided by the CoroutineUtils in the common module.

Key Principle: Always use the project's CoroutineUtils for coroutine operations. Never use raw runBlocking, async, or launch directly. MDC context is lost without the MDC-preserving wrappers.

MDC context propagation (required)

IMPORTANT: Always use MDC-preserving coroutine functions from io.glory.common.utils.coroutine. Raw coroutine builders lose MDC context, which breaks request tracing and logging.

Available functions

Function Purpose Returns
runBlockingWithMDC Bridge blocking code to coroutines with MDC T (blocking)
asyncWithMDC Launch concurrent coroutine with MDC Deferred<T>
launchWithMDC Launch fire-and-forget coroutine with MDC Job
Installs
1
First Seen
Apr 10, 2026