xstate-generator

Generate XState v5 state machines with setup() factories from user requirements.

Updated Dec 17, 2025
One-click install
npx skills add https://github.com/Lrmdom/patrimonio-pwa --skill xstate-generator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: xstate-generator
Source: https://github.com/Lrmdom/patrimonio-pwa/tree/main/.windsurf/skills/xstate-generator
Command: npx skills add https://github.com/Lrmdom/patrimonio-pwa --skill xstate-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires xstate, and includes scripts (resource) and references (resource) components.

What problem does it solve?

XState v5 state machines often require a structured approach to modeling complex workflows, including actors, guards, and actions. This skill provides generation, explanation, and debugging capabilities for state machines based on user requirements.

Core Features & Use Cases

  • Generate, explain, and modify XState v5 state machines using a setup() factory pattern.
  • Provide code templates, context, events, guards, actions, and actors for production-ready machines.
  • Use cases include modeling complex workflows, visualizing machine structure, and validating designs against requirements.

Quick Start

Provide a user requirement describing your stateful workflow, and this skill will generate a complete XState v5 machine setup ready for implementation.

Frequently Asked Questions about xstate-generator

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

FAQPage Schema
How do I generate XState v5 state machines from requirements?

To generate XState v5 state machines, provide a user requirement describing your stateful workflow, and the skill outputs ready-to-run machine code in TypeScript using the setup() factory pattern. It includes context, events, guards, actions, and actors for production-ready implementation.

What is the setup() factory pattern in XState v5?

The setup() factory pattern in XState v5 is a structured approach for modeling complex workflows with statecharts and actors. It provides code templates that define context, events, guards, actions, and actors for production-ready state machines.

Does this skill support debugging and visualizing statecharts?

Yes, this skill supports debugging and visualizing statecharts during design and implementation. It explains and modifies XState v5 machines, enabling you to validate machine structure against your requirements.

Can I model complex workflows with actors in XState v5?

You can model complex workflows with actors in XState v5 by using this skill to generate statecharts that include actors, guards, and actions. It outputs TypeScript code templates ready for implementation.

What's the best way to structure context and events in XState v5?

The best way to structure context and events in XState v5 is using the setup() factory pattern, which provides a structured approach to include them alongside guards, actions, and actors for production-ready state machines.