kp-channels
Installation
SKILL.md
One-line summary
A Channel<T> is a coroutine-safe queue used for message-passing between coroutines — the building block for pipelines, fan-out / fan-in, and any coordination that can't be expressed with Flow or shared state alone.
When to use this skill
- Multiple producer coroutines or multiple consumer coroutines that need to coordinate on a stream of values.
- Building a pipeline: stage A produces; stage B transforms; stage C writes. Each stage is its own coroutine connected by channels.
- Fan-out: one producer, many workers (load distribution).
- Fan-in: many producers, one consumer (collecting results).
- When
Flowis too constrained —Flowis single-collector-cold;Channellets multiple coroutines compete for elements.
When NOT to use this skill
- A single producer and a single consumer with no buffering needs → just use a
Flow(cold) orsuspend fun. - Sharing observable state with multiple subscribers →
StateFlow/SharedFlow(seekp-flow-cold-vs-hot). - Pure transformations on a stream →
Flowoperators (seekp-flow-operators). - Coordination between threads in non-coroutine code → use a
java.util.concurrentqueue.