Agent skill · software engineering · pedronauck
zustand
Expert guide for Zustand state management patterns, store organization, and best practices. Use when implementing client state management with Zustand, creating stores, or managing shared UI state across components.
Why this skill is useful
Provides specific patterns and middleware usage for Zustand that the AI wouldn't reliably generate on its own.
What it needs
About 2k tokens when loaded. Last updated 2026-08-01. 564 stars on the source repository.
What this skill does
Zustand State Management Guide This skill provides guidelines, patterns, and best practices for working with Zustand in this project. Quick Start For detailed store patterns, middleware usage, and comprehensive examples, please refer to references/patterns.md. Core Philosophy Shared Client State Only: Use Zustand for shared client state, not server state (use TanStack Query for that). Domain-Specific Stores: Keep stores focused on specific domains. Type Safety: Leverage TypeScript for fully typed stores. Simplicity: Prefer simplicity over complex abstractions. Store Organization Essential Patterns Create separate stores for different domains Use slices pattern for large stores Keep stores close to features that use them Export typed selector hooks for better DX and performance Recommended Middleware Stack Use the following middleware combination for production stores: Store Structure Template Selector Hooks Pattern Always create selector hooks for performance optimization: Best Practices 1. Keep stores focused on specific domains 2. Use TypeScript for full type safety 3. Leverage middleware for common patterns (devtools, persist, immer) 4. Create selector hooks for performance 5. Use immer for complex nested state updates 6. Persist only necessary state - use partialize option 7. Test stores thoroughly 8. Handle async operations properly with loading/error states 9. Implement optimistic updates when appropriate 10. Document store structure and actions Common Tasks Creating a New Store 1. Define the state interface with typed actions 2. Create the store with appropriate middleware 3. Export selector hooks for each state slice 4. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills pedronauck/zustand