svelte-core-bestpractices

Guides developers in applying Svelte 5 rune usage and component patterns for code reviews and rewrites.

1|Updated May 13, 2026
One-click install
npx skills add https://github.com/impact-initiatives/ana_app --skill svelte-core-bestpractices-impact-initiatives
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: svelte-core-bestpractices
Source: https://github.com/impact-initiatives/ana_app/tree/main/.claude/skills/svelte-core-bestpractices
Command: npx skills add https://github.com/impact-initiatives/ana_app --skill svelte-core-bestpractices-impact-initiatives

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Helps you avoid common performance and correctness pitfalls when building Svelte components by explaining how to use Svelte 5 runes and modern patterns correctly.

Core Features & Use Cases

  • Correct reactive state management: Use $state for reactive updates, $state.raw for large immutable objects, and apply $derived instead of effects for computations.
  • Effect discipline and debugging: Prefer event handlers and attachments over $effect for synchronization, and use $inspect.trace to diagnose reactivity issues.
  • Modern component authoring guidance: Use $props, keyed {#each} blocks, snippets ({#snippet ...} and {@render ...}), and recommended styling/context patterns.
  • Performance-focused UI patterns: Guidance for using context, avoiding legacy features, and integrating child styling via CSS custom properties.

Quick Start

Load the svelte-core-bestpractices skill when you need to review a Svelte component and rewrite it using runes-based reactivity best practices.

Frequently Asked Questions about svelte-core-bestpractices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use Svelte 5 runes for reactive state management?

Svelte 5 runes provide reactive state management through $state for updates, $state.raw for large immutable objects, and $derived for computations. Apply these runes instead of legacy reactivity patterns to ensure fast and robust component behavior.

When should I use $effect vs event handlers in Svelte components?

Use $effect sparingly for synchronization in Svelte components. Prefer event handlers and attachments over $effect to maintain reactivity discipline, and apply $inspect.trace to diagnose complex reactivity issues during debugging.

What is the best way to handle props and snippets in Svelte 5?

The best way to handle Svelte 5 component authoring is using $props for inputs and snippets with {#snippet ...} and {@render ...} for content composition. Combine these with keyed {#each} blocks for optimal rendering performance.

How do I debug reactivity issues with $inspect in Svelte?

Debug Svelte reactivity issues using $inspect.trace to diagnose state and derived value updates. This traces reactive dependencies without requiring unsafe patterns, helping identify performance bottlenecks in component effects.

Does Svelte 5 work with TypeScript for component patterns?

Yes, Svelte 5 supports TypeScript for component patterns. Apply rune rules for $state, $derived, and $effect alongside TypeScript typing to write fast, robust components with context, attachments, and modern styling.

Why should I avoid legacy Svelte features when refactoring components?

Avoid legacy Svelte features when refactoring to prevent performance and correctness pitfalls. Modern runes enforce safer reactivity rules, replacing outdated patterns with $state, $derived, and snippets for optimal component structure.