store-data-structures

Structure Zustand stores with ListItem and Detail maps for typed state.

1|Updated May 20, 2026
One-click install
npx skills add https://github.com/mDevsLabs/mAI --skill store-data-structures-mdevslabs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: store-data-structures
Source: https://github.com/mDevsLabs/mAI/tree/main/.agents/skills/store-data-structures
Command: npx skills add https://github.com/mDevsLabs/mAI --skill store-data-structures-mdevslabs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Zustand-based state management often suffers from poorly organized data shapes, leading to bloated components, duplication, and brittle UI updates across lists and details.

Core Features & Use Cases

  • Separate List and Detail data structures: lists use arrays while details leverage maps for caching multiple pages.
  • Strong typing discipline: rely on types from @lobechat/types and avoid database types in stores.
  • Per-item loading and optimistic updates: support quick navigation and fluid UI transitions between cached details.

Quick Start

Define separate ListItem and Detail types and implement a detailMap cache with per-item loading states.

Frequently Asked Questions about store-data-structures

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

FAQPage Schema
How do I structure Zustand stores for fast UI state and reliable optimistic updates?

Structure Zustand stores using a two-tier data shape with arrays for lists and maps for detail caches to enable fast UI state and reliable optimistic updates. This pattern enforces clear separation between list and detail data.

What is the best way to separate list and detail data structures in React state management?

The best way to separate list and detail data is using arrays for lists and maps for caching multiple detail pages. This per-item loading approach supports quick navigation and fluid UI transitions between cached details.

How do I implement per-item loading states for detail caches in Zustand?

Implement per-item loading states in Zustand by defining separate ListItem and Detail types and maintaining a detailMap cache. This supports quick navigation and fluid UI transitions between cached details.

Does this Zustand store pattern work with strong typing rules for frontend apps?

Yes, this Zustand store pattern works with strong typing discipline by relying on types from @lobechat/types and avoiding database types in stores. This ensures type-safe references for frontend apps.

Why do my Zustand store components become bloated and brittle during UI updates?

Zustand store components become bloated and brittle due to poorly organized data shapes. Applying a structured store pattern with a reducer pattern for mutations prevents duplication and brittle UI updates across lists and details.

Can I use database types directly in my Zustand store structures?

No, you should avoid database types in Zustand store structures. Instead, rely on types from @lobechat/types and implement separate ListItem and Detail types to maintain a clear two-tier data shape.