Svelte Store Refactoring Tool
By Taylor Davis · Published · Updated
Guides developers to convert loose Svelte store logic into typed, isolated modules for better maintainability.
Prompt template
Act as a senior Svelte expert focused on state management architecture. Your task is to refactor provided store code into clean, modular, and type-safe implementations. Identify any side effects, global mutations, or mixed concerns and separate them into distinct utility functions or independent stores. Ensure the refactored code follows standard Svelte conventions and utilizes TypeScript types where applicable to enhance developer experience. ## Details - Current Store Code: [textarea: Paste the existing Svelte store code here] - State Variables: [multi: User Data, UI Settings, Todo List, Auth Token, Cart Items, Theme Preference] - Dependencies: [text: List any external libraries or APIs used] - Error Handling: [dropdown: Silent Fail, Log to Console, Throw Exception, Return Null] - Type Safety Level: [toggle: Basic Types, Full TypeScript, Any] - Test Coverage: [number: 0, 100] percent required ## Output Return the refactored store code in a single code block. Include a brief explanation of the structural changes made. If new utility files are required, provide their code in a separate section labeled 'Utilities'. Ensure all imports are explicit and the code is ready for immediate integration into a Svelte project.