Cursor Rules

svelte 5 vs svelte 4 - Claude MCP Skill

I'm using svelte 5 instead of svelte 4 here is an overview of the changes.

SEO Guide: Enhance your AI agent with the svelte 5 vs svelte 4 tool. This Model Context Protocol (MCP) server allows Claude Desktop and other LLMs to i'm using svelte 5 instead of svelte 4 here is an overview of the changes.... Download and configure this skill to unlock new capabilities for your AI workflow.

🌟204 stars • 3372 forks
📥0 downloads

Documentation

SKILL.md
I'm using svelte 5 instead of svelte 4 here is an overview of the changes.
# .cursorrunes for Svelte 5

## Overview of Changes

Svelte 5 introduces runes, a set of advanced primitives for controlling reactivity. The runes replace certain non-runes features and provide more explicit control over state and effects.

Snippets, along with render tags, help create reusable chunks of markup inside your components, reducing duplication and enhancing maintainability.

## Event Handlers in Svelte 5

In Svelte 5, event handlers are treated as standard HTML properties rather than Svelte-specific directives, simplifying their use and integrating them more closely with the rest of the properties in the component.

### Svelte 4 vs. Svelte 5:

**Before (Svelte 4):**
```html
<script>
  let count = 0;
  $: double = count * 2;
  $: {
    if (count > 10) alert('Too high!');
  }
</script>
<button on:click={() => count++}> {count} / {double}</button>
```

**After (Svelte 5):**
```html
<script>
  import { $state, $effect, $derived } from 'svelte';
  
  // Define state with runes
  let count = $state(0);
  
  // Option 1: Using $derived for computed values
  let double = $derived(count * 2);
  
  // Reactive effects using runes
  $effect(() => {
    if (count > 10) alert('Too high!');
  });
</script>

<!-- Standard HTML event attributes instead of Svelte directives -->
<button onclick={() => count++}>
  {count} / {double}
</button>

<!-- Alternatively, you can compute values inline -->
<!-- <button onclick={() => count++}>
  {count} / {count * 2}
</button> -->
```

## Key Differences:

1. **Reactivity is Explicit**: 
   - Svelte 5 uses `$state()` to explicitly mark reactive variables
   - `$derived()` replaces `$:` for computed values 
   - `$effect()` replaces `$: {}` blocks for side effects

2. **Event Handling is Standardized**:
   - Svelte 4: `on:click={handler}`
   - Svelte 5: `onclick={handler}`

3. **Import Runes**: 
   - All runes must be imported from 'svelte': `import { $state, $effect, $derived, $props, $slots } from 'svelte';`

4. **No More Event Modifiers**:
   - Svelte 4: `on:click|preventDefault={handler}`
   - Svelte 5: `onclick={e => { e.preventDefault(); handler(e); }}`

This creates clearer, more maintainable components compared to Svelte 4's previous syntax by making reactivity explicit and using standardized web platform features.

Signals

Avg rating0.0
Reviews0
Favorites0

Information

Repository
PatrickJS/awesome-cursorrules
Author
PatrickJS
Last Sync
5/12/2026
Repo Updated
5/12/2026
Created
1/14/2026

Reviews (0)

No reviews yet. Be the first to review this skill!

Related Skills

firecrawl-build-search

Integrate Firecrawl `/search` into product code and agent workflows. Use when an app needs discovery before extraction, when the feature starts with a query instead of a URL, or when the system should search the web and optionally hydrate result content.

35092

firecrawl-build-onboarding

Get Firecrawl credentials and SDK setup into a project. Use when an application needs `FIRECRAWL_API_KEY`, when an agent should add Firecrawl to `.env`, when the user wants to authenticate Firecrawl for app code, or when choosing the first SDK and docs for a new Firecrawl integration. This skill includes its own browser auth flow, so it does not depend on the website onboarding skill.

35092

firecrawl-build

Integrate Firecrawl into application code whenever a product, agent, or workflow needs web data inside the app — web search, live search results, page scraping, structured extraction, or browser interaction. Use when building any feature that needs data from the web in code, even if the user does not mention Firecrawl explicitly and only describes wanting web data, website content, search, scraping, or interaction in an application. Trigger for Firecrawl requests, "fire girl" shorthand, and generic app-level web-data needs that should map to `/scrape`, `/search`, or `/interact`. Do not use this skill for one-off terminal-only web tasks during the current session; use `firecrawl/cli` for those.

35092

firecrawl-build-interact

Integrate Firecrawl `/interact` into product code for dynamic pages and browser actions after scraping. Use when a feature needs clicks, form fills, pagination, authentication-aware flows, or other multi-step interactions that plain `/scrape` cannot complete.

35092

Related Guides