Smithery Logo
MCPsSkillsDocsPricing
Login
Smithery Logo

Accelerating the Agent Economy

Resources

DocumentationPrivacy PolicySystem Status

Company

PricingAboutBlog

Connect

© 2026 Smithery. All rights reserved.

    spences10

    sveltekit-data-flow

    spences10/sveltekit-data-flow
    Coding
    153
    1 installs

    About

    SKILL.md

    Install

    Install via Skills CLI

    or add to your agent
    • Claude Code
      Claude Code
    • Codex
      Codex
    • OpenClaw
      OpenClaw
    • Cursor
      Cursor
    • Amp
      Amp
    • GitHub Copilot
      GitHub Copilot
    • Gemini CLI
      Gemini CLI
    • Kilo Code
      Kilo Code
    • Junie
      Junie
    • Replit
      Replit
    • Windsurf
      Windsurf
    • Cline
      Cline
    • Continue
      Continue
    • OpenCode
      OpenCode
    • OpenHands
      OpenHands
    • Roo Code
      Roo Code
    • Augment
      Augment
    • Goose
      Goose
    • Trae
      Trae
    • Zencoder
      Zencoder
    • Antigravity
      Antigravity
    ├─
    ├─
    └─

    About

    SvelteKit data flow guidance. Use for load functions, form actions, and server/client data. Covers +page.server.ts vs +page.ts, serialization, fail(), redirect(), error().

    SKILL.md

    SvelteKit Data Flow

    Quick Start

    Which file? Server-only (DB/secrets): +page.server.ts | Universal (runs both): +page.ts | API: +server.ts

    Load decision: Need server resources? → server load | Need client APIs? → universal load

    Form actions: Always +page.server.ts. Return fail() for errors, throw redirect() to navigate, throw error() for failures.

    Example

    // +page.server.ts
    import { fail, redirect } from '@sveltejs/kit';
    
    export const load = async ({ locals }) => {
    	const user = await db.users.get(locals.userId);
    	return { user }; // Must be JSON-serializable
    };
    
    export const actions = {
    	default: async ({ request }) => {
    		const data = await request.formData();
    		const email = data.get('email');
    
    		if (!email) return fail(400, { email, missing: true });
    
    		await updateEmail(email);
    		throw redirect(303, '/success');
    	},
    };
    

    Reference Files

    • load-functions.md - Server vs universal
    • form-actions.md - Form handling patterns
    • serialization.md - What can/can't serialize
    • error-redirect-handling.md - fail/redirect/error

    Notes

    • Server load → universal load via data param | ALWAYS throw redirect()/error()
    • No class instances/functions from server load (not serializable)
    • Last verified: 2025-01-11
    Recommended Servers
    Svelte
    Svelte
    InstantDB
    InstantDB
    Repository
    spences10/svelte-claude-skills
    Files