dual-mode-persist-blocking-or-async
Installation
SKILL.md
One save body, two execution modes
Persistence has two callers with opposite requirements. The periodic one runs while everything is alive and must not block anything. The teardown one runs while the object is being released — the scope it would launch into is about to be cancelled, so a fire-and-forget write is simply lost.
Write the body once and let the caller choose how it runs:
// interface
fun mayBeSaveState(runBlocking: Boolean = false)