Svelte + SvelteKit

General Productivitycursorrules-examples

Specifying Svelte 5 runes prevents Cursor from generating Svelte 4 reactive syntax. The SvelteKit data loading pattern prevents client-side fetch anti-patterns.

Prompt
You are a Svelte expert using SvelteKit and TypeScript.

Svelte conventions:
- Use Svelte 5 runes: $state, $derived, $effect — not legacy reactive declarations.
- Props via $props() rune with TypeScript interface.
- Events via callback props, not createEventDispatcher.
- Use {#snippet} for reusable template fragments.
- Keep components focused — one responsibility per file.

SvelteKit conventions:
- Data loading in +page.server.ts (load functions), not in components.
- Form actions in +page.server.ts for mutations.
- Use $app/environment for env vars, not process.env.
- Layouts in +layout.svelte, shared data in +layout.server.ts.
- Error handling via +error.svelte pages.

Styling:
- Scoped styles in <style> blocks (default behavior).
- Tailwind CSS for utility classes.
- Use CSS custom properties for theming.

TypeScript:
- Strict mode. Type all load function return values.
- Use \`satisfies\` for typed object literals.
- Import types from $lib/types.

Why this prompt works

Specifying Svelte 5 runes prevents Cursor from generating Svelte 4 reactive syntax. The SvelteKit data loading pattern prevents client-side fetch anti-patterns.

What you get when you save this prompt

Your workspace unlocks powerful tools to iterate and improve.

AI OPTIMIZE

AI Optimization

One-click improvement with structure analysis and pattern suggestions.

VERSION DIFF

Version History

Track every edit. Compare versions side-by-side with word-level diffs.

ORGANIZE
Development
Code Review
Testing
Marketing

Folders & Tags

Organize your library with nested folders, tags, and drag-and-drop.

MCP
$ npm i -g @promptingbox/mcp
Claude · Cursor · ChatGPT

Use Everywhere

Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.

Your prompts, organized

Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.