svelte/migration/component-migration

Migrates Svelte components from store imports to Themis selector readables and dispatch.

6|6|Updated Jun 29, 2026
One-click install
npx skills add https://github.com/intent-hq/cloudlands-fe --skill svelte-migration-component-migration-intent-hq
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: svelte/migration/component-migration
Source: https://github.com/intent-hq/cloudlands-fe/tree/main/.agents/skills/themis/svelte/migration/component-migration
Command: npx skills add https://github.com/intent-hq/cloudlands-fe --skill svelte-migration-component-migration-intent-hq

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Replacing legacy Svelte store imports and $foo template subscriptions with Redux-style selector readables is error-prone, especially around lifecycle timing and dual state ownership. This Skill provides concrete before/after patterns and a rollout order to migrate components safely. ## Core Features & Use Cases - Store-to-Selector Migration: Replace import { foo } from "$lib/stores/..." with selectFoo() readables created once at component initialization and consumed as $foo$ in templates. - Dispatch Conversion: Convert foo.set(...) and foo.update(...) calls into store.dispatch(<action>(...)) through the configured app Store instance. - Lifecycle Pitfall Guidance: Shows why calling a readable selector inside an event handler crashes, and how to use selectFoo.select(store.state) for one-shot reads instead. - Use Case: While migrating a CounterPanel component, replace its writable/derived stores with slice selectors, update template references to $count$, and route increments through store.dispatch(increment()). ## Quick Start Migrate this Svelte component from legacy store imports to Themis selector readables and dispatch following the rollout order.

Frequently Asked Questions about svelte/migration/component-migration

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

FAQPage Schema
How do I migrate a Svelte component from stores to Redux selectors?▼

Replace each store import with slice selectors and action creators, create one readable per selector at component initialization, swap `$foo` template references to `$foo$`, and convert set/update calls into store.dispatch with the appropriate action.

How to read Redux state inside a Svelte event handler?▼

Use the selector's one-shot mode: call selectFoo.select(store.state) with an already-initialized Store instance captured outside the handler. Never call selectFoo() inside a callback, since creating a readable requires component initialization timing.

Why does calling a selector readable inside a click handler crash?▼

Readable selector calls like selectDraft() create a subscription that requires component initialization context. Inside callbacks that context is gone, so the call fails. Use selectDraft.select(store.state) for a plain one-shot read instead.

Can I keep updating the old Svelte store during Redux migration?▼

No. Writing to both the legacy writable and dispatching Redux actions creates two state owners, so rollback and selector reads disagree. Each piece of state must have a single owner: dispatch through the configured Store instance only.

What is the rollout order for migrating one Svelte component?▼

Swap store imports for selectors and actions, create readables at init time, rename template references to $foo$, convert mutations to store.dispatch, use select(store.state) for one-shot reads, then re-run the component's existing tests before committing.