Agent Skill
2/7/2026

apex-sovereign-state

Manages cart and user state using Zustand with hydration, persistence, and Redis synchronization.

A
adelfree2023
0GitHub Stars
1Views
npx skills add adelfree2023-dev/60SCE.SHOP

SKILL.md

Nameapex-sovereign-state
DescriptionManages cart and user state using Zustand with hydration, persistence, and Redis synchronization.

name: apex_sovereign_state description: Manages cart and user state using Zustand with hydration, persistence, and Redis synchronization.

🐻 State Management Logic (v2.0)

Focus: State Management Logic (17).


🏗️ State Logic Protocols

  • Clean Architecture for Zustand: All state stores must be partitioned by domain (Cart, Auth, UI). Stores must be strictly typed and favor immutable updates.
  • Hydration & Persistence: Implementation of Two-Phase Hydration to prevent SSR-Client mismatches. Mandatory persistence to LocalStorage with version-controlled migrations.
  • Redis Synchronization: Cross-device synchronization logic triggered on state change with debounced background sync to avoid platform saturation.

🚀 Root Solutions (State)

  • Derived Selectors: Use memoized selectors to prevent unnecessary re-renders in complex React trees.
  • Optimistic UI: Mandatory implementation of optimistic updates for high-frequency actions (e.g., adding items to cart), with rollback logic on API failure.
  • State-to-API Sync: Clean decoupling between UI state updates and API persistence calls using middleware or store actions.

⚖️ Integrity Rule

Never put raw server data in global client state. Use React Query for server-side cache and Zustand only for purely client-managed state.

Skills Info
Original Name:apex-sovereign-stateAuthor:adelfree2023