svelte-core-bestpractices

Guide Svelte developers to write components using $state, $derived, and $effect.

2|2|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/raiden076/Prism --skill svelte-core-bestpractices-raiden076
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: svelte-core-bestpractices
Source: https://github.com/raiden076/Prism/tree/main/.agents/skills/svelte-core-bestpractices
Command: npx skills add https://github.com/raiden076/Prism --skill svelte-core-bestpractices-raiden076

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Writing Svelte components quickly and robustly can be error-prone due to the framework's reactivity model, event handling quirks, and styling pitfalls. This guide consolidates core patterns to help you write clean, maintainable Svelte code.

Core Features & Use Cases

  • Guidance on using $state for reactive variables and how to balance fine-grained reactivity with performance.
  • Best practices for event handling, CSS scoping, and integrating with common libraries.
  • Use cases include writing new components, refactoring existing ones, and auditing code for reactivity, accessibility, and maintainability.

Quick Start

Load this skill in a Svelte project and apply the best practices to your next component or module.

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 fine-grained reactivity in Svelte components?

Svelte reactivity uses $state for reactive variables and $derived for computed values, balancing fine-grained updates with performance. This guide helps you apply these runes correctly to build fast, maintainable components without common reactivity pitfalls.

What are the best practices for CSS scoping and event handling in Svelte?

Svelte best practices include proper CSS scoping to prevent style leakage and correct event handling patterns to avoid quirks. Following these guidelines ensures your components remain robust and maintainable across complex frontend projects.

How do I balance performance and maintainability when creating Svelte components?

Balancing Svelte performance and maintainability involves using snippet usage, proper reactivity patterns, and careful event handling. This skill audits your code to enforce high-quality, accessible, and robust component design.

Does this Svelte best practices guide work with common frontend libraries?

Yes, these Svelte best practices apply to integrating common libraries within your frontend development workflow. The guidance covers module integration, ensuring your components interact correctly with external dependencies.

When should I use $effect instead of $state in Svelte reactivity?

Svelte reactivity requires $effect for side effects and $state for reactive variables, but misusing them causes performance issues. This guide provides practical patterns to determine the correct rune for your component logic.