Store Refactorer

Refactor large Zustand stores into modular slices under 120 lines.

Updated Feb 5, 2026
One-click install
npx skills add https://github.com/shynlee04/idumb-v2 --skill store-refactorer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Store Refactorer
Source: https://github.com/shynlee04/idumb-v2/tree/main/.agent/skills%20copy/architecture-remediation/store-refactorer
Command: npx skills add https://github.com/shynlee04/idumb-v2 --skill store-refactorer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the issue of "god stores" (large, monolithic state management files) that become difficult to maintain, understand, and scale by systematically refactoring them into smaller, focused, and manageable slices.

Core Features & Use Cases

  • Splitting Large Stores: Breaks down stores exceeding 300 lines into modular slices of 120 lines or less.
  • Zustand v5 Best Practices: Implements modern Zustand patterns like individual selectors and persistence on the combined store.
  • Backward Compatibility: Ensures existing codebases remain functional through facade exports.
  • Use Case: Refactor a monolithic user-profile Zustand store into separate slices for auth, preferences, and activity-log to improve maintainability and performance.

Quick Start

Analyze and split the store located at src/lib/state/user-profile.ts using the eliminate-god-stores workflow.

Frequently Asked Questions about Store Refactorer

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

FAQPage Schema
How do I refactor a large Zustand store into smaller modules?

To refactor a large Zustand store, you break down monolithic files exceeding 300 lines into modular slices of 120 lines or less. This process extracts distinct state domains into separate slices while maintaining a combined store for persistence.

What is a god store in state management and when should I split it?

A god store is a large, monolithic state management file that becomes difficult to maintain and scale. You should split it when the file exceeds 300 lines, refactoring it into focused slices to improve code modularization and performance.

Can I split a Zustand store without breaking backward compatibility?

Yes, you can split a Zustand store without breaking backward compatibility by using facade exports. This ensures existing codebases remain functional while the internal state management is restructured into individual slices.

How do I implement Zustand v5 best practices when extracting state slices?

Implementing Zustand v5 best practices involves using individual selectors and applying persistence on the combined store. When extracting state slices, you can also configure selective persistence via Dexie to optimize local storage.

What is the best way to eliminate circular dependencies in a Zustand store?

The best way to eliminate circular dependencies in a Zustand store is by consolidating duplicate stores and splitting god classes into modular slices. This refactoring isolates state logic, preventing the interlocking imports that cause circular dependencies.

Does Store Refactorer handle selective persistence with Dexie for Zustand slices?

Yes, Store Refactorer handles selective persistence with Dexie for Zustand slices. It configures persistence on the combined store while providing options to selectively persist specific slices, optimizing storage in large applications.