Svelte Store Refactoring Tool skill for Claude and Codex
Reshapes tangled Svelte store code into typed, single-purpose modules: side effects pulled into helpers, mixed concerns split into separate stores, and a…
Install it once and Claude or Codex runs it for you. When your request matches, your AI loads the skill, asks for anything it is missing, and works through the template itself. Prefer to fill it in by hand? See the full prompt template.
Download the skill (.zip) · View SKILL.md
When it is used
Use when a Svelte store has grown into a tangle of API calls, UI flags, and business rules and needs splitting into typed single-purpose modules. Do not use for diagnosing a store bug without restructuring, or converting stores to Svelte 5 runes. Related topics: coding, svelte.
What it will ask you for
- Current store code (longer free text)
- State it holds (choose any: User data, UI settings, Todo list, Auth token, Cart items, Theme preference, Other)
- Dependencies (free text, e.g. "External libraries or APIs the store calls")
- Error handling (choose one: Silent fail, Log to console, Throw exception, Return null)
- Type safety level (choose one: Basic JSDoc types, Full TypeScript, Leave untyped)
- Test coverage required (number from 0 to 100)
How it works
- List every concern the current code mixes (fetching, persistence, derived values, UI flags, rules); the list is complete before any code moves.
- Decide the module split: one store per concern, derived stores for computed values, utilities for side effects; each concern has a named home.
- Move the code into the new modules while keeping the store names and exported functions the components already use, noting any forced rename.
- Apply the chosen error handling at the side-effect boundary and add types at the requested level, so every export has a signature.
- Write the Structural Changes list with one bullet per move and the reason, and name the tests that would reach the coverage target.
What you get
One code block per refactored file with its path as the first comment, a Utilities section for extracted helpers, then a Structural Changes list of one bullet per move with its reason.
What it watches out for
- Renaming the store or its exports during the split, which breaks every component that imports them.
- Leaving an async fetch inside a derived store callback, which makes the derived value flicker between stale and fresh.
- Catching errors inside subscribers instead of at the side-effect boundary, so failures are swallowed where nobody can act on them.
How to install
Claude.ai and the Claude desktop app
- Download the skill .zip.
- Open Settings, then Capabilities, and find Skills.
- Choose Upload skill and select the .zip.
- Ask Claude for help with the task. It loads the skill when your request matches.
Claude Code
- Download the skill .zip.
- Unzip it into ~/.claude/skills/ (or .claude/skills/ inside a project).
- Start a new session. Claude Code loads the skill when your request matches.
Codex
- Download the skill .zip.
- Unzip it into ~/.agents/skills/ (or .agents/skills/ inside a project).
- Codex picks it up on its own. Type $ and the skill name to use it, or just ask for the task.
Cursor
- Download the Cursor rule (.mdc).
- Save it in .cursor/rules/ inside your project.
- Cursor's agent applies the rule when your request matches its description.
AGENTS.md (Codex, Cursor, and other coding agents)
- Copy the AGENTS.md section.
- Paste it into AGENTS.md at the root of your repository, creating the file if needed.
- Coding agents that read AGENTS.md follow it when your request fits.