raphaelmans/agent-skills/xstate
Claude Code and agent skill by raphaelmans/agent-skills
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Helps create XState v5 state machines in TypeScript and React. Use when building state machines, actors, statecharts, finite state logic, actor systems, or integrating XState with React/Vue/Svelte components.
Install
npx vskill@latest install raphaelmans/agent-skills/xstateSKILL.md
XState v5 Skill
CRITICAL: This skill covers XState v5 ONLY. Do not use v4 patterns, APIs, or documentation. XState v5 requires TypeScript 5.0+.
When to Use
- State machine and statechart design
- Actor system implementation
- XState v5 API usage (
setup,createMachine,createActor) - Framework integration (React, Vue, Svelte)
- Complex async flow orchestration
Key Concepts
Actors are independent entities that communicate by sending messages. XState v5 supports:
| Actor Type | Creator | Use Case | |
|---|---|---|---|
| State Machine | createMachine() | Complex state logic with transitions | |
| Promise | fromPromise() | Async operations (fetch, timers) | |
| Callback | fromCallback() | Bidirectional streams (WebSocket, EventSource) | |
| Observable | fromObservable() | RxJS streams | |
| Transition | fromTransition() | Reducer-like state updates |
Quick Start
v5 API Changes (NEVER use v4 patterns)
| v4 (WRONG) | v5 (CORRECT) | |
|---|---|---|
createMachine() alone | setup().createMachine() | |
interpret() | createActor() | |
service.start() | actor.start() | |
state.matches() | snapshot.matches() | |
services: {} | actors: {} | |
state.context | snapshot.context |
Invoke vs Spawn
- invoke: Actor lifecycle tied to state (created on entry, stopped on exit)
- spawn: Dynamic actors independent of state transitions
Inspection API (Debugging)
Event types: @xstate.actor, @xstate.event, @xstate.snapshot, @xstate.microstep
File Organization
Learning Path
| Level | Focus | |
|---|---|---|
| Beginner | Counter, toggle machines; setup() pattern | |
| Intermediate | Guards, actions, hierarchical states, fromPromise() | |
| Advanced | Observable actors, spawning, actor orchestration |
Supporting Documentation
- PATTERNS.md - Guards, actions, actors, hierarchical/parallel states
- REACT.md - React hooks (
useMachine,useActor,useSelector) - EXAMPLES.md - Complete working examples
Resources
- Official Docs
- Stately Studio - Visual editor
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingxstate/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/raphaelmans/agent-skills/xstate)