xstate-actors-and-invocation

Explain XState v5 actor types and invoke versus spawn lifecycles.

Updated Feb 12, 2026
One-click install
npx skills add https://github.com/IlyaGulya/claude-marketplace --skill xstate-actors-and-invocation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: xstate-actors-and-invocation
Source: https://github.com/IlyaGulya/claude-marketplace/tree/main/plugins/xstate/skills/xstate-actors-and-invocation
Command: npx skills add https://github.com/IlyaGulya/claude-marketplace --skill xstate-actors-and-invocation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers understand and implement XState's actor model, covering invocation, spawning, and inter-actor communication for building complex, stateful applications.

Core Features & Use Cases

  • Actor Types: Differentiates between fromPromise, fromCallback, fromObservable, and fromTransition actors.
  • Invoke vs. Spawn: Clarifies when to use invoke (state-bound lifecycle) versus spawn (action-based lifecycle).
  • Communication Patterns: Details how actors can communicate with each other and their parent using sendTo, input, and systemId.
  • Use Case: You're building a complex UI with multiple independent but interacting components. This Skill guides you on how to manage their lifecycles and data flow effectively using XState actors.

Quick Start

Explain the difference between invoking an actor when entering a state and spawning an actor dynamically.

Frequently Asked Questions about xstate-actors-and-invocation

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

FAQPage Schema
What is the difference between invoke and spawn in XState actors?

In XState, invoke binds an actor's lifecycle to a specific state, automatically stopping it upon exit, while spawn creates dynamically managed actors within actions that persist independently until explicitly stopped.

How do I use fromPromise and fromCallback actors in XState v5?

XState v5 provides fromPromise for asynchronous operations and fromCallback for handling external event subscriptions, allowing finite state machines to integrate with various asynchronous patterns effectively.

How does parent-child communication work with spawned XState actors?

Parent-child communication in XState uses sendTo for targeted messaging, input parameters for initialization, and systemId for system-level actor addressing to manage data flow between independent components.

When should I use fromObservable versus fromTransition actors in XState?

Use fromObservable actors to handle streaming data sources in XState, and use fromTransition actors when you need to reduce events into an updated state value without defining full finite state machine nodes.

How do I manage the lifecycle of a spawned XState actor?

Manage spawned XState actor lifecycles by storing actor references in context, stopping them explicitly via actions, and handling their output to ensure independent components are properly cleaned up.