workflow-engine-design
Installation
SKILL.md
Workflow Engine Design
Build the engine layer — not individual idempotent operations (see idempotent-financial-workflows), but the runtime that sequences them durably.
Orchestration vs Choreography
- Orchestration: central coordinator holds explicit state; easier to observe, debug, and audit. Use for multi-step money flows and compliance-sensitive sequences.
- Choreography: services react to events on a shared bus; decoupled, harder to trace. Use for loose fan-out notifications.
- Hybrid: orchestrator per bounded context, events between contexts.
State Machine Design
- Name every state and every valid transition before writing code.
- Store state durably before executing side effects — never derive current state from side-effect logs.
- Terminal states:
completed,failed,cancelled,compensated. - Persist the full input/output of each step; a replay must reproduce the same decisions without re-running external calls.