svelte/selector-lifecycle

Guides correct selector call modes across Svelte components, handlers, and redux-saga workflows.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Svelte selector readables depend on component context, so calling them in event handlers, after awaits, in tests, or inside sagas triggers lifecycle_outside_component crashes and wrong-shape bugs. This Skill provides a call-mode map and guardrails for choosing the correct selector invocation form in every context. ## Core Features & Use Cases - Call-mode map: Maps each context (component init, template, handler, saga, composition, non-context readable) to the correct selector call form: selectFoo(args), .select(state, args), .effect(args), or .withStore(store)(args). - Crash prevention rules: Lists do/don't patterns that avoid lifecycle_outside_component errors and readable-vs-value shape mismatches. - Use Case: When a Svelte component's save handler crashes after an await confirmDialog() call, apply this Skill to replace the post-await selectItem(itemId) readable creation with selectItem.select(appStore.state, itemId) and dispatch through the configured Store instance. ## Quick Start Ask the assistant to review a Svelte component or saga for correct selector call modes and fix any lifecycle_outside_component errors.

Frequently Asked Questions about svelte/selector-lifecycle

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

FAQPage Schema
How do I fix lifecycle_outside_component errors in Svelte?▼

The lifecycle_outside_component error occurs when a selector readable is created outside component initialization, since selectFoo() depends on getContext(). Capture readables at top-level component init, and use selectFoo.select(state, args) for one-shot reads in handlers, callbacks, or after await.

How do I read a selector value inside a Svelte event handler?▼

Use the selector's .select(state, args) form with the initialized Store instance captured outside the handler, for example selectItem.select(appStore.state, itemId). This performs a one-shot read without requiring Svelte context.

How do I use selectors inside redux-saga workers?▼

Use the selector's .effect(args) form with yield* inside sagas instead of passing the selector object to the saga select effect. For reacting to selector value changes, use selector-channel helpers with plain arguments.

Can I call a Svelte selector readable in a template expression?▼

Calling selectFoo() in a template expression violates lifecycle guidance even when caching reuses the readable. Capture the readable once during component initialization and render the captured value with the $value$ auto-subscription syntax.

What is the difference between selectFoo() and selectFoo.select(state)?▼

selectFoo() uses Svelte context and returns a readable store, so it only works during component initialization. selectFoo.select(state, args) returns the plain value directly and works in handlers, tests, and selector composition without context.