Svelte Core Bestpractices
Opinionated Svelte 5 guidance that steers components toward runes, derived state, and modern event and snippet patterns.
- CCM score
- 78 of 100
- skills.sh installs
- 12.8K
- GitHub stars
- 344
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers reactivity, events, snippets, keyed each blocks, styling child components, context, and async Svelte
- Includes rules for
$stateversus$state.raw,$derivedversus$effect, and{@attach}versususe:action - Enforces runes mode for new code and flags legacy syntax such as
export let,$:,<slot>, andon:click - Designed for developers writing or reviewing Svelte components and modules inside an existing Svelte project
Install
$ npx -y skills add sveltejs/ai-tools --skill svelte-core-bestpractices -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
$state
Only use the $state rune for variables that should be reactive — in other words, variables that cause an $effect, $derived or template expression to update. Everything else can be a normal variable.
Objects and arrays ($state({...}) or $state([...])) are made deeply reactive, meaning mutation will trigger updates. This has a trade-off: in exchange for fine-grained reactivity, the objects must be proxied, which has performance overhead. In cases where you're dealing with large objects that are only ever reassigned (rather than mutated), use $state.raw instead. This is often the case with API responses, for example.
$derived
To compute something from state, use $derived rather than $effect:
// do this
let square = $derived(num * num);
// don't do this
let square;
$effect(() => {
square = num * num;
});
[!NOTE]
$derivedis given an expression, not a function. If you need to use a function (because the expression is complex, for example) use$derived.by.
Deriveds are writable — you can assign to them, just like $state, except that they will re-evaluate when their expression changes.
Details
- Repository
- github.com/sveltejs/ai-tools
- Categories
- Frontend & UI Code, Code Review & Quality
- First seen
- Apr 16, 2026
More from sveltejs/ai-tools
All 2Similar to Svelte Core Bestpractices
More Frontend & UI Codesvelte-runesspences10/svelte-skills-kit1.1K installsSvelte 5 runes guidance that picks the right rune for state, props, effects, or Svelte 4 migration.
sveltemindrally/skills806 installsExpert Svelte 5 and SvelteKit guidance covering runes, snippets, SSR, and migration from Svelte 4.
svelte-developmentmanutej/luxor-claude-marketplace438 installsSvelte 5 skill covering runes, components, stores, lifecycle, and transitions with compile-time reactivity.
vue-best-practicesvuejs-ai/skills46.6K installsVue 3 guidance that enforces Composition API with <script setup> and TypeScript for every Vue task.
react-best-practicesalleneubank/claude-code3.2K installsDecision-tree guide for React components that steers logic away from unnecessary Effects toward render, events, and refs.