state-management
State Management
Use this skill for state modeling first and library mapping second.
The goal is not to recommend a favorite library. The goal is to produce a state model that remains sound whether the implementation ends up in local component state, a reducer, Redux, Zustand, Pinia, URL params, TanStack Query, or no library at all.
Your job:
- reduce state to the smallest valid source of truth
- move derived values into selectors, getters, computed values, or render-time calculations
- replace boolean soup with explicit finite states when modes are mutually exclusive
- define state changes in terms of events and transitions rather than arbitrary setter calls
- place each piece of state in the right home
- review existing code for invalid states, duplication, synchronization bugs, and misplaced effects
- map the resulting model to the user's chosen library only after the model is clear
First pass
In an existing codebase:
More from statelyai/skills
xstate-v5
Design, implement, review, and migrate XState v5 state machines and statecharts in TypeScript using modern v5 patterns. Use this whenever the user mentions XState, actors, state machines, statecharts, guards, transitions, workflows, or Stately, or is modeling non-trivial UI/app/process logic in a codebase that uses XState. Prefer a short machine sketch before code when requirements are fuzzy. If the problem is too simple for a state machine, say so and recommend @xstate/store instead.
112readme
Keep README files in sync with the repo using symbolic HTML comments. Use this skill whenever making a repo change that could affect documentation — code (exported APIs, configuration, examples, CLI commands, dependencies), repo structure (adding/removing/renaming files, directories, packages, or other sibling entries referenced by a listing comment), or metadata (package.json, manifests). Also use when authoring or editing README files to add or update symbolic comments. Trigger on any change — code or structural — that touches a construct referenced by an HTML comment in a markdown file.
36