cygnusfear/claude-stuff/superpower-zustand
Claude Code and agent skill by cygnusfear/claude-stuff
- community
Checking that the SKILL.md file is still in the repository.
MANDATORY for creating Zustand stores. This skill is required when users request state management, creating stores, or mention Zustand. Do NOT create Zustand stores without this skill - all stores must use the required StoreBuilder pattern with immer middleware and factory pattern separation
Install
npx vskill@latest install cygnusfear/claude-stuff/superpower-zustandSKILL.md
Zustand StoreBuilder Pattern
<CRITICAL> DO NOT create Zustand stores using standard patterns (create with inline actions). ALL Zustand stores in this project MUST use the StoreBuilder pattern defined below. This is a required architectural standard, not a suggestion. </CRITICAL>
Purpose
Enforce a standardized, type-safe approach to creating Zustand stores that:
- Separates state definition from actions using the factory pattern
- Integrates immer middleware for convenient immutable updates
- Supports optional persistence with fine-grained control
- Exposes both reactive (useStore hook) and non-reactive (get/set) access
- Maintains consistent patterns across the codebase
When to Use This Skill
Use this skill when:
- Creating new Zustand stores for state management
- User requests state management solutions in a React application
- Implementing stores for any feature requiring client-side state
Required Pattern
All Zustand stores MUST use the StoreBuilder utility located in assets/storebuilder.ts.
Core Implementation Steps
- Copy the StoreBuilder utility (if not already in the project)
- Source:
skills/superpower-zustand/assets/storebuilder.ts - Destination:
src/lib/storebuilder.ts(or similar location in the project)
- Define state type separately from actions
- Create a type for the full store (state + actions)
- Use
Omitto exclude action methods when passing to StoreBuilder
- Initialize the store with StoreBuilder
- Pass initial state as first argument
- Optionally pass PersistConfig as second argument for persistence
- Separate actions using createFactory
- Define all actions as methods in the createFactory argument
- Actions access
setfrom the StoreBuilder closure - Use immer-style mutations within
setcallbacks
- Export the factory-created hook
- The hook returned by createFactory combines state, actions, and store utilities
Required Code Structure
State Updates with Immer
When using set, write mutations directly on the draft state (immer middleware is included):
Persistence Configuration
When state should persist across sessions:
Reference Documentation
For detailed examples and advanced patterns, read references/pattern-guide.md:
- Basic usage examples
- Persistence patterns
- Complex stores with async actions
- Using get/set outside React components
- Type safety patterns
Load the reference documentation when:
- Implementing complex stores with async operations
- Needing examples of persistence configuration
- User asks about advanced Zustand patterns
- Unsure about specific implementation details
Verification
After creating a store, verify:
- ✅ StoreBuilder utility is imported from project location
- ✅ State type uses
Omitto exclude actions - ✅ All actions are defined in
createFactory, not in initial state - ✅ State updates use immer-style mutations (mutate draft, don't return new object)
- ✅ Exported hook name follows convention (e.g.,
useMyStore) - ✅ Persistence config is included if state should persist
Non-React Usage
The pattern supports non-reactive access outside React components:
Use get and set when:
- Accessing state in utility functions
- Implementing middleware or side effects
- Working outside React component lifecycle
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/superpower-zustand/SKILL.md
Popularity
- Repository stars
- 3
- Repository forks
- 1
- 7-day trend score
- 7
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 16 Mar 2026, 8 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/cygnusfear/claude-stuff/superpower-zustand)