svelte-runes

Guide Svelte 5 reactivity patterns with $state, $derived, and $effect.

Updated Dec 28, 2025
One-click install
npx skills add https://github.com/kvnaponte/Cinema_Puntuacion --skill svelte-runes-kvnaponte
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: svelte-runes
Source: https://github.com/kvnaponte/Cinema_Puntuacion/tree/main/.claude/skills/svelte-runes
Command: npx skills add https://github.com/kvnaponte/Cinema_Puntuacion --skill svelte-runes-kvnaponte

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance on mastering Svelte 5's reactivity features, preventing common mistakes and streamlining development.

Core Features & Use Cases

  • Reactivity Patterns: Learn and implement the correct use of $state, $derived, $effect, $props, and $bindable.
  • Code Examples: Practical examples for reactive state, component props, side effects, and migration from Svelte 4.
  • Quick Reference: Easy access to key rules and best practices for writing efficient Svelte 5 code.

Quick Start

Use the svelte-runes skill to get the best practices for managing reactive state in Svelte 5.

Frequently Asked Questions about svelte-runes

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

FAQPage Schema
How do I manage reactive state in Svelte 5 using $state?

Svelte 5 reactive state uses the `$state` rune to declare reactive variables. You initialize values using `$state` in your script block, which automatically tracks dependencies and updates the DOM when the value changes.

What is the best way to migrate reactive variables from Svelte 4 to Svelte 5?

Migrating Svelte 4 reactive variables to Svelte 5 involves replacing `let` declarations with `$state` runes, computed properties with `$derived`, and reactive statements (`$:`) with `$effect` blocks.

When should I use $derived instead of $effect in Svelte 5?

Use `$derived` in Svelte 5 to compute values from other reactive state, ensuring efficient updates. Use `$effect` only for side effects like manual DOM manipulations or data fetching that need to run after the DOM updates.

How do I handle component props and bindable values in Svelte 5?

Svelte 5 component props are managed using the `$props` rune. You can mark specific props as bindable using the `$bindable` function to allow two-way data binding between parent and child components.

Why does my Svelte 5 reactive state not update correctly?

Svelte 5 reactivity issues often stem from mutating arrays or objects without reassignment, or misusing runes. Ensure you follow best practices by using `$state` correctly and leveraging `$derived` for computed values.

Can I use Svelte 5 runes in plain JavaScript files?

Svelte 5 runes require the Svelte compiler to process reactivity. You must use them within `.svelte` components or `.svelte.js`/`.svelte.ts` modules to ensure the compiler correctly transforms the reactivity patterns.