Zustand state management for React. Use when creating stores, TypeScript patterns, middleware (persist, devtools, immer, subscribeWithSelector), slice patterns, selector optimization, async actions, or testing Zustand stores.
Ships in zustand. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Zustand is a small, fast, scalable state management solution for React. This skill covers store creation, TypeScript patterns, middleware, and performance optimization.
import { create } from 'zustand'
interface BearStore {
bears: number
increase: () => void
reset: () => void
}
const useBearStore = create<BearStore>((set) => ({
bears: 0,
increase: () => set((state) => ({ bears: state.bears + 1 })),
reset: () => set({ bears: 0 }),
}))
// Select specific state (prevents unnecessary re-renders)
const bears = useBearStore((state) => state.bears)
const increase = useBearStore((state) => state.increase)
// Multiple selectors - use useShallow for object selections
import { useShallow } from 'zustand/react/shallow'
const { bears, increase } = useBearStore(
useShallow((state) => ({ bears: state.bears, increase: state.increase }))
)
For detailed patterns and advanced usage, load the appropriate reference:
| Topic | Reference | Use When |
|---|---|---|
| Store patterns | references/store-patterns.md | Creating stores, TypeScript setup, slice pattern, combining stores |
| Middleware | references/middleware.md | persist, devtools, immer, subscribeWithSelector, custom middleware |
| Custom middleware | references/middleware-custom.md | Writing custom middleware, common middleware stacks |
| React integration | references/react-integration.md | Selectors, avoiding re-renders, subscriptions, context usage |
| Async actions | references/async-actions.md | Async actions, data fetching, loading states, optimistic updates |
| Testing | references/testing.md | Store reset, action testing, RTL, mocked fetch, subscriptions |
// Get current state
const bears = useBearStore.getState().bears
// Subscribe to changes
const unsub = useBearStore.subscribe((state) => console.log(state.bears))
// Update state
useBearStore.setState({ bears: 10 })
import { create } from 'zustand'
import { devtools, persist } from 'zustand/middleware'
import { immer } from 'zustand/middleware/immer'
const useStore = create<Store>()(
devtools(
persist(
immer((set) => ({
// state and actions
})),
{ name: 'store-key' }
)
)
)
store-patterns.md for TypeScript setup and organizationmiddleware.md for middleware configurationreact-integration.md for selector optimizationasync-actions.md for async patterns and loading statestesting.md for testing patternsconfig.yaml (opens in a new tab)references/async-actions.md (opens in a new tab)references/middleware-custom.md (opens in a new tab)references/middleware.md (opens in a new tab)references/react-integration.md (opens in a new tab)references/store-patterns.md (opens in a new tab)references/testing.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/zustand:zustandfrom zustand
npx claudepluginhub kettleofketchup/kettleofskills --plugin zustand