What problem does it solve?
Orders represented as scattered flags and frontend-driven events lead to missed gates, duplicate work, and poor auditability; this Skill defines clear state machines and operational rules to prevent those failures and make order behavior predictable and debuggable.
Core Features & Use Cases
- Explicit state modeling: Encourage a finite state enum with documented allowed transitions and durable history to avoid overlapping booleans and ambiguous status.
- Separation of concerns: Keep payment, generation, approval, and fulfillment logic independent so one subsystem cannot silently bypass another.
- Idempotency and replay safety: Use idempotency keys and event IDs to make retries and duplicate webhooks no-ops when appropriate.
- Observability and testing: Log transitions with causation metadata and test every allowed and disallowed transition, including concurrent and duplicate event scenarios.
- Use Case: Apply these patterns to Figurio's custom figurine flow to ensure deposit and balance gates, generation previews, explicit approval steps, and safe production release.
Quick Start
Configure the backend order state machine to require validated transitions, record actor and event metadata on every change, and enforce distinct payment and approval gates before production release.