Rule
0 installs · 0 said it worked
Cursor rules for migrating Svelte 4 code to Svelte 5 runes
A .cursorrules file that tells Cursor how to write Svelte 5 code instead of Svelte 4, covering runes, standard event attributes, snippets, and removed event modifiers.
People use this for
- svelte 5 migration rules
- cursor rules svelte 5
- svelte 4 to 5 upgrade
- how do i convert svelte 4 components to svelte 5 runes
- write svelte 5 code instead of svelte 4 syntax
- Name
cursor-rules-for-migrating-svelte-4-code-to-svelte-5-runes- Works with
- Cursor
- License
- CC0(as observed at the source)
- Version
- v1 · updated Nov 29, 2026
Imported on Nov 29, 2026 from github.com . License observed at the source on Nov 29, 2026: CC0.
Are you the author?Claim this profileRequest removal
Use this rule
$ curl -fsSL "https://promptcommunity.dev/api/v1/posts/cursor-rules-for-migrating-svelte-4-code-to-svelte-5-runes-w9xp/export/mdc" -o .cursor/rules/cursor-rules-for-migrating-svelte-4-code-to-svelte-5-runes.mdcThen open a new session; Cursor picks it up from .cursor/rules/.
Manual install
Save cursor-rules-for-migrating-svelte-4-code-to-svelte-5-runes.mdc as .cursor/rules/cursor-rules-for-migrating-svelte-4-code-to-svelte-5-runes.mdc for this project or ~/.cursor/rules/cursor-rules-for-migrating-svelte-4-code-to-svelte-5-runes.mdc for every project, then start a new session.
Rule
description: "Cursor rules for comparing Svelte 5 and Svelte 4 development." globs: */ alwaysApply: false
I'm using svelte 5 instead of svelte 4 here is an overview of the changes.
.cursorrules 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):
<script>
let count = 0;
$: double = count * 2;
$: {
if (count > 10) alert('Too high!');
}
</script>
<button on:click={() => count++}> {count} / {double}</button>
After (Svelte 5):
<script>
// 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:
Reactivity is Explicit:
- Svelte 5 uses
$state()to explicitly mark reactive variables $derived()replaces$:for computed values$effect()replaces$: {}blocks for side effects
- Svelte 5 uses
Event Handling is Standardized:
- Svelte 4:
on:click={handler} - Svelte 5:
onclick={handler}
- Svelte 4:
Runes are Compiler Syntax:
- Do not import
$state,$derived,$effect,$props,$bindable, or$inspect. - Import only regular Svelte utilities that require imports, such as
tick,untrack,mount, orunmount.
- Do not import
No More Event Modifiers:
- Svelte 4:
on:click|preventDefault={handler} - Svelte 5:
onclick={e => { e.preventDefault(); handler(e); }}
- Svelte 4:
This creates clearer, more maintainable components compared to Svelte 4's previous syntax by making reactivity explicit and using standardized web platform features.
No result recorded yet. Added it? File a Tried-it report so the next person knows how it went in your editor.
Tried it
Reports from people who added this rule to their editor. They roll up into the badges above.
No one has filed a report yet. Try the prompt and be the first.
Related rules
- Claude api: reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming,…
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any fo
Coding · @anthropic
- Cursor rules enforcing clean, readable, maintainable code practices
A Cursor .mdc rule file that guides the assistant toward clean code: named constants, meaningful names, sparing comments, single-purpose functions, DRY, language style standards, extracted conditionals, continuous refactoring, and version control.
Coding · @patrickjs
- Git repository bloat finder: diagnose large files and suggest safe cleanup
Agent skill that measures a Git repository, scans reachable blobs for large, deleted, versioned, generated and credential-like files, and proposes least-disruptive fixes without rewriting history itself.
Coding · @f
- Go backend coding spec for vertical domain modules using shanjunmei/dig
A system-prompt skill that makes the model act as a Go architect and generate or repair code with vertical domain modules, viper config loading, minimal naming, and a unified RegisterRoute handler method for shanjunmei/dig compile-time DI.
Coding · @shanjunmei
- Autonomous coding agent that builds a verified app-builder harness
Master system prompt that directs an autonomous senior Python engineer to build a spec-driven, evidence-traced app-builder harness milestone by milestone without asking questions.
Coding · @mahfuzahmedog
License: CC0v1 · published Nov 29, 2026
Comments
No comments yet. If you tried this prompt, say how it went.