alpha

Sets coding standards for Svelte 5 and SvelteKit 2 projects: runes reactivity, component design, TypeScript, performance and accessibility.
description: 'Svelte 5 and SvelteKit 2 development standards and best practices for component-based user interfaces and full-stack applications'
applyTo: '**/.svelte, **/.ts, **/.js, **/.css, **/.scss, **/.json'
Instructions for building high-quality Svelte 5 and SvelteKit applications with modern runes-based reactivity, TypeScript, and performance optimization.
[!NOTE]
Examples and APIs in this guide target Svelte 5.x and SvelteKit 2.x. Features noted as experimental (awaitexpressions and remote functions) require opt-in config flags and may change before they stabilize.
<script lang="ts"> with runes syntax as default{#snippet} blocks for reusable template logic within componentschildren snippet for flexible parent-child composition{@attach}, Svelte 5.29+) over actions (use:) for DOM interaction and third-party library integration — attachments react to state and compose cleanly$state() for reactive local state management$derived() for computed values and expensive calculations$derived.by() for complex computations beyond simple expressions$effect() sparingly - prefer $derived or function bindings for state sync$effect.pre() for running code before DOM updatesuntrack() to prevent infinite loops when reading/writing same state in effects$props() and destructuring with TypeScript annotations$bindable() for two-way data binding between componentsbind:value={() => value, (v) => (value = v)}) when a binding needs to derive or validate the value$state() for local component statecreateContext() helper over raw setContext/getContext$state modules for SSR - use context to prevent cross-request data leaks$app/state (page, navigating, updated); $app/stores is the legacy equivalent for SvelteKit < 2.12$derived() over $effect() for computed values$effect() to synchronize state - use $derived() instead$effect() for side effects: analytics, logging, DOM manipulation$effect.pre() when code must run before DOM updates (e.g., scroll position)$effect.root() for manually controlled effects outside component lifecycleuntrack() to read state without creating dependencies in effectsawait+page.svelte for page components with proper SEO+layout.svelte for shared layouts and navigation+page.server.ts for server-side data loading and API calls+page.server.ts for data mutations+server.ts for API endpoints and server-side logicinvalidate() and invalidateAll() for cache management.remote.ts files as one of query, form, command, or prerenderkit.experimental.remoteFunctions and compilerOptions.experimental.async in svelte.config.jsquery and resolve it directly in markup with await getPosts():// src/routes/blog/data.remote.ts
import { query } from '$app/server';
import * as db from '$lib/server/database';
export const getPosts = query(async () => {
return await db.sql`SELECT title, slug FROM post ORDER BY published_at DESC`;
});
$lib/server modules for secrets and DB access, but must not live inside src/lib/serveruse:enhancebind:value for controlled form inputs<style> blocksclass: directive for conditional styling:global() sparingly for truly global stylestransition: directive for enter/exit animations (fade, slide, scale, fly)in: and out: for separate enter/exit transitionsanimate: directive with flip for smooth list reordering|local modifier to trigger transitions only on direct changes{#each} blocks for list animationstsconfig.json for maximum type safetylet { name }: { name: string } = $props()$types.ts files generated by SvelteKitsvelte-check{#each} blocks for efficient list renderingimport(); in Svelte 5 components are dynamic by default — assign the imported component to a capitalized variable and render <Component /> (<svelte:component> is no longer needed in runes mode)$derived() for expensive computations to avoid unnecessary recalculations$derived.by() for complex derived values that require multiple statements$effect() for derived state - it's less efficient than $derived()$effect.tracking() in abstractions to conditionally create reactive listeners+error.svelte pages for route-level error boundaries<svelte:boundary> (Svelte 5.3+) to contain rendering and effect errors at the component level, providing a failed snippet (with reset) or an onerror handler for fallback UIerror() and redirect() helpers for proper responsesawait syntax (Svelte 5.36+, opt-in via experimental.async), show first-render UI with a <svelte:boundary> pending snippet and later loading states with $effect.pending()@html directive carefully and validate HTML content© GitHub, Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com


Rose perfume bottle luxury commercial with petals
Plans a 20-second luxury perfume commercial as a ten-panel storyboard sheet, with frame consistency rules, macro camera moves and layered audio cues.
video-prompt, image-to-video, video-ad, product-video, storyboard, multi-panel, macro, luxury, camera-movement, slow-motion, asmr, pastel, flowers, soft-lighting, studio-lighting, for-marketers, for-filmmakers, structured-output, long-form, perfume

Cyberpunk Operative Surveillance Status Screen in Japanese
Draws an anime covert operative in a dark corridor surrounded by ten Japanese-labelled HUD panels in a blue-gray surveillance dossier layout.
image-prompt, anime, cyberpunk, ui-mockup, text-rendering, futuristic, moody, character-design, man, full-body, high-angle, gpt-image, japan, structured-output, long-form, neon, concept-art, multi-panel, game-assets, dramatic-lighting

Paris rising in miniature from a vintage paper map
Makes a surreal artwork of any city rising as a tiny three-dimensional model out of a vintage paper map, with one red thread and a vintage-style title.
image-prompt, placeholders, template, maps, miniature, cityscape, landmarks, architecture, photorealistic, surreal, vintage, poster, typography, text-rendering, negative-space, natural-light, travel, 3d-render, negative-prompt, gpt-image, for-artists, for-designers, long-form
Loading reviews…
Loading comments…