sveltekit
БесплатноБез исполняемых скриптовНе проверенAssists with building full-stack web applications using SvelteKit, the Svelte framework with file-based routing, server-side rendering, form actions and API…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
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. This skill targets SvelteKit 3 (@sveltejs/kit 3.x, with Svelte 5 runes); where a project is still on 2.x the differences are called out.
Instructions
- When creating a project, run
npx sv create invoice-app(options:--template minimal|demo|library,--types ts,--add eslint vitest playwright tailwindcss sveltekit-adapter). Thennpm run devstarts the dev server on port 5173. - 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 tosrc/lib/server/. - When handling forms, use server-side form actions in
+page.server.tswithfail()for validation errors andredirect()for success. Adduse:enhancefor progressive enhancement. In SvelteKit 3 an enhanced submission reports the status code passed tofail()instead of always 200. - When creating API routes, export
GET,POST,PUT,DELETEhandlers from+server.tsreturning aResponse. In v3json()andtext()from@sveltejs/kitare deprecated: useResponse.json(...)andnew Response(text). Useerror()for HTTP errors. - 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 hooks. In v3 theHandletype is imported from@sveltejs/kit/hooks(alongsidesequence), not@sveltejs/kit. - When deploying, choose the adapter:
adapter-auto(detects some platforms, cannot build for a self-hosted box),adapter-nodefor self-hosting (node build,HOST/PORTenv vars, default0.0.0.0:3000),adapter-staticfor full SSG, oradapter-vercel,adapter-cloudflare,adapter-netlify.
SvelteKit 3 setup and upgrade notes
- Configuration lives in
vite.config.ts: options formerly underconfig.kitinsvelte.config.jsare now top-level options of thesveltekit({...})Vite plugin (adapter,paths,csrf,compilerOptions).svelte.config.jsis no longer read. - The
$libalias is replaced by#lib, declared by you inpackage.jsonimports("#lib": "./src/lib/index.js","#lib/*": "./src/lib/*"). Imports need the file extension:#lib/server/tasks.js.sv createwrites this for new projects. $app/environmentbecame$app/env;$app/storesis gone (use$app/state:page,navigating,updated);baseandassetsfrom$app/pathsare gone (useresolve()andasset()).csrf.checkOriginis replaced bycsrf.trustedOrigins: ['https://billing.partner.dev']; CSRF protection is always on. Cross-origin form posts need aContent-Typeheader.error(status, message)takes a string message only; extra fields go in a third argument.redirect()to another origin needs{ external: true }.handleErrornow sees expected errors too.adapter-nodeno longer readsORIGIN: setpaths.originin the Vite config (for examplepaths: { origin: process.env.ORIGIN }) when the app sits behind a proxy that hides the host.adapter-verceldropped theedgeruntime.data-sveltekit-preload-data="off"is now"false".invalidateAllis deprecated in favour ofrefreshAll.- To migrate from 2.x, upgrade to the latest 2.x first, then run
npx sv migrate sveltekit-3.
Minimal form action, endpoint and hook
// src/routes/tasks/+page.server.ts
import { fail, redirect } from '@sveltejs/kit';
import { addTask, listTasks } from '#lib/server/tasks.js';
import type { Actions, PageServerLoad } from './$types';
export const load: PageServerLoad = async () => ({ tasks: listTasks() });
export const actions: Actions = {
create: async ({ request }) => {
const data = await request.formData();
const title = String(data.get('title') ?? '').trim();
if (title.length < 3) return fail(400, { title, error: 'Title needs 3+ characters' });
addTask(title);
redirect(303, '/tasks');
}
};
<!-- src/routes/tasks/+page.svelte -->
<script lang="ts">
import { enhance } from '$app/forms';
let { data, form } = $props();
</script>
<form method="POST" action="?/create" use:enhance>
<input name="title" value={form?.title ?? ''} />
<button>Add</button>
{#if form?.error}<p>{form.error}</p>{/if}
</form>
<ul>{#each data.tasks as task (task.
Установить sveltekit в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл sveltekit?
Assists with building full-stack web applications using SvelteKit, the Svelte framework with file-based routing, server-side rendering, form actions and API endpoints. Use when creating or upgrading a SvelteKit app, writing load functions, form actions, hooks or +server.ts endpoints, or picking an adapter. Trigger words: sveltekit, svelte, svelte routing, form actions, svelte hooks, svelte adapter, svelte load function, sveltekit 3.
Как установить скилл sveltekit?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл sveltekit запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic