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
First Step: Create typed store files under
src/stores/(e.g.,usePaperStore.ts) usingcreatefromzustandandpersist/devtoolsmiddleware.Second Step: Expose actions and selectors that the UI will consume (
addEndorsement,toggleLike,fetchPapersplaceholder).Third Step: Document how to access state in components and how to reset/seed state for tests.
Examples
usePaperStoreexposespapers,loading,addEndorsement(paperId, endorser)andreset().
Notes
- Include clear type definitions for the store payloads to keep UI and store in sync.
- Recommend
zustand/middlewarepersist name (arxiv-social-storage) and a migration strategy when types change.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.