en un clic
states
// Design the $machine section — map happy paths, error paths, and all state types into a complete behavioral skeleton
// Design the $machine section — map happy paths, error paths, and all state types into a complete behavioral skeleton
Add purposeful motion to a UXSpec — $animations, onEnter choreography, and timing tokens
Improve every piece of text in a UXSpec — descriptions, labels, error messages, empty states, and loading copy
Identify repeated patterns and consolidate them into $elements and shared tokens for systematic reuse
Collect design context, audience, intent, and requirements before writing any UXSpec JSON
Strengthen a UXSpec against real-world conditions — overflow, missing data, network failures, and accessibility
Run a systematic quality audit on a completed UXSpec — design intent, consistency, accessibility, and state coverage
| name | states |
| description | Design the $machine section — map happy paths, error paths, and all state types into a complete behavioral skeleton |
Design the $machine — the behavioral skeleton of a UXSpec. Every state is a promise to the user about what they can do and what they'll see.
When building or revising the $machine section. Also useful for auditing an existing spec's state coverage.
Start with the ideal flow: entry → action → outcome. Define compound states (parents) and leaf states (children). Every compound state needs an initial child.
idle --SUBMIT--> loading
loading --HTTP_OK--> success
For every transition, ask: what else could happen?
Each failure needs a state (or at least a handled transition) — not just an afterthought.
A complete machine accounts for:
For each state, ask: is this truly necessary?
entry/exit actions (set loading flags, clear errors, reset forms)invoke for long-running effects (HTTP calls, timers, polling)always transitions with guards for automatic routing (e.g., redirect if already authenticated)Present the state graph as text before writing JSON:
idle --SUBMIT--> loading
loading --HTTP_OK--> success
loading --HTTP_ERROR--> error
error --RETRY--> loading
success --RESET--> idle
A state machine is a contract: "in this state, these things are true and these things are possible." If a state doesn't change what the user sees or can do, it doesn't belong.