Svelte5

Svelte5 is a cursor rule for Cursor from TheSethRose/DevRules. It costs 0 tokens per session (1,054 once invoked), scanned A, original, MIT.

A set of Svelte 5 or newer coding guidelines for building web interfaces. Svelte is a web framework that turns components into JavaScript during the build process.

In plain words
What is it for?
Use it when writing or reviewing .svelte components, managing state with Svelte 5 runes, and organizing reusable interface code.
Why use it?
It provides consistent patterns for component structure, inputs, styles, and reactive state.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when writing or reviewing .svelte components, managing state with Svelte 5 runes, and organizing reusable interface code.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/thesethrose/devrules/svelte5
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/TheSethRose/DevRules

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Svelte5

README.md
[![agentmods](https://agentmods.dev/badge/rules/thesethrose/devrules/svelte5/github.svg)](https://agentmods.dev/rules/thesethrose/devrules/svelte5)
Your own site
<a href="https://agentmods.dev/rules/thesethrose/devrules/svelte5"><img src="https://agentmods.dev/badge/rules/thesethrose/devrules/svelte5/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for Svelte5

Your own site · 80×15
<a href="https://agentmods.dev/rules/thesethrose/devrules/svelte5"><img src="https://agentmods.dev/badge/rules/thesethrose/devrules/svelte5.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,054 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01054
Opus 5.5 $0.00000 $0.00422
Sonnet 5.5 $0.00000 $0.00211
Haiku 4.5 $0.00000 $0.00105

Measured 1mo ago against content hash 45b58d7c04b6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

Svelte5 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/technologies/Svelte5.mdc · 81 lines

How it starts

The opening of the file, as written. The whole thing — 81 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Svelte 5+ Best Practices

Core Principles

  • Compiler as Framework: Understand Svelte compiles your code to small, imperative JavaScript at build time.
  • Reactivity with Runes: Leverage Svelte 5's rune-based reactivity system ($state, $derived, $effect).

Component Structure (.svelte files)

  • Structure: Organize components with <script>, template markup, and <style> sections.
  • Keep Components Focused: Design components with a single, clear responsibility.
  • Props: Define component inputs using export let propName or $props() rune.
    • Use $props() for better explicitness and compatibility with future features.
    • Provide default values for props if applicable (export let count = 0).
  • Slots: Use <slot> elements (default and named) to allow parent components to inject content.
  • Scoped Styles: Styles within <style> are scoped to the component by default.

Reactivity (Runes - Svelte 5+)

  • State Declaration: Use $state() to declare reactive component state.
    <script>
      let count = $state(0);
    </script>
    
  • Derived State: Use $derived() for values computed from other reactive state. Svelte optimizes these derivations.
    <script>
      let count = $state(0);
      let double = $derived(count * 2);
    </script>
    
  • Side Effects: Use $effect() to run code reactively in response to state changes (e.g., logging, data fetching, manual DOM manipulation). Effects automatically track their dependencies.
    <script>
      let count = $state(0);
      $effect(() => {
        console.log('Count changed:', count);
        // Cleanup function (optional)
        return () => console.log('Effect cleanup');
      });
    </script>
    
  • Avoid Top-Level Effects: Prefer $effect within the component instance scope. For module-level effects (rarely needed), use rune variants like $effect.root() with caution.

Templating Syntax

  • Text Interpolation: Use curly braces {expression} to embed JavaScript expressions in text.
  • Attribute Binding: Bind attributes using {attribute} shorthand or attribute={expression}.
  • Event Handling: Use on:eventname to listen for DOM events.
  • Conditional Rendering: Use {#if expression} ... {:else if expression} ... {:else} ... {/if} blocks.
  • List Rendering: Use {#each list as item, index (key)} ... {:else} ... {/each} blocks. Always provide a unique key expression for efficient updates.
  • Await Blocks: Use {#await promise} ... {:then value} ... {:catch error} ... {/await} to handle promises directly in the markup.

Read the full file on GitHub · 81 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 81 lines · 1,054 tokens per session scan A 45b58d7c04b6

Subscribe to this mod's changes

Svelte5 is a cursor rule published in the GitHub repository TheSethRose/DevRules (26 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,054 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.