superpower-zustand

Create type-safe Zustand stores using the StoreBuilder utility.

5|3|Updated Oct 23, 2025
One-click install
npx skills add https://github.com/Cygnusfear/claude-stuff --skill superpower-zustand
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: superpower-zustand
Source: https://github.com/Cygnusfear/claude-stuff/tree/main/skills/superpower-zustand
Command: npx skills add https://github.com/Cygnusfear/claude-stuff --skill superpower-zustand

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires zustand, immer, and includes references (resource) and assets (resource) components.

What problem does it solve?

This skill eliminates the complexity and inconsistency often found in Zustand store implementations by enforcing a standardized, type-safe StoreBuilder pattern. It ensures all stores follow best practices, saving development time and reducing debugging efforts.

Core Features & Use Cases

  • Standardized StoreBuilder Pattern: Enforces a consistent, type-safe approach for all Zustand stores, separating state from actions.
  • Immer Middleware Integration: Simplifies immutable state updates, allowing direct mutations on draft state.
  • Optional Persistence: Supports fine-grained control over state persistence across sessions.
  • Use Case: When building a new feature in a React application that requires client-side state, use this skill to quickly scaffold a new Zustand store that adheres to all architectural standards, complete with persistence and type safety.

Quick Start

Initialize StoreBuilder with initial state

const { set, createFactory } = StoreBuilder<Omit<MyStoreState, 'setValue' | 'addItem'>>( { value: 0, items: [], } );

Create factory with actions

const useMyStore = createFactory({ setValue: (v: number) => set((state) => { state.value = v; }), addItem: (item: string) => set((state) => { state.items.push(item); }), });

Frequently Asked Questions about superpower-zustand

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a standardized Zustand store with type safety?

Use the StoreBuilder pattern to create type-safe Zustand stores by separating state from actions via Omit, initializing with StoreBuilder, and creating actions with createFactory. This enforces consistency across all stores and eliminates boilerplate while maintaining full TypeScript support.

Can I use Zustand with Immer for immutable state updates?

Yes. StoreBuilder integrates Immer middleware by default, letting you write mutations directly on draft state without manual immutability patterns. Changes are automatically applied as immutable updates to your Zustand store.

How do I add persistence to a Zustand store?

StoreBuilder supports optional persistence through fine-grained configuration. Define persistence settings when initializing the store, and state automatically syncs across sessions without additional setup.

What's the difference between reactive and non-reactive Zustand usage?

StoreBuilder exports both a hook for reactive components and get/set methods for non-reactive access. Use the hook in React components for automatic re-renders, or get/set directly when you need state outside component subscriptions.

Do I need to learn a new API to use this store pattern?

No. StoreBuilder wraps standard Zustand patterns with a consistent interface. If you know Zustand and React, you already have the knowledge—StoreBuilder simply enforces best practices and eliminates decision-making for store structure.

Can I migrate existing Zustand stores to this pattern?

Yes. Refactor existing stores by separating state from actions using Omit, then adapt them to use StoreBuilder and createFactory. The underlying Zustand behavior remains the same; you're adopting a standardized scaffolding pattern.