Skip to content

zustand

Use for Zustand stores: state shapes and type sources, state-only stores with xActions classes, replica-backed list/detail data (local-replica), selectors,

— (0 ratings) 7K downloads lobehub
$ npx skills add https://github.com/lobehub/lobehub --skill zustand

Skills can run code on your computer. Review the source before installing. This listing is community-made and isn't affiliated with Anthropic.

About this skill

LobeHub Zustand State Management

State Shapes and Types

  • Import shared store types from @lobechat/types, not @lobechat/database.
  • Keep lightweight list-item types separate from full detail types; list types must not extend heavy detail types.
  • Key cached details by id (xxxDetailMap: Record<string, Detail>); never hold a single currentDetail object.
  • Read through xxxSelectors aggregates (selectors.ts), not ad-hoc lambdas repeated across components.
  • Before choosing list/detail shapes or type sources, read Data structures.

State-Only Stores (default for new and migrated stores)

Actions stay out of the Zustand state. Reference: src/store/page.

File Owns
store.ts useXStore = createWithEqualityFn<XState>()(devtools(() => initialState), shallow): state only, no methods
privateAction.ts XPrivateAction: replica slices, entity links, and write helpers shared by public actions. Not exported from index.ts
action.ts XActionImpl (the public API) and the singleton xActions = new XActionImpl(setState, getState, new XPrivateAction(…))

Installs: 7.0K | GitHub stars: 86.2K | First seen: Jan 24, 2026

Related skills

New

DevOps & cloud

azure-storage

Unified access to Azure blob storage, file shares, queues, tables, and data lake services.

New • 780.2K
New

DevOps & cloud

azure-resource-visualizer

Transform Azure resource groups into detailed architecture diagrams showing resource relationships and configurations.

New • 779.4K
New

Databases

azure-kusto

Execute KQL queries and analyze data in Azure Data Explorer for log analytics, telemetry, and time series insights.

New • 779.1K