Skip to main content
rule

sveltekit-typescript-guide-cursorrules-prompt-file — Cursor rule

A Cursor rule that points the agent at Svelte 5, SvelteKit and TypeScript: project structure, runes, state handling.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/sveltekit-typescript-guide-cursorrules-prompt-file.mdc
Open on GitHub

What sveltekit-typescript-guide-cursorrules-prompt-file does

The file sets a role: inside Cursor the agent treats itself as an expert in Svelte 5, SvelteKit, TypeScript, Supabase and Drizzle. It then lists the areas where it keeps your code in line — naming conventions, type usage, Svelte runes, SvelteKit project structure, component development, state management, styling and Shadcn colour conventions.

One section covers complex state. The example is a class in counter.svelte.ts: fields declared with $state, methods that increment and reset. A single instance is created and exported, and that is the shape the agent will reach for when your state starts behaving like a state machine.

The rule lives at .cursor/rules/sveltekit-typescript-guide-cursorrules-prompt-file.mdc. Its frontmatter carries alwaysApply: false, so it does not ride along with every request — worth checking whether Cursor picks it up through the **/* globs or you have to attach the file to the chat yourself.

What it helps with

  • keep one code style across a SvelteKit project
  • write state with Svelte 5 runes instead of older stores
  • move state machine logic into a class with methods
  • follow SvelteKit directory structure
  • keep Supabase and Drizzle usage consistent in one project

Example prompts for the agent

  • Build a counter component in Svelte 5 using runes for state
  • Refactor this component to match the SvelteKit project structure
  • Move this store logic into a class with methods

How to install sveltekit-typescript-guide-cursorrules-prompt-file

Manually: put the files in place

.cursor/rules/sveltekit-typescript-guide-cursorrules-prompt-file.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about sveltekit-typescript-guide-cursorrules-prompt-file

How do I install sveltekit-typescript-guide-cursorrules-prompt-file in Cursor?

Create .cursor/rules/sveltekit-typescript-guide-cursorrules-prompt-file.mdc and paste the rule contents into it.

What does this rule do?

It primes the Cursor agent for Svelte 5, SvelteKit and TypeScript: code style, naming, runes, project structure and state management.

Does the rule apply to every file automatically?

The frontmatter sets alwaysApply: false with **/* globs. Check whether Cursor matches it by glob, or attach the file to the chat manually.

Source text

sveltekit-typescript-guide-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for SvelteKit development with TypeScript integration."
globs: **/*
alwaysApply: false
---
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):
```typescript
// 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();

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set68

tauri-svelte-typescript-guide-cursorrules-prompt-f A Cursor rule that sets how the agent writes desktop apps with Tauri: Svelte on the frontend, TypeScript for types. ★ 41,011repo stars tanstack-router A Cursor rule that sets agent conventions for TanStack Router v1: file-based routes, typed params and loader-based data fetching. ★ 41,011repo stars tanstack-query-v5-cursorrules-prompt-file A Cursor rule that tells the agent how to write TanStack Query v5 code: query keys, mutations, optimistic updates, Suspense and prefetching. ★ 41,011repo stars tailwind-react-firebase-cursorrules-prompt-file A Cursor rule that sets conventions for a mobile-first web app built with Tailwind, React and Firebase. ★ 41,011repo stars svelte A Cursor rule that steers the agent toward Svelte conventions: component structure, reactivity, stores, SvelteKit routing and tests. Useful when the agent writes or edits Svelte code. ★ 41,011repo stars solidjs-tailwind-cursorrules-prompt-file A Cursor rule that tells the agent how to write Solid.js code with Tailwind CSS: signals, utility classes, folder layout. ★ 41,011repo stars solidity-hardhat-cursorrules-prompt-file A Cursor rule that turns the AI assistant into a Solidity and smart contract security expert, with Hardhat-based testing and gas work. ★ 41,011repo stars snowflake-snowpark-dbt-cursorrules-prompt-file A Cursor rule that gives the agent context for Snowpark Python and dbt with the Snowflake adapter. Useful when you write transformation pipelines in either tool. ★ 41,011repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor