svelte-core-bestpractices

Guide Svelte component development with $state, $derived, and $effect patterns.

Updated Apr 28, 2026
One-click install
npx skills add https://github.com/tututwo/heather-birthday-itenary --skill svelte-core-bestpractices-tututwo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: svelte-core-bestpractices
Source: https://github.com/tututwo/heather-birthday-itenary/tree/main/.agents/skills/svelte-core-bestpractices
Command: npx skills add https://github.com/tututwo/heather-birthday-itenary --skill svelte-core-bestpractices-tututwo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Guidance on applying core Svelte reactivity, event handling, styling, and library integration to write fast, robust components without common pitfalls.

Core Features & Use Cases

  • Provides explicit guidance on using $state for reactive data and $derived for computed values, reducing boilerplate and bugs.
  • Covers event handling, CSS scoping, and integration patterns to align with Svelte's modern patterns.
  • Use Case: when starting a new Svelte component, audit an existing one, or review a module for best practices.

Quick Start

Consult this skill whenever writing or auditing a Svelte component to apply core reactivity, event handling, and styling 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 $state and $derived for Svelte state management?

Use $state for reactive data and $derived for computed values in Svelte to reduce boilerplate and bugs. This approach ensures consistent use of modern reactive patterns, replacing older, deprecated methods for managing component state.

What's the best way to structure Svelte component events and CSS?

The best way to structure Svelte components is by following modern patterns for event handling and CSS scoping. Applying these specific best practices ensures robust code and avoids common styling and integration pitfalls.

When do I need $effect in Svelte and what are its limitations?

You need $effect in Svelte for side effects, but it requires careful handling to avoid reactivity loops. Following core best practices ensures you apply it correctly and avoid deprecated approaches that cause performance issues.

How do I audit an existing Svelte component for best practices?

To audit an existing Svelte component, review its usage of $state, $derived, $effect, events, and CSS. This ensures alignment with modern Svelte patterns and identifies deprecated approaches that need refactoring.

Does modern Svelte reactivity work with external library integrations?

Modern Svelte reactivity works with external library integrations by applying specific patterns for state and events. Following these integration best practices ensures your components remain fast and robust without introducing common library conflicts.