xstate

Design XState v5 state machines and actor patterns in TypeScript.

19|Updated Oct 21, 2025
One-click install
npx skills add https://github.com/justSteve/XState-Skill --skill xstate
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: xstate
Source: https://github.com/justSteve/XState-Skill/tree/main
Command: npx skills add https://github.com/justSteve/XState-Skill --skill xstate

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill provides guidance and patterns for designing and implementing XState v5 state machines and actor-based orchestration in JavaScript/TypeScript projects.

Core Features & Use Cases

  • Hands-on guidance for creating machines with createMachine, actors with createActor, and the setup() typing approach.
  • Type-safe patterns for TypeScript 5.0+ and actor types including promise, callback, observable, and transition.
  • Migration, integration examples, debugging patterns, and Inspect API usage across React, Vue, Svelte, and backend contexts.

Quick Start

Ask Claude Code to generate a minimal XState v5 machine and actor setup to start experimenting.

Frequently Asked Questions about xstate

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up an XState v5 state machine using TypeScript?

To set up an XState v5 state machine in TypeScript, use the setup() API to define type-safe patterns and createMachine to establish hierarchical and parallel states. It requires TypeScript 5.0 or higher to enforce proper v5 API typing.

What are the different actor types supported in XState v5?

XState v5 supports four primary actor types for orchestration: promise, callback, observable, and transition. These actors are created using the createActor function and can be applied across React, Vue, Svelte, and backend contexts.

Can I integrate XState v5 machines with React, Vue, or Svelte?

Yes, XState v5 machines integrate with React, Vue, and Svelte. The skill provides specific integration examples and debugging patterns for these frontend frameworks, as well as backend contexts, using the actor-based model.

How do I debug XState v5 state machines and actors?

Debug XState v5 state machines and actors by utilizing the Inspect API. The skill provides specific debugging patterns, cheatsheets, and references to help identify and resolve issues in your actor-based orchestration logic.

Why should I use the setup() API for XState v5 instead of older patterns?

The setup() API in XState v5 enforces type-safe patterns for TypeScript 5.0+ environments, replacing older patterns. It is the recommended approach for defining robust state machines and actor-based orchestration with proper type enforcement.

What is the actor model in XState v5 and when do I need it?

The actor model in XState v5 is a design pattern for orchestrating complex logic through independent actors. You need it when managing hierarchical and parallel states, or coordinating asynchronous tasks across frontend and backend contexts.