svelte

svelte is a cursor rule for Cursor from humanspeak/svelte-markdown. It costs 2,208 tokens per session, scanned A, original, MIT.

Rules for writing code with Svelte 5, SvelteKit, TypeScript, and modern web practices. Svelte is a framework for building web interfaces, while SvelteKit adds routing and server-side features.

In plain words
What is it for?
Use them when building Svelte components and routes, choosing server rendering or static generation, and documenting exported component functions.
Why use it?
They keep generated code consistent with the project’s conventions for performance, file organization, and component APIs.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/humanspeak/svelte-markdown/svelte
Clone the repo
git clone --depth 1 https://github.com/humanspeak/svelte-markdown

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 svelte

README.md
[![agentmods](https://agentmods.dev/badge/rules/humanspeak/svelte-markdown/svelte.svg)](https://agentmods.dev/rules/humanspeak/svelte-markdown/svelte)
Your own site
<a href="https://agentmods.dev/rules/humanspeak/svelte-markdown/svelte"><img src="https://agentmods.dev/badge/rules/humanspeak/svelte-markdown/svelte.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,208 This file is loaded in full into every session.
When invoked 2,208 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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 $0.02208 $0.02208
Opus 5 $0.01104 $0.01104
Sonnet 5 $0.00442 $0.00442
Haiku 4.5 $0.00221 $0.00221

Measured 4d ago against content hash 220987f68350, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

svelte 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 4d 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/svelte.mdc · 255 lines

How it starts

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

You are an expert in Svelte 5, SvelteKit, TypeScript, and modern web development.

Key Principles

  • Write concise, technical code with accurate Svelte 5 and SvelteKit examples.
  • Leverage SvelteKit's server-side rendering (SSR) and static site generation (SSG) capabilities.
  • Prioritize performance optimization and minimal JavaScript for optimal user experience.
  • Use descriptive variable names and follow Svelte and SvelteKit conventions.
  • Organize files using SvelteKit's file-based routing system.
  • When exporting functions from Svelte components, always use arrow functions. This ensures lexical this binding, avoids confusion, and is the recommended style for Svelte 5 component APIs.
  • When writing JSDoc for exported functions, always provide a realistic, copy-pastable Svelte usage example. Use the following template for guidance:
/**
 * Scrolls the virtual list to the item at the given index.
 *
 * @function scrollToIndex
 * @param index The index of the item to scroll to.
 * @param smoothScroll (default: true) Whether to use smooth scrolling.
 * @param shouldThrowOnBounds (default: true) Whether to throw an error if the index is out of bounds.
 *
 * @example
 * // Svelte usage example:
 * <script lang="ts">
 *   import SvelteVirtualList from '$lib/index.js';
 *   let virtualList;
 *   const items = Array.from({ length: 10000 }, (_, i) => ({ id: i, text: `Item ${i}` }));
 * </script>
 *
 * <button onclick={() => virtualList.scrollToIndex(5000)}>
 *   Scroll to 5000
 * </button>
 * <div style="height: 500px; border: 1px solid pink; padding: 10px; border-radius: 10px;">
 *   <SvelteVirtualList {items} bind:this={virtualList}>
 *     {#snippet renderItem(item)}
 *       <div>{item.text}</div>
 *     {/snippet}
 *   </SvelteVirtualList>
 * </div>
 *
 * @returns {void}
 * @throws {Error} If the index is out of bounds and shouldThrowOnBounds is true
 */

Code Style and Structure

  • Write concise, technical TypeScript or JavaScript code with accurate examples.
  • Use functional and declarative programming patterns; avoid unnecessary classes except for state machines.
  • Prefer iteration and modularization over code duplication.
  • Structure files: component logic, markup, styles, helpers, types.
  • Follow Svelte's official documentation for setup and configuration: https://svelte.dev/docs

Naming Conventions

  • Use lowercase with hyphens for component files (e.g., components/auth-form.svelte).
  • Use PascalCase for component names in imports and usage.
  • Use camelCase for variables, functions, and props.

TypeScript Usage

  • Use TypeScript for all code; prefer interfaces over types.
  • Avoid enums; use const objects instead.
  • Use functional components with TypeScript interfaces for props.
  • Enable strict mode in TypeScript for better type safety.

Svelte Runes

  • $state: Declare reactive state
    let count = $state(0);
    
  • $derived: Compute derived values
    let doubled = $derived(count * 2);
    
  • $effect: Manage side effects and lifecycle
    $effect(() => {
      console.log(`Count is now ${count}`);
    });
    
  • $props: Declare component props
    let { optionalProp = 42, requiredProp } = $props();
    
  • $bindable: Create two-way bindable props
    let { bindableProp = $bindable() } = $props();
    
  • $inspect: Debug reactive state (development only)
    $inspect(count);
    

UI and Styling

  • Use Tailwind CSS for utility-first styling approach.
  • Leverage Shadcn components for pre-built, customizable UI elements.
  • Import Shadcn components from $lib/components/ui.
  • Organize Tailwind classes using the cn() utility from $lib/utils.
  • Use Svelte's built-in transition and animation features.

Shadcn Color Conventions

  • Use background and foreground convention for colors.
  • Define CSS variables without color space function:
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    
  • Usage example:
    <div class="bg-primary text-primary-foreground">Hello</div>
    
  • Key color variables:
    • --background, --foreground: Default body colors
    • --muted, --muted-foreground: Muted backgrounds
    • --card, --card-foreground: Card backgrounds
    • --popover, --popover-foreground: Popover backgrounds
    • --border: Default border color
    • --input: Input border color
    • --primary, --primary-foreground: Primary button colors
    • --secondary, --secondary-foreground: Secondary button colors
    • --accent, --accent-foreground: Accent colors
    • --destructive, --destructive-foreground: Destructive action colors
    • --ring: Focus ring color
    • --radius: Border radius for components

Read the full file on GitHub · 255 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. 4d ago First seen · 255 lines · 2,208 tokens per session scan A 220987f68350

Subscribe to this mod's changes

svelte is a cursor rule published in the GitHub repository humanspeak/svelte-markdown (134 stars, last pushed 2d ago), licensed MIT. It adds 2,208 tokens to every session, about $0.0110 per session on Opus 5. 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-08-30.