sveltekit-data-flow

Guide SvelteKit data flow between server and client with load functions and form actions.

Updated Mar 28, 2026
One-click install
npx skills add https://github.com/sandalsoft/agent-skills --skill sveltekit-data-flow-sandalsoft
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sveltekit-data-flow
Source: https://github.com/sandalsoft/agent-skills/tree/main/sveltekit-data-flow
Command: npx skills add https://github.com/sandalsoft/agent-skills --skill sveltekit-data-flow-sandalsoft

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

SvelteKit data flow guidance helps developers design and implement robust server/client data interactions, including load functions, form actions, and invalidation, with clear guidance on +page.server.ts vs +page.ts, serialization, fail(), redirect(), error(), and invalidateAll().

Core Features & Use Cases

  • Clear patterns for choosing server vs universal loads and when to use +page.server.ts vs +page.ts.
  • Practical form action guidance using fail(), redirect(), and error() with serializable return values.
  • How to invalidate and refresh data across client navigation using invalidateAll() for responsive UIs.

Quick Start

Create a +page.server.ts for sensitive data, a +page.ts for universal data, and implement a simple load and a form action following the examples.

Frequently Asked Questions about sveltekit-data-flow

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
When should I use +page.server.ts vs +page.ts for SvelteKit load functions?

SvelteKit load functions in +page.server.ts handle sensitive or server-only data, while +page.ts provides universal data fetching that runs on both server and client during navigation.

How do I handle form action errors and redirects in SvelteKit?

Handle SvelteKit form action errors and redirects by using fail() for validation issues with serializable data, redirect() for URL navigation, and error() to throw unexpected failures.

How do I refresh SvelteKit load data after a form action submission?

Refresh SvelteKit load data after a form action by calling invalidateAll() to re-run active load functions, ensuring the UI reflects updated server state without a full page reload.

What are the serialization constraints for SvelteKit form action return values?

SvelteKit form action return values must be fully serializable to safely move data from server to client, requiring plain JSON-compatible objects rather than class instances or functions.

Does SvelteKit data flow guidance cover safe data movement patterns across server and client?

Yes, SvelteKit data flow guidance provides patterns and guardrails for safe, predictable data movement across server and client, covering load functions, form actions, and invalidation techniques.