managing-state

Enforce Zustand patterns for client state and selective subscriptions.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/anthony-fdez/claude-skills --skill managing-state-anthony-fdez
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: managing-state
Source: https://github.com/anthony-fdez/claude-skills/tree/main/.claude/skills/managing-state
Command: npx skills add https://github.com/anthony-fdez/claude-skills --skill managing-state-anthony-fdez

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents common pitfalls in managing application state with Zustand, ensuring efficient re-renders and clear separation of concerns between client and server state.

Core Features & Use Cases

  • Zustand Best Practices: Enforces patterns for store structure, actions, and selective subscriptions.
  • Client vs. Server State: Clearly defines what data belongs in Zustand (client-only) versus React Query (server/API state).
  • Performance Optimization: Guides users to avoid full store subscriptions and sync API data into Zustand.
  • Use Case: When building a complex e-commerce front-end, this skill helps manage the shopping cart (client state) separately from product data fetched from an API (server state), preventing performance issues and bugs.

Quick Start

Use the managing-state skill to ensure that API data is not synced into Zustand stores.

Frequently Asked Questions about managing-state

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage client state with Zustand without causing re-render issues?

Manage client state with Zustand by using selective subscriptions to optimize re-renders. This approach ensures components only re-render when the specific state slices they depend on change, preventing performance bottlenecks.

Should I sync API data into Zustand or use React Query for server state?

You should not sync API data into Zustand. Use React Query for server state and Zustand for client-only state to maintain a clear separation of concerns and prevent data synchronization bugs.

What is the best way to structure a Zustand store for a complex frontend?

The best way to structure a Zustand store is by following enforced patterns for store architecture and action patterns. This keeps global state organized and separates client-side concerns from server data.

When should I differentiate client state from server state in React?

Differentiate client state from server state when managing complex data like an e-commerce cart versus fetched product data. Keep transient UI or cart state in Zustand and API data in React Query to avoid bugs.

Why does syncing API fetched data into Zustand cause performance problems?

Syncing API data into Zustand causes performance problems because it bypasses optimized server state management and triggers unnecessary re-renders. Keeping server data in React Query prevents these syncing bottlenecks.

How do I use selective subscriptions in Zustand to optimize performance?

Use selective subscriptions in Zustand to subscribe components only to the specific state fields they need. This prevents the component from re-rendering when unrelated parts of the global state update.