svelte/component-integration

Wire Themis Store into Svelte 5 components with initialization, dispatch, and selector readables.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @augmentcode/themis.

What problem does it solve? Setting up Redux-style state management in a Svelte 5 app involves tricky lifecycle concerns: initializing the store in the root layout, starting sagas at the right time, binding selector readables in templates, and avoiding context errors from calling selectors in event handlers. This Skill provides the exact patterns and rules for integrating the Themis Store class into Svelte components correctly. ## Core Features & Use Cases - Root layout bootstrap: Initialize the Store with store.init() in +layout.svelte and register its disposer with onDestroy to prevent leaked saga tasks on hot reload. - Saga lifecycle management: Start app sagas explicitly via store.runSaga(sagaFn) from onMount or imperatively, with mount-scoped cancellation. - Component state patterns: Create selector readables at component init, bind them in templates with $selector$ syntax, and dispatch actions through the configured Store instance in handlers. - Use Case: You are building a SvelteKit feature that fetches and displays items. Use this Skill to set up the store in the root layout, start the fetch saga on mount, bind selectItems() and selectIsLoading() readables in the component, and dispatch removeItem(id) from a delete handler without hitting getContext() errors. ## Quick Start Ask the AI to wire the Themis Store into your Svelte 5 root layout and components, including store initialization, saga startup, and selector binding in templates.

Frequently Asked Questions about svelte/component-integration

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

FAQPage Schema
How do I initialize a Redux store in a Svelte 5 root layout?▼

Create a single Store instance at module scope with your reducers, then call store.init() in +layout.svelte and register the returned disposer with onDestroy. This ensures the store runtime is ready before children use selectors and cleans up saga tasks on teardown.

How to start redux-saga in a Svelte component?▼

Start app sagas explicitly with store.runSaga(sagaFn) after store.init() has been called, typically inside onMount so the saga lifetime ties to the component mount. Svelte calls the returned cancel function automatically when the component unmounts.

Why does calling a selector inside an event handler throw an error?▼

Selector readable calls like selectFoo() use Svelte's getContext() internally, which is only valid during component initialization. In handlers, use selectFoo.select(store.state) with the imported Store instance for one-shot state reads instead.

Can I call store.init() in multiple nested layouts?▼

No, store.init() returns a noop disposer when a store context already exists, so a second call silently does nothing. Initialize once in the root layout and register all reducers and sagas on that single shared Store instance.

How do I bind selector state in Svelte templates reactively?▼

Create the selector readable at the top of the component script block, then reference it in the template with the $ prefix, such as $items$. Calling selectFoo() directly in the template body creates a fresh readable every render and loses memoization.