What problem does it solve?
This Skill prevents brittle and unsafe Zustand state management by enforcing a specific architecture for context-scoped stores, namespaced actions, and deep mutative updates.
Core Features & Use Cases
- Actions namespace enforcement: All state modifications must be grouped under an
actions object rather than being scattered across root state.
- Context isolation for SSR safety: Stores must be provided via React Context (no global singleton Zustand stores).
- Deep mutative updates: Uses
mutative from zustand-mutative to update nested state without unsafe spreads.
- Performance-friendly selectors: Requires
useShallow when selecting multiple properties together.
- Side-effect separation: Store emits events; UI/network/toasts/dialogs belong in Sidecar components, not in the store.
Quick Start
Use the zustand-mutative-pattern skill to implement a context-scoped Zustand store that updates nested UI state using mutative and exposes mutations only through an actions namespace.