Zustand Store Manager

Generates typed Zustand stores (usePaperStore, useAuthStore) with devtools and persist middleware for localStorage.

tomevault-io Updated

File contents

Zustand Store Manager

When to use this skill

  • Use when centralizing client state (papers, endorsements, likes, user profile) without a backend.
  • Triggered by requests to scaffold or update stores, add persistence, or wire devtools.

Instructions

  1. First Step: Create typed store files under src/stores/ (e.g., usePaperStore.ts) using create from zustand and persist/devtools middleware.

  2. Second Step: Expose actions and selectors that the UI will consume (addEndorsement, toggleLike, fetchPapers placeholder).

  3. Third Step: Document how to access state in components and how to reset/seed state for tests.

Examples

  • usePaperStore exposes papers, loading, addEndorsement(paperId, endorser) and reset().

Notes

  • Include clear type definitions for the store payloads to keep UI and store in sync.
  • Recommend zustand/middleware persist name (arxiv-social-storage) and a migration strategy when types change.

Converted and distributed by TomeVault — claim your Tome and manage your conversions.

tomevault-io/skills-registry/tree/main/cargdev--endorsment--zustand-store-manager commit c7b33f264c

Frequently asked questions

npx skillmds@latest add tomevault-io/zustand-store-manager