CLOSED LOADING ERROR SUCCESS
v1.3.0 — Available Now

No more impossible states

Model UI components as finite state machines before writing code. Compatible with Claude Code, Cursor, Windsurf, and OpenCode.

Quick install
$ npx skills add pauloriveross/state-machine-skill
Claude Code Cursor Windsurf OpenCode
From chaos to clarity

Three booleans create eight states.
Most of them are bugs.

The Boolean Mess

// 3 booleans = 8 possible states, 5 invalid
const [isLoading, setLoading] = useState(false);
const [isError, setError] = useState(false);
const [data, setData] = useState(null);

if (isLoading && isError) {
  // ❌ Impossible: both loading and error
}
if (isLoading && data) {
  // ❌ Impossible: loading with data
}
if (!isLoading && !isError && !data) {
  // Idle — but is it really?
}

The State Machine Way

// 4 states, all valid
type State = 'Idle' | 'Loading' | 'Success' | 'Error';
const [state, setState] = useState<State>('Idle');

// Impossible states structurally eliminated
switch (state) {
  case 'Idle':     return <Empty />;
  case 'Loading':  return <Spinner />;
  case 'Success':  return <Content />;
  case 'Error':    return <ErrorView />;
}
Two verbs + auto-implement

Model. Audit.

[→]

Model

From natural language to a formal FSM: named states, guarded transitions, actions, and invariants. 38 validation gates catch every mistake before code is written.

$ state-machine model "a modal with..."
{>}

Implement

Auto-prompted after every model. The agent scans your project folders, confirms the target directory with you, and generates code + tests wired to createLightMachine.

// No separate command — the agent asks you
||=

Audit

Reverse-engineer existing code into a model, detect boolean explosions, identify unhandled transitions, and produce a severity-ranked punch list.

$ state-machine audit ./src/Modal.tsx
See it in action

Describe. Model. Generate.

state-machine — bash
$
Analyzing description...
✓ 6 states identified
✓ 9 transitions mapped
✓ 3 guards defined
✓ 5 actions extracted
Output: model.json
┌────────┐ TRIGGER ┌──────────┐ <done> ┌──────────┐
│ Closed │────────>│ Opening │───────>│ Loading │
└────────┘ └──────────┘ └────┬─────┘
                                   ├────FETCH_SUCCESS→ Success
                                   └────FETCH_ERROR→ Error
✅ Model ready. Ask user: implement now?
Works everywhere

Compatible with every major AI agent

Claude Code
Cursor
Windsurf
OpenCode