Start a fresh conversation. Replace the highlighted placeholders.
Use zustand-store-ts to create a typed Zustand store for [feature], using subscribeWithSelector, exporting it through the store index, and adding focused store tests.
Required inputs
[feature]
User-approved starter prompt based on a pinned source version; check current skill requirements before running. Task evidence ↗
SKILL.md
name: zustand-store-tsdescription: "Create Zustand stores following established patterns with proper TypeScript types and middleware."risk: criticalsource: communitydate_added: "2026-02-27"
Zustand Store
Create Zustand stores following established patterns with proper TypeScript types and middleware.
Quick Start
No assets/template.ts is bundled. Adapt the inline examples to the installed Zustand version and actual project types; these are fragments, not a complete application.
Use subscribeWithSelector for selector subscriptions
import { create } from 'zustand';
import { subscribeWithSelector } from 'zustand/middleware';
export const useMyStore = create<MyStore>()(
subscribeWithSelector((set, get) => ({
// state and actions
}))
);
// Good - only re-renders when `items` changes
const items = useMyStore((state) => state.items);
// Avoid - re-renders on any state change
const { items, isLoading } = useMyStore();