Generate production-ready Svelte Cursor rules for Project Rules (.mdc), AGENTS.md, or legacy .cursorrules. This template encodes stack-specific conventions for projects using Svelte. Compile-time framework that converts declarative components into lean JavaScript.
The template focuses Cursor AI on concrete Svelte practices instead of generic coding advice. Required sections are always included; optional sections can be enabled when they match your project.
Required guidance
- Component Structure
- Reactivity & State
- Styling & Scoped CSS
Default style
- Indentation: 2 spaces
- Quotes: single
- Semicolons: disabled
- Naming: camelCase
Optional sections: Routing (SvelteKit).
Example Svelte Rules
The generator turns these sections into Project Rules with frontmatter, AGENTS.md, or a single .cursorrules file depending on the output format you choose.
Component Structure
- Use Svelte 5 runes ($state, $derived, $effect) for reactivity.
- Keep script, template, and style sections in each .svelte file.
- Use 2 spaces for indentation.
- Use camelCase for variable and function names.
- Keep components focused on a single responsibility.
- Extract reusable logic into .svelte.js modules.
Reactivity & State
- Use $state() for reactive local state.
- Use $derived() for computed values — no manual invalidation.
- Use $effect() for side effects with automatic cleanup.
- Use $props() for component props with destructuring.
- Use $bindable() for two-way bindable props.
- Avoid overusing stores — prefer runes for local state.
Styling & Scoped CSS
- Use scoped <style> blocks in .svelte files.
- Use CSS custom properties for theme values.
- Use :global() modifier sparingly and only when necessary.
- Use class:directive for conditional classes.
- Prefer Tailwind CSS for utility-first styling when using SvelteKit.
- Keep styles co-located with components.
What does the Svelte Cursor rules template include?
It includes 4 rule sections covering component structure, reactivity & state, styling & scoped css and other Svelte development conventions.
Can I generate Svelte Project Rules and AGENTS.md from the same template?
Yes. The generator can export the same stack-specific guidance as modern Project Rules (.mdc), AGENTS.md, or a legacy .cursorrules file.
Should I combine Svelte with other Cursor rules templates?
Yes. You can combine Svelte with related templates such as TypeScript, Tailwind CSS, Docker, or backend frameworks when your project uses multiple technologies.