svelte5-gotchas

Identify and resolve Svelte 5 runes syntax issues in .svelte and .svelte.ts files.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Vonshlovens/vonshlovens --skill svelte5-gotchas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: svelte5-gotchas
Source: https://github.com/Vonshlovens/vonshlovens/tree/main/.claude/skills/svelte5-gotchas
Command: npx skills add https://github.com/Vonshlovens/vonshlovens --skill svelte5-gotchas

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Svelte 5 runes introduce new patterns and gotchas that can cause runtime errors and drift from Svelte 4 habits. This guide helps developers adopt the correct runes-based syntax, avoid common traps, and maintain consistent practices across .svelte and .svelte.ts files.

Core Features & Use Cases

  • Guidance on adopting Svelte 5 runes syntax and avoiding deprecated patterns.
  • Examples addressing common issues including svelte:component deprecation, {@const} placement rules, and the requirement that runes work in .svelte.ts extensions.
  • Migration tips from Svelte 4 to Svelte 5 with real-world scenarios such as dynamic components and reactive state without $state wrappers.

Quick Start

Load this guide when editing .svelte or .svelte.ts files to avoid runes-related errors and ensure correct usage.

Frequently Asked Questions about svelte5-gotchas

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

FAQPage Schema
Why does $state is not defined error occur in Svelte 5?

The $state is not defined error in Svelte 5 occurs when runes are used in unsupported file types or when migrating Svelte 4 patterns incorrectly. Runes must be used within .svelte or .svelte.ts files to ensure proper compilation and state management.

How do I migrate dynamic components from Svelte 4 to Svelte 5?

To migrate dynamic components from Svelte 4 to Svelte 5, replace the deprecated <svelte:component> tag with direct component instantiation syntax. This ensures compatibility with Svelte 5 features and avoids deprecation warnings during the migration process.

Can I use Svelte 5 runes in regular TypeScript files?

You can use Svelte 5 runes in TypeScript files only if the file uses the .svelte.ts extension. Standard .ts files do not support runes, which will cause runtime errors when attempting to use reactive state wrappers.

What are the {@const} placement rules in Svelte 5?

In Svelte 5, {@const} tags must be placed as direct children of specific block types like {#if}, {#each}, or component tags. Placing {@const} incorrectly outside these blocks causes syntax issues and breaks the runes compilation process.

What is the best way to avoid deprecated patterns when migrating to Svelte 5?

The best way to avoid deprecated patterns during Svelte 5 migration is to adopt runes-based syntax consistently. Replace Svelte 4 reactive declarations and ensure all reactive state uses $state wrappers correctly across .svelte files.

Does Svelte 5 still support Svelte 4 reactive syntax?

Svelte 5 supports Svelte 4 reactive syntax in legacy mode, but mixing it with runes causes drift and runtime errors. Migrating fully to runes-based syntax is required to maintain compatibility and avoid deprecated pattern warnings.