Frontend .mdc

SvelteKit TypeScript Guide

Cursor rules for SvelteKit development with TypeScript integration.

How to use
  1. Copy the rule content.
  2. In your project root, create .cursorrules or .cursor/rules/sveltekit-typescript-guide.mdc
  3. Paste the content and save.

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

Key Principles

Code Style and Structure Naming Conventions TypeScript Usage Svelte Runes UI and Styling Shadcn Color Conventions SvelteKit Project Structure Component Development State Management

Use classes for complex state management (state machines):

// counter.svelte.ts
class Counter {
  count = $state(0);
  incrementor = $state(1);
  increment() {
    this.count += this.incrementor;
  }
  resetCount() {
    this.count = 0;
  }
  resetIncrementor() {
    this.incrementor = 1;
  }
}
export const counter = new Counter();

Similar rules

More in Frontend →