A comprehensive Claude Code skill for Svelte 5's runes-based reactivity system. This skill provides AI assistants with patterns, best practices, and complete examples for all Svelte 5 runes.
This skill helps AI assistants write correct Svelte 5 code using:
cd ~/.claude/skills/
git clone https://github.com/wiesson/svelte-5-runes
Create the directory:
mkdir -p ~/.claude/skills/svelte-5-runes
Download the skill files from this repository
Place them in ~/.claude/skills/svelte-5-runes/
The skill should automatically activate when working with Svelte 5 projects or when code contains runes syntax ($state, $derived, etc.).
svelte-5-runes/
├── SKILL.md # Main entry point for AI (~450 lines)
├── README.md # This file (for humans)
└── references/
├── quick-reference.md # All runes syntax at a glance
├── state.md # $state deep dive
├── derived.md # $derived patterns
├── effect.md # $effect and side effects
├── props.md # $props and component API
└── other-runes.md # $bindable, $inspect, $host
$derived, not $effect for computed values$state - Including deep/raw/snapshot/eager$derived - Including $derived.by and dependencies$effect - Including pre/tracking/pending/root$props - Including destructuring, defaults, rest props$bindable - Two-way binding patterns$inspect - Including .with() and .trace()$host - Custom element integration$props.id() - Component-scoped IDsThis skill is designed for Claude Code. The main content is in SKILL.md, organized as:
This skill assumes:
| Svelte 4 | Svelte 5 |
|---|---|
let count = 0 |
let count = $state(0) |
$: doubled = count * 2 |
let doubled = $derived(count * 2) |
$: console.log(count) |
$effect(() => console.log(count)) |
export let name |
let { name } = $props() |
export let value (bindable) |
let { value = $bindable() } = $props() |
createEventDispatcher() |
Callback props or $host() |
Contributions welcome! Please ensure:
Q: When should I use $effect vs $derived?
A: Use $derived for computed values. Use $effect only for side effects (DOM, APIs, analytics).
Q: Why isn't my effect tracking a dependency?
A: Dependencies must be read synchronously. Code after await won't track.
Q: Can I export $state from a module?
A: Only if you don't reassign it. Export an object with $state properties, or use getter functions.
Q: How do I migrate from Svelte 4? A: See the Migration section in SKILL.md and the official Svelte 5 migration guide.
MIT License - See LICENSE file for details
Based on official Svelte 5 documentation from https://svelte.dev/docs/svelte
Special thanks to the Svelte team for creating an excellent reactivity system.