ai-infrastructure-hugg…
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming, embeddings, image generation,…
SvelteKit full-stack framework - file-based routing, load functions, form actions, server hooks, SSR/SSG, API routes, streaming, progressive enhancement
$ npx -y skills add agents-inc/skills --skill web-meta-framework-sveltekit --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/web-meta-framework-sveltekitContext preview
The summary Claude sees to decide when to auto-load this skill.
SvelteKit full-stack framework - file-based routing, load functions, form actions, server hooks, SSR/SSG, API routes, streaming, progressive enhancement
name: web-meta-framework-sveltekit description: SvelteKit full-stack framework - file-based routing, load functions, form actions, server hooks, SSR/SSG, API routes, streaming, progressive enhancement
> **Quick Guide:** Load functions fetch, form actions mutate, `+server.ts` serves external clients, > and hooks handle what applies to every request. Data reaches a component as the `data` prop and an > action's result as the `form` prop, both typed from the generated `$types`. Two facts change most > answers below: `+page.server.ts` runs only on the server while `+page.ts` also runs in the browser, > and `fail()` returns while `error()` and `redirect()` throw.
**Detailed Resources:**
---
whether the code may run in the browser; follow [examples/load-functions.md](examples/load-functions.md).
[examples/form-actions.md](examples/form-actions.md).
follow [examples/api-routes.md](examples/api-routes.md).
[examples/hooks.md](examples/hooks.md).
---
<critical_requirements>
**Put anything touching a database, a secret or a cookie in `+page.server.ts`.** A `+page.ts` load also runs in the browser, so whatever it imports is in the client bundle.
**Handle mutations with form actions rather than API routes.** An action gets progressive enhancement, CSRF protection and automatic revalidation; a `fetch` to a `+server.ts` route gets none of them for free.
**Return `fail(status, data)` for a validation failure, and put the values the user typed in it.** `fail` populates the `form` prop, so the page re-renders with the input intact — `error()` throws to `+error.svelte` and the form is gone.
**Validate on the server even where the browser already checked.** `required` and `type="email"` are a courtesy to the user; a POST can arrive without passing through the form at all.
**Type load functions and page props from the generated `./$types`.** `PageServerLoad`, `PageProps` and `LayoutProps` are derived from the route's own files, so a renamed parameter becomes a compile error.
**Add `use:enhance` to every form.** Without it a submission is a full page reload, which still works and is much slower.
**Call `redirect()` outside any `try`.** It signals by throwing, so a surrounding `catch` swallows the navigation and reports a failure that did not happen.
</critical_requirements>
---
**Auto-detection:** +page.svelte, +page.ts, +page.server.ts, +layout.svelte, +layout.ts, +layout.server.ts, +error.svelte, +server.ts, hooks.server.ts, hooks.client.ts, hooks.ts, load function, form actions, use:enhance, handle, handleFetch, handleError, handleValidationError, init, reroute, transport, sequence, $app/navigation, $app/forms, $app/state, $env/static/private, $env/dynamic/public, PageServerLoad, PageLoad, LayoutServerLoad, RequestHandler, PageProps, LayoutProps, fail, redirect, error, invalidate, invalidateAll, depends, event.locals, .remote.ts
**Applies to:**
**Handled elsewhere:**
is settled here
`locals`
choice
---
<philosophy>
SvelteKit is built on web platform objects rather than framework abstractions: `Request`, `Response`, `URL`, `Headers` and `FormData` are the whole vocabulary. That is why a form works without JavaScript, why caching is a `Cache-Control` header, and why an error is a status code.
The framework's shape is four roles, each with one job:
Request → hooks.server.ts (handle) → +layout.server.ts (load) → +page.server.ts (load) → +page.svelte
← form actions (POST)1. **Hooks** own what is true of every request 2. **Load functions** own reads, and run in parallel with each other rather than down the tree 3. **Form actions** own writes, and revalidate the loads afterwards 4. **Components** own rendering, and receive `data` and `form` as props
Type safety is generated rather than declared: `$types` is derived f
The official skills marketplace for Agents Inc. 150+ skills covering everything from React and Prisma to Redis, ElevenLabs, and infrastructure tooling. Pick the skills that match your stack and install them via Claude Code. Need more control?
Repo: agents-inc/skills
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming, embeddings, image generation,…
LiteLLM proxy server setup, TypeScript client patterns via OpenAI SDK, model routing, fallbacks, load balancing, spend tracking, virtual keys, and production…
Serverless GPU compute platform for AI model deployment — web endpoints, GPU functions, model serving, and TypeScript client patterns
Local LLM inference with the Ollama JavaScript client -- chat, streaming, tool calling, vision, embeddings, structured output, model management, and…
Replicate SDK patterns for TypeScript/Node.js -- client setup, predictions, streaming, webhooks, file handling, model versioning, deployments, and training
Together AI SDK patterns for TypeScript — client setup, chat completions, streaming, structured output, function calling, embeddings, image generation,…