Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
yonatangross avatar

Zustand Patterns

  • 898 installs
  • 213 repo stars
  • Updated August 4, 2026
  • yonatangross/orchestkit

Zustand Patterns is a Claude Code reference skill that documents seven Zustand 5.x store patterns with TypeScript examples for developers replacing Redux boilerplate in React apps.

About

Zustand Patterns is an OrchestKit reference skill (version 1.0.0, MIT) for Zustand 5.x state management in React. It documents 7 core patterns covering slices, middleware, Immer, useShallow, persistence, selectors, and devtools integration, with TypeScript examples and anti-patterns. The skill activates on paths like store directories and *.store.* files when building React state without Redux overhead. Zustand Patterns targets Zustand >=5.0.0 and is tuned for Claude Code 2.1.148+ with allowed tools Read, Write, Grep, and Glob. Use Zustand Patterns when implementing or reviewing Zustand stores, middleware chains, or persisted client state in modern React codebases.

  • Documents 7 core patterns with TypeScript examples and anti-patterns
  • Covers slices, middleware, Immer, useShallow, persistence, selectors, and devtools
  • Targets Zustand >=5.0.0 with lightweight global state and no Redux complexity
  • Path patterns for `**/store/**`, `*.store.*`, and `*.zustand.*` discovery
  • Reference load via core-patterns.md for full code samples

Zustand Patterns by the numbers

  • 898 all-time installs (skills.sh)
  • +47 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #421 of 2,245 Frontend Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/yonatangross/orchestkit --skill zustand-patterns

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs898
repo stars213
Security audit3 / 3 scanners passed
Last updatedAugust 4, 2026
Repositoryyonatangross/orchestkit

How do you structure Zustand 5 stores in React?

Implement Zustand 5.x stores with slices, middleware, persistence, and selectors instead of Redux boilerplate in React apps.

Who is it for?

React developers adopting Zustand 5.x who want slice-based stores, persistence, and selector patterns without Redux ceremony.

Skip if: Projects standardized on Redux Toolkit, server-state libraries like TanStack Query alone, or non-React frameworks.

When should I use this skill?

A developer writes or reviews Zustand stores, middleware, persistence, or selectors under store paths in a React app.

What you get

Typed Zustand store modules with slices, middleware, persistence, selectors, and devtools-ready patterns.

  • Zustand store modules
  • Middleware and persistence setup
  • Selector patterns with useShallow

By the numbers

  • Documents 7 core Zustand 5.x patterns with TypeScript examples
  • Targets Zustand >=5.0.0 and Claude Code 2.1.148+

Files

SKILL.mdMarkdownGitHub ↗

Zustand Patterns

Modern state management with Zustand 5.x - lightweight, TypeScript-first, no boilerplate.

Overview

  • Global state without Redux complexity
  • Shared state across components without prop drilling
  • Persisted state with localStorage/sessionStorage
  • Computed/derived state with selectors
  • State that needs middleware (logging, devtools, persistence)

Core Patterns

Covers basic stores, slices, Immer, persist, selectors, async actions, and devtools.

Load Read("${CLAUDE_SKILL_DIR}/references/core-patterns.md") for full code examples of all 7 core patterns.

Quick Reference

// ✅ Create typed store with double-call pattern
const useStore = create<State>()((set, get) => ({ ... }));

// ✅ Use selectors for all state access
const count = useStore((s) => s.count);

// ✅ Use useShallow for multiple values (Zustand 5.x)
const { a, b } = useStore(useShallow((s) => ({ a: s.a, b: s.b })));

// ✅ Middleware order: immer → subscribeWithSelector → devtools → persist
create(persist(devtools(immer((set) => ({ ... })))))

// ❌ Never destructure entire store
const store = useStore(); // Re-renders on ANY change

// ❌ Never store server state (use TanStack Query instead)
const useStore = create((set) => ({ users: [], fetchUsers: async () => ... }));

Key Decisions

DecisionOption AOption BRecommendation
State structureSingle storeMultiple storesSlices in single store - easier cross-slice access
Nested updatesSpread operatorImmer middlewareImmer for deeply nested state (3+ levels)
PersistenceManual localStoragepersist middlewarepersist middleware with partialize
Multiple valuesMultiple selectorsuseShallowuseShallow for 2-5 related values
Server stateZustandTanStack QueryTanStack Query - Zustand for client-only state
DevToolsAlways onConditionalConditional - enabled: process.env.NODE_ENV === 'development'

Anti-Patterns & Integration

Forbidden patterns (store destructuring, derived state, server state, direct mutation) and React Query integration guidance.

Load Read("${CLAUDE_SKILL_DIR}/references/anti-patterns-and-integration.md") for anti-pattern examples and TanStack Query separation patterns.

Related Skills

  • tanstack-query-advanced - Server state management (use with Zustand for client state)
  • form-state-patterns - Form state (React Hook Form vs Zustand for forms)
  • react-server-components-framework - RSC hydration considerations with Zustand

Capability Details

store-creation

Keywords: zustand, create, store, typescript, state Solves: Setting up type-safe Zustand stores with proper TypeScript inference

slices-pattern

Keywords: slices, modular, split, combine, StateCreator Solves: Organizing large stores into maintainable, domain-specific slices

middleware-stack

Keywords: immer, persist, devtools, middleware, compose Solves: Combining middleware in correct order for immutability, persistence, and debugging

selector-optimization

Keywords: selector, useShallow, re-render, performance, memoization Solves: Preventing unnecessary re-renders with proper selector patterns

persistence-migration

Keywords: persist, localStorage, sessionStorage, migrate, version Solves: Persisting state with schema migrations between versions

References

Load on demand with Read("${CLAUDE_SKILL_DIR}/references/<file>"):

FileContent
core-patterns.mdBasic store, slices, Immer, persist, selectors, async, devtools
anti-patterns-and-integration.mdForbidden patterns and React Query integration
middleware-composition.mdCombining multiple middleware in correct order

Other resources:

  • Load: Read("${CLAUDE_SKILL_DIR}/scripts/store-template.ts") - Production-ready store template
  • Load: Read("${CLAUDE_SKILL_DIR}/checklists/zustand-checklist.md") - Implementation checklist

Related skills

How it compares

Pick Zustand Patterns over generic React state guides when you need Zustand 5-specific slice, middleware, and persistence recipes.

FAQ

Which Zustand version does Zustand Patterns cover?

Zustand Patterns targets Zustand 5.x (>=5.0.0) and documents 7 core patterns including slices, middleware, Immer, persistence, selectors, and devtools for React TypeScript apps.

When should an agent load Zustand Patterns?

Zustand Patterns loads when building or reviewing React state under store paths such as **/store/** or *.store.*, especially when replacing Redux boilerplate with Zustand 5.x.

Is Zustand Patterns safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Frontend Developmentfrontendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.