What problem does it solve?
effect-machine Skill helps you model complex workflows as typed state machines (states, events, and transitions) and then run them safely as Effect-powered actors, avoiding scattered callback logic and “one status field” pitfalls.
Core Features & Use Cases
- Schema-first modeling: define
State and Event schemas, then build transitions in a type-safe way.
- Deterministic transition wiring: use
.on(...) for normal transitions, .onAny(...) for wildcard fallbacks, and .reenter(...) when you must re-run lifecycle even if the state tag doesn’t change.
- Stateful async behavior: attach state-scoped work via
.spawn(...), run machine-lifetime work via .background(...), and schedule timeouts/postponed events with .timeout(...) and .postpone(...).
- Typed replies and coordination: use
actor.call(...) for transition receipts and actor.ask(...) for typed Event.reply(...) replies.
Quick Start
Build a checkout-style machine by defining State, Event, and Slot schemas, wiring transitions with .on(...), marking terminal states with .final(...), and then running it via Machine.spawn(...) followed by actor.start.