Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
ejirocodes avatar

Svelte5 Best Practices

  • 5k installs
  • 5 repo stars
  • Updated June 25, 2026
  • ejirocodes/agent-skills

svelte5-best-practices covers Svelte 5 runes, snippets, events, TypeScript, SvelteKit, migration, and performance patterns.

About

The svelte5-best-practices skill guides writing and reviewing Svelte 5 components and SvelteKit applications with modern runes, snippets, and event patterns. Quick reference links cover runes, snippets, events, TypeScript, migration, SvelteKit, and performance reference files. Essential patterns show $state and $derived reactivity, $props and $bindable for two-way binding, snippets with render replacing slots, onclick instead of on:click, and callback props replacing createEventDispatcher. Common mistakes list using let without $state, $effect for derived values, deprecated on:click and createEventDispatcher, slot instead of snippets, missing $bindable, module-level SSR state leaks, and sequential awaits in load functions instead of Promise.all. Triggers include Svelte components, runes like $state $derived $effect $props, snippets, SvelteKit load and form actions, Svelte 4 to 5 migration, and performance optimization. Progressive disclosure via references for deep dives on runes, snippets, events, typescript, migration, sveltekit, and performance topics.

  • Svelte 5 runes: $state, $derived, $effect, $props, $bindable, $inspect patterns.
  • Snippets replace slots with {#snippet} and {@render} syntax.
  • Events use onclick; callback props replace createEventDispatcher.
  • Eight common mistakes including SSR state leaks and sequential load awaits.
  • Reference files for runes, snippets, SvelteKit, migration, and performance.

Svelte5 Best Practices by the numbers

  • 5,028 all-time installs (skills.sh)
  • +189 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #104 of 2,245 Frontend Development skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

svelte5-best-practices capabilities & compatibility

Capabilities
runes reactive state and derived patterns · snippet based composition replacing slots · callback props event handling · sveltekit load and form action guidance · migration and performance reference routing
Use cases
frontend · refactoring
From the docs

What svelte5-best-practices says it does

Use when writing, reviewing, or refactoring Svelte 5 components and SvelteKit applications.
SKILL.md
npx skills add https://github.com/ejirocodes/agent-skills --skill svelte5-best-practices

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs5k
repo stars5
Security audit3 / 3 scanners passed
Last updatedJune 25, 2026
Repositoryejirocodes/agent-skills

How do I write correct Svelte 5 components with runes, snippets, and SvelteKit best practices?

Apply Svelte 5 runes, snippets, events, TypeScript props, SvelteKit data loading, migration, and performance patterns.

Who is it for?

Frontend developers building or migrating to Svelte 5 and SvelteKit with TypeScript.

Skip if: Skip when the project remains on Svelte 4 without migration plans and no Svelte 5 runes.

When should I use this skill?

User writes Svelte 5 components, mentions runes, snippets, SvelteKit load, or Svelte 4 migration.

What you get

Svelte 5 components using runes, snippets, callback props, and SvelteKit patterns without common migration pitfalls.

  • Svelte 5 component patterns
  • Migration guidance references
  • SvelteKit load optimizations

By the numbers

  • 8 documented common mistakes
  • 7 reference topic files
  • onclick replaces on:click in Svelte 5

Files

SKILL.mdMarkdownGitHub ↗

Svelte 5 Best Practices

Quick Reference

TopicWhen to UseReference
Runes$state, $derived, $effect, $props, $bindable, $inspectrunes.md
SnippetsReplacing slots, {#snippet}, {@render}snippets.md
Eventsonclick handlers, callback props, context APIevents.md
TypeScriptProps typing, generic componentstypescript.md
MigrationSvelte 4 to 5, stores to runesmigration.md
SvelteKitLoad functions, form actions, SSR, page typingsveltekit.md
PerformanceUniversal reactivity, avoiding over-reactivity, streamingperformance.md

Essential Patterns

Reactive State

<script>
  let count = $state(0);           // Reactive state
  let doubled = $derived(count * 2); // Computed value
</script>

Component Props

<script>
  let { name, count = 0 } = $props();
  let { value = $bindable() } = $props(); // Two-way binding
</script>

Snippets (replacing slots)

<script>
  let { children, header } = $props();
</script>

{@render header?.()}
{@render children()}

Event Handlers

<!-- Svelte 5: use onclick, not on:click -->
<button onclick={() => count++}>Click</button>

Callback Props (replacing createEventDispatcher)

<script>
  let { onclick } = $props();
</script>

<button onclick={() => onclick?.({ data })}>Click</button>

Common Mistakes

1. Using `let` without `$state` - Variables are not reactive without $state() 2. Using `$effect` for derived values - Use $derived instead 3. Using `on:click` syntax - Use onclick in Svelte 5 4. Using `createEventDispatcher` - Use callback props instead 5. Using `<slot>` - Use snippets with {@render} 6. Forgetting `$bindable()` - Required for bind: to work 7. Setting module-level state in SSR - Causes cross-request leaks 8. Sequential awaits in load functions - Use Promise.all for parallel requests

Related skills

How it compares

svelte5-best-practices covers Svelte 5 runes and SvelteKit, not generic React or Vue patterns.

FAQ

Who is svelte5-best-practices for?

Frontend developers writing or reviewing Svelte 5 components and SvelteKit applications.

When should I use svelte5-best-practices?

When using runes, migrating from Svelte 4, implementing snippets, or optimizing SvelteKit load functions.

Is svelte5-best-practices safe to install?

Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.