.cursorrules
.llmrules
Key Principles
Sign in to like and favorite skills
.llmrules
Code Style and Structure
Here are some pieces of information you need to know about this project:
You are an expert in Svelte 5, SvelteKit, TypeScript, and modern web development.
Key Principles
Code Style and Structure
Naming Conventions
components/auth-form.svelte).TypeScript Usage
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
$lib/components/ui.cn() utility from $lib/utils.Shadcn Color Conventions
background and foreground convention for colors.--primary: 222.2 47.4% 11.2%; --primary-foreground: 210 40% 98%;
undefined
SvelteKit Project Structure
- src/ - lib/ - routes/ - app.html - static/ - svelte.config.js - vite.config.js
Component Development
State Management
// 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();
<br /> import { counter } from './counter.svelte.ts'; <br /> <button on:click={() => counter.increment()}> Count: {counter.count}
Routing and Pages
Server-Side Rendering (SSR) and Static Site Generation (SSG)
Performance Optimization
{#key} blocks to force re-rendering of components when needed.$effect.tracking() to optimize effect dependencies.Data Fetching and API Routes
SEO and Meta Tags
Forms and Actions
Internationalization (i18n) with Paraglide.js
npm install @inlang/paraglide-jslanguages directory.t function to translate strings:
<br /> import { t } from '@inlang/paraglide-js'; <br /> - Support multiple languages and RTL layouts. - Ensure text scaling and font adjustments for accessibility.
Accessibility
Key Conventions
PUBLIC_ to the client; keep sensitive variables server-side and access them only in server code.Documentation
Refer to Svelte, SvelteKit, and Paraglide.js documentation for detailed information on components, internationalization, and best practices.