workflows/workflows/agent-environment-setup/platforms/codex/skills/svelte-sveltekit/SKILL.md
Use when building web applications with Svelte 5 and SvelteKit. Invoke for rune-based reactivity ($state, $derived, $effect), file-based routing, form actions, server-side rendering, load functions, and deployment.
npx skillsauth add cubetiq/cubis-foundry svelte-sveltekitInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Senior frontend engineer specializing in Svelte 5 rune-based reactivity and SvelteKit full-stack patterns for performant, accessible web applications.
Provide authoritative guidance on building production Svelte 5 + SvelteKit applications. This skill covers the runes reactivity model, file-based routing, server/client load functions, form actions with progressive enhancement, SSR/SSG strategies, and deployment to edge and Node targets.
Audit the existing codebase for Svelte version before writing any code, because Svelte 5 runes syntax is incompatible with Svelte 4 reactive declarations ($:) and mixing them causes runtime errors.
Use $state for all mutable reactive values instead of let assignments, because $state creates fine-grained reactivity that Svelte 5 can track across component boundaries and inside plain objects.
Derive computed values with $derived instead of manual recalculation, because $derived automatically recomputes when its dependencies change and avoids stale-value bugs that plague imperative approaches.
Isolate side effects in $effect and keep them minimal, because effects run after DOM updates and uncontrolled effects create cascading re-renders that degrade performance and introduce timing bugs.
Structure routes using the +page.svelte / +layout.svelte / +server.ts file conventions rather than custom routing, because SvelteKit's file-based router enables automatic code-splitting, nested layouts, and typed parameters.
Implement data loading in +page.server.ts load functions to keep secrets and database calls on the server, because load functions run before rendering and provide typed data to pages without exposing backend details to the client bundle.
Use +page.ts load functions for client-safe data that can run universally, because universal load functions enable client-side navigation without round-trips when the data does not require server secrets.
Build form mutations with SvelteKit form actions (+page.server.ts actions) and use:enhance, because form actions provide progressive enhancement, CSRF protection, and work without JavaScript enabled.
Apply use:enhance to progressively enhance forms with custom callbacks for pending/success/error states, because this preserves the form-action contract while adding optimistic UI updates and loading indicators.
Validate all form data on the server using a schema library (Zod, Valibot, or ArkType), because client-side validation can be bypassed and server-side validation is the only trustworthy enforcement boundary.
Configure rendering strategy per route using +page.ts or +layout.ts exports (ssr, csr, prerender), because different routes have different latency, SEO, and caching requirements that a single global setting cannot satisfy.
Implement error boundaries with +error.svelte at layout and page levels, because unhandled errors in load functions or components crash the entire page unless caught by the nearest error boundary.
Use SvelteKit hooks (hooks.server.ts) for authentication, logging, and response transformation, because hooks intercept every request before routing and provide a single enforcement point for cross-cutting concerns.
Write component tests with Vitest and @testing-library/svelte and route tests with Playwright, because unit tests verify component logic in isolation while E2E tests validate the full server-client contract.
Optimize bundle size by lazy-loading heavy components with {#await import(...)} or dynamic import() in load functions, because SvelteKit code-splits per route but large shared dependencies still inflate initial bundles.
Pin the SvelteKit adapter (adapter-auto, adapter-node, adapter-vercel, adapter-cloudflare) to a specific version, because adapter mismatches between development and production cause silent deployment failures.
../web-testing/SKILL.md for live browser QA, real-page evidence, and Playwright-MCP-driven validation.When delivering Svelte 5 + SvelteKit code:
.svelte files using runes syntax with <script>, template, and <style> blocks+page.svelte, +page.server.ts, +layout.svelte, +layout.server.ts following SvelteKit conventions.d.ts files or inline types for load function return values.test.ts files co-located with components or in a tests/ directorysvelte.config.js, vite.config.ts changes when neededLoad detailed guidance based on context:
| Topic | Reference | Load When |
|-------|-----------|-----------|
| Runes | references/runes.md | Using $state, $derived, $effect, $props, $bindable |
| Routing | references/routing.md | File-based routes, layouts, params, groups |
| Form Actions | references/form-actions.md | Server actions, use:enhance, validation |
| Testing | references/testing.md | Vitest, Testing Library, Playwright for Svelte |
| Deployment | references/deployment.md | Adapters, SSR/SSG, environment variables |
tools
Use when investigating latest vendor behavior, comparing tools or platforms, verifying claims beyond the repo, or gathering external evidence before implementation.
documentation
Use when designing database schemas, normalization strategies, indexing plans, query optimization, and migration workflows for relational, document, or hybrid data stores.
development
Use when writing, reviewing, or refactoring modern C#/.NET code, including minimal APIs, records, async streams, pattern matching, DI lifetimes, and memory-efficient performance tuning.
development
Use when conducting code reviews, building review checklists, calibrating review depth, providing structured feedback, or establishing team review practices. Covers review methodology, feedback patterns, automated checks, and batch review strategies.