> sveltekit
Assists with building full-stack web applications using SvelteKit. Use when creating Svelte apps with file-based routing, server-side rendering, form actions, or API endpoints. Trigger words: sveltekit, svelte, svelte routing, form actions, svelte hooks, svelte adapter, svelte load function.
curl "https://skillshub.wtf/TerminalSkills/skills/sveltekit?format=md"SvelteKit
Overview
SvelteKit is a full-stack framework built on Svelte's compiler-first approach, shipping minimal JavaScript with no virtual DOM runtime. It provides file-based routing for pages and API endpoints, server-side form actions with progressive enhancement, and deployment adapters for any hosting platform.
Instructions
- When setting up routing, use file-based conventions:
+page.sveltefor pages,+layout.sveltefor shared layouts,+server.tsfor API endpoints, and route groups(name)for shared layouts without URL impact. - When loading data, use
+page.server.tsfor server-only loading (database queries, secrets) and+page.tsfor universal loading. Keepload()functions thin and move business logic to$lib/server/. - When handling forms, use server-side form actions in
+page.server.tswithfail()for validation errors andredirect()for success. Adduse:enhancefor progressive enhancement. - When creating API routes, export
GET,POST,PUT,DELETEhandlers from+server.tsfiles, returningjson(),text(), orerror()responses. - When configuring rendering, default to SSR, use
export const prerender = truefor static pages (marketing, docs, blog), andexport const ssr = falsefor client-only pages. - When adding middleware, use
src/hooks.server.tswith thehandlefunction for auth, logging, and redirects, andsequence()to compose multiple hooks. - When deploying, choose the appropriate adapter:
adapter-autofor auto-detection,adapter-nodefor self-hosted,adapter-staticfor full SSG, or platform-specific adapters for Vercel, Cloudflare, or Netlify.
Examples
Example 1: Build a CRUD app with form actions
User request: "Create a SvelteKit app with form-based task management"
Actions:
- Define routes for task list (
/tasks/+page.svelte) and detail (/tasks/[id]/+page.svelte) - Implement
load()in+page.server.tsto fetch tasks from the database - Add form actions for create, update, and delete with Zod validation
- Enhance forms with
use:enhancefor no-JS fallback
Output: A full-stack task management app with progressive enhancement and server-side validation.
Example 2: Deploy a hybrid SvelteKit app
User request: "Set up a SvelteKit site with static marketing pages and dynamic dashboard"
Actions:
- Create marketing pages with
export const prerender = true - Build dashboard routes with SSR and
+page.server.tsfor authenticated data loading - Add auth hook in
src/hooks.server.tsto protect dashboard routes - Configure
adapter-vercelwith edge functions for the dashboard
Output: A hybrid app with pre-rendered marketing pages and server-rendered authenticated dashboard.
Guidelines
- Use
+page.server.tsfor data loading that touches databases or secrets; never expose credentials in+page.ts. - Default to server-side form handling with actions; add
use:enhancefor progressive enhancement. - Use
export const prerender = trueon marketing pages, docs, and blog posts. - Keep
load()functions thin: fetch data and return it, move business logic to$lib/server/. - Use route groups
(name)to share layouts without affecting URLs. - Set
data-sveltekit-preload-data="hover"on links for perceived-instant navigation. - Always handle the
formprop in+page.svelteto display validation errors after failed actions.
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> xero-accounting
Integrate with the Xero accounting API to sync invoices, expenses, bank transactions, and contacts — and generate financial reports like P&L and balance sheet. Use when: connecting apps to Xero, automating bookkeeping workflows, syncing accounting data, or pulling financial reports programmatically.
> windsurf-rules
Configure Windsurf AI coding assistant with .windsurfrules and workspace rules. Use when: customizing Windsurf for a project, setting AI coding standards, creating team-shared Windsurf configurations, or tuning Cascade AI behavior.