svelte5-best-practices
This skill guides agents through Svelte 5 development with reference materials on runes, snippets, SvelteKit patterns, and TypeScript usage.
Community author
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, claude.ai and API
- License
- MIT (permissive)
- Pin
- 6e805e4pinned Oct 9, 2026
- Context cost
- about 550 tokenswhen the skill loads
- GitHub stars
- 6on ejirocodes/agent-skills
- Scripts
- None found
What it does
“Svelte 5 runes, snippets, SvelteKit patterns, and modern best practices for TypeScript and component development. Use when writing, reviewing, or refactoring Svelte 5 components and SvelteKit applications. Triggers on: Svelte components, runes ($state, $derived, $effect, $props, $bindable, $inspect), snippets ({#snippet}, {@render}), event handling, SvelteKit data loading, form actions, Svelte 4 to Svelte 5 migration, store to rune migration, slots to snippets migration, TypeScript props typing, generic components, SSR state isolation, performance optimization, or component testing.”
Generated summary from the skill's own text
This skill guides agents through Svelte 5 development with reference materials on runes, snippets, SvelteKit patterns, and TypeScript usage. It covers reactive state management, component props, event handling, migration from Svelte 4, and performance optimization techniques. The skill includes common mistakes to avoid when writing or refactoring Svelte components and applications.
When to use it
- Writing or reviewing Svelte 5 components with runes and snippets
- Migrating projects from Svelte 4 to Svelte 5 or stores to runes
- Building SvelteKit applications with load functions and form actions
- Implementing TypeScript typing for generic components and props
When not to
- Projects using Svelte versions prior to version 5
- Applications not using Svelte or SvelteKit frameworks
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add ejirocodes/agent-skills --skill svelte5-best-practicesInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install ejirocodes/agent-skills svelte5-best-practices@6e805e4cc8a4378444c791d4a08e304347152bd0Installs the commit we checked (6e805e4).
Copy by hand
Download the folder at 6e805e4 and put it in .claude/skills/svelte5-best-practices for Claude Code and in .agents/skills/svelte5-best-practices for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "svelte5-best-practices" by ejirocodes. Source, pinned to commit 6e805e4cc8a4378444c791d4a08e304347152bd0: https://github.com/ejirocodes/agent-skills/tree/6e805e4cc8a4378444c791d4a08e304347152bd0/svelte/skills/svelte5-best-practices 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/svelte5-best-practices/ for Claude Code and .agents/skills/svelte5-best-practices/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/ejirocodes/svelte5-best-practices
SKILL.md at the pin
---
name: svelte5-best-practices
description: "Svelte 5 runes, snippets, SvelteKit patterns, and modern best practices for TypeScript and component development. Use when writing, reviewing, or refactoring Svelte 5 components and SvelteKit applications. Triggers on: Svelte components, runes ($state, $derived, $effect, $props, $bindable, $inspect), snippets ({#snippet}, {@render}), event handling, SvelteKit data loading, form actions, Svelte 4 to Svelte 5 migration, store to rune migration, slots to snippets migration, TypeScript props typing, generic components, SSR state isolation, performance optimization, or component testing."
license: MIT
metadata:
author: ejirocodes
version: '1.0.0'
---
# Svelte 5 Best Practices
## Quick Reference
| Topic | When to Use | Reference |
|-------|-------------|-----------|
| **Runes** | $state, $derived, $effect, $props, $bindable, $inspect | [runes.md](references/runes.md) |
| **Snippets** | Replacing slots, {#snippet}, {@render} | [snippets.md](references/snippets.md) |
| **Events** | onclick handlers, callback props, context API | [events.md](references/events.md) |
| **TypeScript** | Props typing, generic components | [typescript.md](references/typescript.md) |
| **Migration** | Svelte 4 to 5, stores to runes | [migration.md](references/migration.md) |
| **SvelteKit** | Load functions, form actions, SSR, page typing | [sveltekit.md](references/sveltekit.md) |
| **Performance** | Universal reactivity, avoiding over-reactivity, streaming | [performance.md](references/performance.md) |
## Essential Patterns
### Reactive State
```svelte
<script>
let count = $state(0); // Reactive state
let doubled = $derived(count * 2); // Computed value
</script>
```
### Component Props
```svelte
<script>
let { name, count = 0 } = $props();
let { value = $bindable() } = $props(); // Two-way binding
</script>
```
### Snippets (replacing slots)
```svelte
<script>
let { children, header } = $props();
</script>
{@render header?.()}
{@render children()}
```
### Event Handlers
```svelte
<!-- Svelte 5: use onclick, not on:click -->
<button onclick={() => count++}>Click</button>
```
### Callback Props (replacing createEventDispatcher)
```svelte
<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
From ejirocodes/agent-skills at 6e805e4, shown as plain text under its license: MIT (permissive). The license text is in svelte/skills/svelte5-best-practices/SKILL.md.
View SKILL.md on GitHub at 6e805e4Files
- SKILL.md2.9 KB · eeb2be3e3208
- references/
- events.md7.1 KB · c311631df6f8
- migration.md6.8 KB · c2c574ce8290
- performance.md10.0 KB · ee1ddf521fd3
- runes.md7.1 KB · 9c7b6330607a
- snippets.md4.8 KB · db5aaac052b2
- sveltekit.md8.7 KB · d1c519d8d372
- typescript.md6.5 KB · e9c9914be0bc
8 files, 54 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at 6e805e4Related in Frontend and design
crxjs
CRXJS is a Vite plugin for Chrome extension development that provides true hot-module reloading for popups, options pages, content scripts, and side panels.
by samberCommunity
Claude Code · about 2.3K tokens · pinned 7 days ago
remotion-saas
This skill helps build video generation applications using Remotion, a React framework for programmatic video creation.
by RemotionOfficial publisher
Claude Code, Codex, Cursor +3 · about 240 tokens · pinned 7 days ago
stitch::extract-design-md
Extracts a comprehensive design system document (DESIGN.md) by analyzing frontend source code including component files, stylesheets, Tailwind configs, and…
by GoogleOfficial publisher
Claude Code, Codex, Cursor +4 · about 3.3K tokens · pinned 7 days ago
genpage
Creates, updates, and deploys generative pages in Microsoft Power Apps model-driven apps using React 17, TypeScript, and Fluent UI V9.
by MicrosoftOfficial publisher
Claude Code · about 16.1K tokens · pinned 7 days ago
react-best-practices
This skill reviews React and TSX components against 70 best-practice rules organized by performance impact, checking for issues in async patterns, bundle…
by VercelOfficial publisher
Claude Code, Codex, Cursor +3 · about 1.7K tokens · pinned 7 days ago
portable-text-serialization
This skill enables rendering Portable Text content across multiple frameworks and output formats using the @portabletext library family.
by SanityOfficial publisher
Claude Code, Codex, Cursor +4 · about 940 tokens · pinned 7 days ago