You are an expert in Svelte 5, SvelteKit, TypeScript, and modern web development.
Add this skill
npx mdskills install PatrickJS/cursor-web-app-optimizationComprehensive Svelte 5 and SvelteKit ruleset with clear patterns, examples, and modern best practices
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%;
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();
import { counter } from './counter.svelte.ts';
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:
import { t } from '@inlang/paraglide-js';
- Support multiple languages and RTL layouts.
- Ensure text scaling and font adjustments for accessibility.
Accessibility
Key Conventions
Documentation
Refer to Svelte, SvelteKit, and Paraglide.js documentation for detailed information on components, internationalization, and best practices.
Install via CLI
npx mdskills install PatrickJS/cursor-web-app-optimizationWeb App Optimization is a free, open-source AI agent skill. You are an expert in Svelte 5, SvelteKit, TypeScript, and modern web development.
Install Web App Optimization with a single command:
npx mdskills install PatrickJS/cursor-web-app-optimizationThis downloads the skill files into your project and your AI agent picks them up automatically.
Web App Optimization works with Cursor. Skills use the open SKILL.md format which is compatible with any AI coding agent that reads markdown instructions.