Automated summary
This skill guides writing and reviewing Svelte 5 and SvelteKit code by enforcing runes, modern component patterns, and routing conventions.
Strengths
- Clearly mandates Svelte 5 runes and explicitly lists legacy APIs to avoid
- Provides concrete examples for the createX() composable pattern and Symbol-based context pattern
- Covers component architecture alongside SvelteKit routing and testing
- Includes precise reactivity rules for $state, $derived, $effect, $props, and $bindable
Limitations
- Assumes an existing Svelte 5 setup and does not address migrating from Svelte 4
- Testing guidance is brief and lacks code examples
Use this skill when writing or reviewing Svelte 5 or SvelteKit code and you want to avoid outdated patterns.
Do not use it for Svelte 3 or 4 projects where runes and callback props are unavailable.
Security analysis
SafeThe skill is a pure documentation/guidance file with code examples and no declared tools or execution instructions. It does not request secrets, network calls, file deletion, shell commands, or any destructive behavior.
No concerns found
How this analysis is madeExamples
Write a Svelte 5 component for a toggleable settings panel using $state, $derived, and $props with TypeScript types.Refactor this Svelte component to Svelte 5 runes: replace export let with $props(), $: with $derived, and on:click with onclick.Extract the counter logic from this component into a createCounter() composable in a .svelte.ts file with readonly getters.name: svelte-best-practices description: Svelte 5 runes, component patterns, stores, transitions, and SvelteKit routing. Use when writing or reviewing Svelte code.
Svelte 5 Best Practices
Runes Only
Svelte 5 uses runes. No legacy patterns.
Use: $state, $derived, $effect, $props, $bindable
Don't use: export let, $:, on:click, writable, readable, derived
<!-- Correct -->
<script lang="ts">
let count = $state(0);
let doubled = $derived(count * 2);
function increment() {
count++;
}
</script>
<button onclick={increment}>{doubled}</button>
Component Architecture
- One component per file
- Props via
$props()with TypeScript types - Events via callback props (not
createEventDispatcher) - Slots via
{@render children()} - Reactive declarations via
$derived, not$:
Composable Pattern (createX())
All stateful logic lives in .svelte.ts files using the createX() pattern:
export function createCounter(initial = 0) {
let count = $state(initial);
let doubled = $derived(count * 2);
return {
get count() { return count; },
get doubled() { return doubled; },
increment() { count++; },
reset() { count = initial; },
};
}
Key rules:
- Return readonly getters for state
- Keep state private inside the closure
- Export types alongside the function
- Use
.svelte.tsextension for files containing runes
Context Pattern
Shared state uses Symbol keys with centralized factories:
// sidebar-context.svelte.ts
const SidebarContext = Symbol('sidebar');
export function setSidebar(state: SidebarState) {
setContext(SidebarContext, state);
}
export function getSidebar(): SidebarState {
return getContext(SidebarContext);
}
Reactivity Rules
$statefor mutable reactive state$derivedfor computed values (never assign)$effectfor side effects (return cleanup function)$effect.prefor effects that need to run before DOM update$props()for component inputs$bindable()for two-way binding props
SvelteKit Conventions
+page.sveltefor routes+layout.sveltefor shared layout+page.server.tsfor server-side data loading+error.sveltefor error boundaries- Use
goto()for programmatic navigation - Use
invalidateAll()to refresh data
Testing
@testing-library/sveltefor component testsvitestfor unit tests- Test user interactions, not implementation details
- Mock external dependencies (API calls, stores)
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/svelte-5-best-practices-mrwakfqc/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/svelte-5-best-practices-mrwakfqc' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/svelte-5-best-practices-mrwakfqc/download' --output '.skill-downloads/svelte-5-best-practices-mrwakfqc/SKILL.md.part' && mv '.skill-downloads/svelte-5-best-practices-mrwakfqc/SKILL.md.part' '.skill-downloads/svelte-5-best-practices-mrwakfqc/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/svelte-5-best-practices-mrwakfqc/SKILL.md' && test -s '.skill-downloads/svelte-5-best-practices-mrwakfqc/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/svelte-best-practices' && cp -R '.skill-downloads/svelte-5-best-practices-mrwakfqc' '.claude/skills/svelte-best-practices'Cursor
test -f '.skill-downloads/svelte-5-best-practices-mrwakfqc/SKILL.md' && test -s '.skill-downloads/svelte-5-best-practices-mrwakfqc/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/svelte-best-practices' && cp -R '.skill-downloads/svelte-5-best-practices-mrwakfqc' '.cursor/skills/svelte-best-practices'Codex
test -f '.skill-downloads/svelte-5-best-practices-mrwakfqc/SKILL.md' && test -s '.skill-downloads/svelte-5-best-practices-mrwakfqc/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/svelte-best-practices' && cp -R '.skill-downloads/svelte-5-best-practices-mrwakfqc' '.agents/skills/svelte-best-practices'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/svelte-5-best-practices-mrwakfqc'openskills read 'svelte-5-best-practices-mrwakfqc'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/svelte-5-best-practices-mrwakfqc/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.