store-data-structures

Organize Zustand store data into List and Detail patterns with Map-based caching.

1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/andershi666/lobehub-hr-demo --skill store-data-structures-andershi666
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: store-data-structures
Source: https://github.com/andershi666/lobehub-hr-demo/tree/main/lobehub/.agents/skills/store-data-structures
Command: npx skills add https://github.com/andershi666/lobehub-hr-demo --skill store-data-structures-andershi666

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Zustand store data structure patterns for LobeHub. Covers List vs Detail data structures, Map + Reducer patterns, type definitions, and when to use each pattern. Use when designing store state, choosing data structures, or implementing list/detail pages.

Core Features & Use Cases

  • Separate List and Detail types
  • Use Map for Details to cache multiple pages
  • Use Array for Lists; Type-safe with @lobechat/types; Provide computed fields
  • Provide patterns for reducers, selectors, and per-item loading states
  • Use when building scalable UI with optimistic updates

Quick Start

Create a zustand store split into a list array (entityList) and a detail map (entityDetailMap), then hook per-item loading and a reducer for mutations.

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 pages?

Structure Zustand store data by separating list types into an array and detail types into a Map. This List and Detail pattern optimizes performance and caching for fast UI rendering across multiple pages.

What is the best way to cache multiple detail pages in a Zustand store?

The best way to cache multiple detail pages in a Zustand store is using a Map-based detail structure. This pattern allows efficient caching and retrieval of individual detail items alongside per-item loading states.

How do I manage per-item loading states when fetching detail data?

Manage per-item loading states by implementing a Map-based detail structure within your Zustand store. This pattern isolates the loading status for each specific item, ensuring responsive UI updates during detail mutations.

When should I use a reducer-based approach for Zustand store mutations?

Use a reducer-based approach for Zustand store mutations when building scalable UI with optimistic updates. This pattern ensures predictable state changes for detail data and maintains clear separation from list types.

Can I use this state-management pattern for applications requiring optimistic updates?

Yes, you can use this state-management pattern for applications requiring optimistic updates. It provides clear type definitions and computed fields for lists, ensuring scalable UI updates when handling detail mutations.