xstate-helper
БесплатноБез исполняемых скриптовНе проверенXState v5 state machines, statecharts, and the actor model for complex, event-driven application logic. When user works with XState, state machines…
от shepherdjerred★ 85 звёзд на GitHubОб этом скилле
XState Helper Agent
Guidance for XState v5 — state machines, statecharts, and actors. This monorepo uses Bun and a
strict ESLint config; read the Monorepo Gotchas section before writing any machine here — the
documented setup({ types }) idiom from the official docs does not lint-pass in this repo and
there is a specific workaround.
Versions (verified mid-2026)
| Package | Latest | Notes |
|---|---|---|
xstate |
5.32.0 | Core. In-repo use: discord-plays-pokemon/.../backend pins ^5.32.0 |
@xstate/react |
6.1.0 | React hooks. peer: react 16.8–19, xstate ^5.28 |
@xstate/store |
4.1.0 | Lightweight store (Zustand-like). React binding is a separate package |
@xstate/store-react |
2.0.0 | React binding for store v4 — @xstate/store/react was removed in v4 |
bun add xstate # core
bun add @xstate/react # React bindings
bun add @xstate/store @xstate/store-react # lightweight store + its React binding
Requires TypeScript 5.0+. In tsconfig.json set "strictNullChecks": true (required — types
break without it) and "skipLibCheck": true (recommended).
What's New in XState v5 (2024–2026)
v5 made actors first-class, removed v4 magic (typegen, implicit string events, external-by-default
transitions), and added setup() for type safety. Recent 5.x minors:
actor.select(selector, eq?)(5.29) — derive a framework-agnosticReadable<T>off any actor's snapshot;.get()+.subscribe()(only fires when the selected value changes). No hook needed.- Routable states (5.28) — a state with
route: {}+ explicitidis reachable from anywhere via{ type: 'xstate.route', to: '#id' }. Routes accept aguard(string ref resolved since 5.31.1). getMicrosteps()/getInitialMicrosteps()(5.27) — pure[snapshot, actions]tuples per microstep, so you can inspect every intermediate (incl.always) state without executing actions.maxIterations(5.31) — infinite-loop guard for eventless transitions (defaultInfinity).filterEvents(5.30) —xstate/graph+createTestModeltraversal limited to currently-enabled events (e.g.state.can(event)).setup().assign/raise/sendTo/emit/spawnChild/enqueueActions(...)(5.22) — type-bound action helpers; no inline generics. Current best practice for typedenqueueActions/emit/spawnChild.setup.extend()(5.24) andsetup().createStateConfig()(5.21) — composable, modular setups.mapState(snapshot, mapper)(5.31),getNextTransitions(snapshot)(5.26), partial descriptors inassertEvent(event, 'FEEDBACK.*')(5.25).- Model-based testing moved into core — import from
xstate/graph(@xstate/testis deprecated). @xstate/storev3/v4 —store.trigger.someEvent(...)typed API,.with(persist({ name })), atoms, schema validation; v4 split framework bindings into@xstate/store-reactetc.
Core Mental Model
Everything is an actor. An actor is a live entity with private state, a mailbox (one event at a time), and async message passing. A state machine is the most robust way to describe an actor's behavior — but
fromPromise,fromCallback,fromObservable, andfromTransitionare actor logic too.
- Logic (the machine/definition) is inert.
createActor(logic)makes a running actor. actor.send({ type })— events are objects, never bare strings (v4 allowed strings; v5 does not).actor.getSnapshot()reads current state;actor.subscribe(fn)observes changes (does not emit the current value immediately — readgetSnapshot()for that).
import { createMachine, createActor } from "xstate";
const toggleMachine = createMachine({
id: "toggle",
initial: "inactive",
states: {
inactive: { on: { toggle: { target: "active" } } },
active: { on: { toggle: { target: "inactive" } } },
},
});
const actor = createActor(toggleMachine);
actor.subscribe((snapshot) => console.log(snapshot.value));
actor.start(); // logs "inactive"
actor.send({ type: "toggle" }); // logs "active"
actor.stop();
Machine vs Store — pick the right tool
- State machine (
xstate) — many discrete states, guarded transitions, hierarchy/parallelism, async orchestration. Use when the transitions are the hard part (wizards, checkout, auth, media players). - Store (
@xstate/store) — a small, event-based shared-state container (Zustand-like) when you do not need statecharts. Seereferences/xstate-store.md. - Not XState at all — for a bag of independent values prefer Zustand/Jotai; for server cache use
TanStack Query. A localized form/wizard reducer can just be
useReducer. XState earns its weight when illegal states and complex transitions are the actual problem (it makes impossible states unrepresentable). Don't reach for it to hold three booleans.
setup() + createMachine — the typed entry point
`setup({ typ
Установить xstate-helper в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл xstate-helper?
XState v5 state machines, statecharts, and the actor model for complex, event-driven application logic. When user works with XState, state machines, statecharts, actors, createMachine/setup, createActor, @xstate/react, @xstate/store, useMachine/useActor/useSelector, invoke/spawn, guards/actions/assign, or needs to model complex async flows, wizards, and event-driven state.
Как установить скилл xstate-helper?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл xstate-helper запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic