store-data-structures

Structure Zustand store data with arrays for lists and maps for cached details.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/dodevproject/lobe-chat --skill store-data-structures-dodevproject
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: store-data-structures
Source: https://github.com/dodevproject/lobe-chat/tree/main/.agents/skills/store-data-structures
Command: npx skills add https://github.com/dodevproject/lobe-chat --skill store-data-structures-dodevproject

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides clear patterns and best practices for structuring data within Zustand stores, ensuring efficient state management, especially for list and detail views.

Core Features & Use Cases

  • List vs. Detail Separation: Learn when to use arrays for lists and maps for cached details.
  • Type Definitions: Understand how to define lightweight list types and full detail types using @lobechat/types.
  • Reducer Pattern: Implement immutable updates for detail data using Immer and Redux-style reducers.
  • Use Case: When building a dashboard with many individual item views, use this Skill's patterns to efficiently cache and update each item's data without refetching the entire list.

Quick Start

Use the store-data-structures skill to understand how to structure data for list and detail pages in Zustand.

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 store data for list and detail views?

Structure Zustand store data by separating list and detail patterns, using arrays for lists and maps for cached details to ensure efficient state management without mixing list and detail types.

What are common pitfalls when designing Zustand store data structures?

Common pitfalls when designing Zustand store data structures include mixing list and detail types or using database types directly in stores, which reduces state management efficiency and breaks type safety.

How do I implement immutable updates for detail data in Zustand?

Implement immutable updates for detail data in Zustand by using Immer and Redux-style reducers, ensuring cached detail maps are updated efficiently without mutating the existing state.

When should I use maps instead of arrays in a Zustand store?

Use maps instead of arrays in a Zustand store when building features like dashboards with individual item views, allowing you to efficiently cache and update detail data without refetching the entire list.

How do I define lightweight list types and full detail types for state management?

Define lightweight list types and full detail types for state management using type definitions from @lobechat/types, ensuring the store separates minimal list data from complete cached detail objects.