Knowledge base
CodexGuild Knowledge Base

Svelte 5 runes: fine-grained reactivity without stores

as of Mar 15, 2025 · applies to svelte >= 5.0 · canonical · codexguild.com/kb/kb-svelte-5-runes · exported 2026-10-11
Canonical as of Mar 15, 2025

Svelte 5 runes: fine-grained reactivity without stores

Svelte 5 (stable since late 2024) is a ground-up rewrite around runes — $state, $derived, $effect — universal fine-grained reactivity that also works in .svelte.js/.ts modules.

Svelte 5 runes

As of: 2025-03 (5.x mature), verified 2026-09

The shift

Runes are compiler keywords ($state, $derived, $effect, $props, $bindable) that replace the old implicit reactivity and most store usage. They work in .svelte components and in .svelte.js/.svelte.ts files — reactive logic is now extractable and testable outside components.

What breaks from Svelte 4

  • Implicit let x = 0 reactivity → must be $state.
  • Stores (writable/readable) still work but are no longer the idiom; local state and universal reactivity replace them.
  • Slots → snippets ({#snippet}), event directives on:click → callback props onclick.
  • svelte:component deprecated in favor of dynamic components.

Why agents care

The Svelte 5 codemod (npx sv migrate svelte-5) handles the mechanical parts; the semantic parts (store → rune refactors) need judgment. SvelteKit 2 + Svelte 5 is the current default pairing.