Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 6% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -9% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 5% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -35% | 0% |
| case-12 | ✗→✓ | ▲ Improved | -53% | 0% |
Create Zustand stores following established patterns with proper TypeScript types and middleware.
Copy the template from assets/template.ts and replace placeholders:
{{StoreName}} → PascalCase store name (e.g., Project){{description}} → Brief description for JSDoctypescriptimport { create } from 'zustand'; import { subscribeWithSelector } from 'zustand/middleware'; export const useMyStore = create<MyStore>()( subscribeWithSelector((set, get) => ({ // state and actions })) );
typescriptexport interface MyState { items: Item[]; isLoading: boolean; } export interface MyActions { addItem: (item: Item) => void; loadItems: () => Promise<void>; } export type MyStore = MyState & MyActions;
typescript// Good - only re-renders when `items` changes const items = useMyStore((state) => state.items); // Avoid - re-renders on any state change const { items, isLoading } = useMyStore();
typescriptuseMyStore.subscribe( (state) => state.selectedId, (selectedId) => console.log('Selected:', selectedId) );
src/frontend/src/store/src/frontend/src/store/index.tssrc/frontend/src/store/*.test.tsOther measured skills in the registry, with their headline benchmark lift.