From f078f4540ddb4966efd878c96859377375cf5e69 Mon Sep 17 00:00:00 2001 From: Christopher Harrison Date: Thu, 15 Jan 2026 14:13:10 -0800 Subject: [PATCH] Update Svelte instructions with Svelte 5 best practices - Added latest Svelte 5 runes best practices (.by, .pre, untrack) - Added type-safe context with createContext() pattern - Added transitions and animations section - Emphasized effect best practices (prefer over ) - Added function bindings for two-way binding - Restructured document for better readability with logical groupings - Organized into clear sections: Core Concepts, Reactivity, SvelteKit, UI, TypeScript, Production - Consolidated related topics (data loading, forms, tooling) - Updated to align with official Svelte 5 and SvelteKit documentation --- instructions/svelte.instructions.md | 141 ++++++++++++++++++---------- 1 file changed, 93 insertions(+), 48 deletions(-) diff --git a/instructions/svelte.instructions.md b/instructions/svelte.instructions.md index 646b4baf..7f2dfed5 100644 --- a/instructions/svelte.instructions.md +++ b/instructions/svelte.instructions.md @@ -15,7 +15,7 @@ Instructions for building high-quality Svelte 5 and SvelteKit applications with - Progressive enhancement and performance-first approach - Modern build tooling (Vite) with optimizations -## Development Standards +## Core Concepts ### Architecture - Use Svelte 5 runes system for all reactivity instead of legacy stores @@ -25,45 +25,76 @@ Instructions for building high-quality Svelte 5 and SvelteKit applications with - Implement proper component composition with slots and snippets - Use SvelteKit's file-based routing with proper load functions -### TypeScript Integration -- Enable strict mode in `tsconfig.json` for maximum type safety -- Define interfaces for component props using `$props()` syntax -- Type event handlers, refs, and SvelteKit's generated types -- Use generic types for reusable components -- Leverage `$types.ts` files generated by SvelteKit -- Implement proper type checking with `svelte-check` - ### Component Design - Follow single responsibility principle for components - Use `