Agent skill

svelte-runes

Svelte runes guidance. Use for reactive state, props, effects, attachments, or migration. Covers $state, $derived, $effect, @attach. Prevents reactivity mistakes.

Stars 163
Forks 31

Install this agent skill to your Project

npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/svelte-runes

SKILL.md

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

svelte
<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 onclick not on:click, {@render children()} in layouts
  • $derived can be reassigned (5.25+) - use const for read-only
  • Last verified: 2025-01-11

Expand your agent's capabilities with these related and highly-rated skills.

Didn't find tool you were looking for?

Be as detailed as possible for better results