Design, implement, review, and migrate XState v5 state machines and statecharts in TypeScript using modern v5 patterns. Use this whenever the user mentions XState, actors, state machines, statecharts, guards, transitions, workflows, or Stately, or is modeling non-trivial UI/app/process logic in a codebase that uses XState. Prefer a short machine sketch before code when requirements are fuzzy. If the problem is too simple for a state machine, say so and recommend @xstate/store instead.
91%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
The xstate-v5 skill teaches coding agents to design, implement, review, and
migrate XState v5 state machines and statecharts in TypeScript. It models the
problem first and checks API correctness second, and it recommends
@xstate/store when a machine is more than the problem needs.
npx skills add statelyai/skills --skill xstate-v5The stately plugin also includes this skill. See
Install for Claude Code and Codex.
Ask for XState work in a project that depends on xstate 5:
Model the checkout flow as an XState machine.Review this machine for missing error and cancellation paths.Migrate this XState v4 machine to v5.The skill picks a mode before writing code:
| Mode | Behavior |
|---|---|
| New code | Uses modern v5 patterns: setup(...), named implementations, typed actors. |
| Local edit | Keeps the surrounding structure and naming unless the code is broken or mixed. |
| Migration | Makes the smallest safe translation from v4 patterns to v5. |
When requirements are unclear, it sketches the states, events, context, and actors before writing TypeScript.
| Path | Contents |
|---|---|
SKILL.md | Workflow, modeling questions, and v5 code style |
references/advanced-patterns.md | Actor kinds, typed actions, emitted events, and persistence |
references/adapters.md | @xstate/react, @xstate/vue, @xstate/svelte, @xstate/solid |
references/examples.md | Example machines, React actors, and @xstate/store |
references/observables-and-inspection.md | Observables and the inspection API |
references/v4-to-v5-quick-ref.md | v4 to v5 migration table |
evals/ | Evaluation prompts and graders |
xstate 6