xstate
Installation
SKILL.md
XState
Overview
XState models application logic as state machines. Instead of managing boolean flags (isLoading, isError, isSuccess), you define states and transitions explicitly — making impossible states impossible. Ideal for complex flows: checkout, onboarding, authentication, multi-step forms.
Instructions
Step 1: Define a Machine
// machines/authMachine.ts — Authentication state machine
import { setup, assign, fromPromise } from 'xstate'
export const authMachine = setup({
types: {
context: {} as {
user: { id: string; name: string; email: string } | null
error: string | null
Related skills