Skip to content
AI & Agents
Skill

/xstate-store

Build, test, integrate, or migrate XState Store v4: transitions, effects, schemas, selectors, atoms, extensions, React bindings, and fromStore. Excludes XState state-machine design, other stores, and Query server state.

From plugin
skills
65589 skills1 command

Claude Code

$ npx -y skills add pedronauck/skills --skill xstate-store --agent claude-code

SKILL.md

xstate-store.SKILL.md
name: xstate-store
description: "Build, test, integrate, or migrate XState Store v4: transitions, effects, schemas, selectors, atoms, extensions, React bindings, and fromStore. Excludes XState state-machine design, other stores, and Query server state."

XState Store

Targets `@xstate/store` v4 and `@xstate/store-react` v2 (TypeScript 5.4+). Read the reference matched by the API or behavior being changed. Load adjacent references only for concerns the change crosses; reuse relevant context already read.

Pick the primitive first

| State | Primitive | Why | | --- | --- | --- | | Domain state updated through named events | `createStore({ context, on })` | Typed `trigger`, `can`, emitted events, replayable transitions | | Per-instance state built from input | `createStoreLogic({ context: (input) => … })` | One definition, many instances; `selectors` come along | | A single value set directly | `createAtom(value)` | No event vocabulary to justify a store | | A value computed from other atoms or selectors | `createAtom(() => …)` | Read-only, recomputes on dependency change | | Modes, guards, delays, hierarchical or parallel states | `xstate` machine | A store models data, not lifecycle |

*Done when:* the primitive is chosen from this table and its justification holds.

Branches

| When you are… | Reference | | --- | --- | | Creating a store, writing transitions, using `trigger`/`send`/`can`, or Immer | `references/store-core.md` | | Enqueuing effects, emitting events, or doing async work | `references/effects-and-events.md` | | Declaring `schemas` or turning on runtime validation | `references/schemas-and-validation.md` | | Reading state with `store.select`, atoms, derived/async/reducer atoms | `references/selectors-and-atoms.md` | | Building reusable/per-instance stores with `createStoreLogic`, input, or `selectors` | `references/store-logic-and-input.md` | | Adding `persist`, `undoRedo`, `reset`, or composing `.with(...)` | `references/extensions.md` | | Wiring a store into React components | `references/react.md` | | Testing transitions, inspecting a store, or interoperating with XState | `references/testing-and-interop.md` | | Upgrading a v3 store to v4, or porting an existing Zustand store over | `references/migration-v4.md` |

Apply the technical rules relevant to the changed behavior.

Tripwires

**Transitions** — return the complete next context (spread the old one); return `undefined` to mark an event disallowed, which is what `store.can.*()` reports.

**Effects** — call `enqueue.effect`, `enqueue.emit.*`, and `enqueue.trigger.*` synchronously inside the transition; async work goes inside `enqueue.effect(async () => …)` and reports back by triggering another event.

**Imports** — framework bindings come from `@xstate/store-react` (and siblings), never `@xstate/store/react`; extensions come from `@xstate/store/persist`, `/undo`, `/reset`, `/validate`.

**Schemas** — `schemas` types the store; only `.with(validateSchemas())` validates at runtime.

**Atoms** — computed atoms read dependencies via `.get()`; their first parameter is the previous computed value, so annotate `createAtom<T>(…)` when using it.

**React** — module-scoped stores for app-wide state, `useStore(logic, input)` for component-scoped state; subscribe through `useSelector`/`useAtom` rather than `getSnapshot()`.

Read more
@pedronauck
Ships withskills

A curated collection of 89 agent skills for Claude Code and compatible AI coding assistants — 43 original (⭐️), 33 hand-picked (💎), and 13 marketing & business (📣).

Stars on GitHub

Momentum

stars in total
655
Star history of pedronauck/skills on GitHub, a chart by star-history.com

Other skills on skills.

agent-browser

agent-browser

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling…

@pedronauck@pedronauckInstall Skill
ai-sdk

ai-sdk

Answer questions about the AI SDK and help build AI-powered features. Use when developers: (1) Ask about AI SDK functions like…

@pedronauck@pedronauckInstall Skill
autoresearch

autoresearch

Autonomously optimize any Claude Code skill by running it repeatedly, scoring outputs against binary evals, mutating the prompt,…

@pedronauck@pedronauckInstall Skill
centrifugo

centrifugo

Centrifugo real-time messaging server expert for WebSocket PUB/SUB, channel management, JWT authentication, event proxying, and…

@pedronauck@pedronauckInstall Skill
context7

context7

Retrieves up-to-date documentation, API references, and code examples for any developer technology. Use this skill whenever the…

@pedronauck@pedronauckInstall Skill
documentation-writer

documentation-writer

Diátaxis Documentation Expert. An expert technical writer specializing in creating high-quality software documentation, guided by…

@pedronauck@pedronauckInstall Skill

More skills from other plugins.

1password

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

openclaw2w393k
@openclaw@openclawInstall Skill

Questions about xstate-store.

Which coding agents can use xstate-store?
xstate-store installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.