Svelte runes guidance. Use for reactive state, props, effects, attachments, or migration. Covers $state, $derived, $effect, @attach. Prevents reactivity mistakes.
Installation
Details
Usage
After installing, this skill will be available to your AI coding assistant.
Verify installation:
skills listSkill Instructions
name: svelte-runes
IMPORTANT: Keep description on ONE line for Claude Code compatibility
prettier-ignore
description: Svelte runes guidance. Use for reactive state, props, effects, attachments, or migration. Covers $state, $derived, $effect, @attach. Prevents reactivity mistakes.
Svelte Runes
Quick Start
Which rune? Props: $props() | Bindable: $bindable() |
Computed: $derived() | Side effect: $effect() | State: $state()
Key rules: Runes are top-level only. $derived can be overridden
(use const for read-only). Don't mix Svelte 4/5 syntax.
Objects/arrays are deeply reactive by default.
Example
<script>
let count = $state(0); // Mutable state
const doubled = $derived(count * 2); // Computed (const = read-only)
$effect(() => {
console.log(`Count is ${count}`); // Side effect
});
</script>
<button onclick={() => count++}>
{count} (doubled: {doubled})
</button>
Reference Files
- reactivity-patterns.md - When to use each rune
- migration-gotchas.md - Svelte 4→5 translation
- component-api.md - $props, $bindable patterns
- snippets-vs-slots.md - New snippet syntax
- common-mistakes.md - Anti-patterns with fixes
- attachments.md - @attach replaces use: actions
Notes
- Use
onclicknoton:click,{@render children()}in layouts $derivedcan be reassigned (5.25+) - useconstfor read-only- Last verified: 2025-01-11
More by spences10
View allResearch topics by verifying actual source content. Use when asked to research or study links and documentation.
Svelte deployment guidance. Use for adapters, Vite config, pnpm setup, library authoring, PWA, or production builds.
Svelte component patterns. Use for web components, component libraries (Bits UI, Ark UI, Melt UI), form patterns, or third-party integration.
SvelteKit remote functions guidance. Use for command(), query(), form() patterns in .remote.ts files.