Home/前端开发/svelte-runes
S

svelte-runes

by @spences10v
4.8(27)

Provides a quick start guide for Svelte Runes, covering core concepts like $props, $bindable, $derived, $effect, and $state.

Svelte 5Svelte RunesFrontend DevelopmentReactive ProgrammingJavaScript FrameworksGitHub
Installation
npx skills add spences10/svelte-skills-kit --skill svelte-runes
compare_arrows

Before / After Comparison

1
Before

In Svelte 4 or earlier versions, managing component state and reactive logic required relying on `$:` declarations or custom stores. For complex state flows, the code could become verbose and difficult to understand.

After

With Svelte 5's `Runes` (e.g., `$state()`, `$bindable()`, `$derived()`, `$effect()`), reactive state can be managed in a more intuitive and fine-grained manner. This simplifies state management code, improves development efficiency, and makes component logic clearer.

description SKILL.md

svelte-runes

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

For @attach and other template directives, see the svelte-template-directives skill.

Notes

  • Use onclick not on:click, {@render children()} in layouts

  • $derived can be reassigned (5.25+) - use const for read-only

  • Use createContext over setContext/getContext for type safety

  • Use $inspect.trace to debug reactivity issues

  • Last verified: 2026-03-12

Weekly Installs241Repositoryspences10/svelt…ills-kitGitHub Stars52First SeenJan 20, 2026Security AuditsGen Agent Trust HubPassSocketPassSnykPassInstalled onopencode195gemini-cli174codex160claude-code158github-copilot156cursor140

forumUser Reviews (0)

Write a Review

Effect
Usability
Docs
Compatibility

No reviews yet

Statistics

Installs676
Rating4.8 / 5.0
Version
Updated2026年3月17日
Comparisons1

User Rating

4.8(27)
5
0%
4
0%
3
0%
2
0%
1
0%

Rate this Skill

0.0

Compatible Platforms

🔧Claude Code
🔧OpenClaw
🔧OpenCode
🔧Codex
🔧Gemini CLI
🔧GitHub Copilot
🔧Amp
🔧Kimi CLI

Timeline

Created2026年3月17日
Last Updated2026年3月17日