xstate-persistence

Persist and restore XState v5 actor snapshots to storage.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses the challenge of preserving the state of XState actors, allowing applications to resume from a previous point without losing critical information.

Core Features & Use Cases

  • State Persistence: Save the internal state of XState actors to various storage mechanisms like localStorage or databases.
  • State Restoration: Load previously saved states to re-initialize actors, ensuring continuity.
  • Deep Persistence: Automatically handles the persistence of entire actor hierarchies.
  • Event Sourcing: Offers an alternative by replaying events to reconstruct state, providing an auditable log.
  • Use Case: A user is filling out a complex form managed by an XState machine. If they navigate away, this Skill can save their progress and restore it when they return, preventing data loss.

Quick Start

Use the xstate-persistence skill to save the state of the 'feedbackActor' to localStorage under the key 'feedback'.

Frequently Asked Questions about xstate-persistence

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

FAQPage Schema
How do I save and restore XState actor states for application continuity?

To save and restore XState actor states, use `actor.getPersistedSnapshot()` to extract the state and `createActor({ snapshot: ... })` to re-initialize the actor, ensuring application continuity without losing critical information.

Can I persist an entire XState actor hierarchy automatically?

Yes, you can persist an entire XState actor hierarchy automatically. The Skill supports deep persistence, automatically handling the saving and loading of nested actor structures to maintain state continuity.

What is event sourcing in XState and when should I use it over state persistence?

Event sourcing in XState is an alternative approach that replays events to reconstruct actor state, providing an auditable log. Use it over direct state persistence when you require a historical record of state changes.

Does XState v5 support saving actor snapshots to localStorage?

Yes, XState v5 supports saving actor snapshots to localStorage. You can use the `getPersistedSnapshot()` method to extract the internal state and store it under a specific key for later restoration.

How do I restore a complex form's progress if a user navigates away in XState?

To restore a complex form's progress in XState, save the actor state using `getPersistedSnapshot()` when the user navigates away, then load that saved snapshot via `createActor({ snapshot: ... })` to resume data entry.