Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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). Then npm run dev starts the dev server on port 5173.
  • When setting up routing, use file-based conventions: +page.svelte for pages, +layout.svelte for shared layouts, +server.ts for API endpoints, and route groups (name) for shared layouts without URL impact.
  • When loading data, use +page.server.ts for server-only loading (database queries, secrets) and +page.ts for universal loading. Keep load() functions thin and move business logic to src/lib/server/.
  • When handling forms, use server-side form actions in +page.server.ts with fail() for validation errors and redirect() for success. Add use:enhance for progressive enhancement. In SvelteKit 3 an enhanced submission reports the status code passed to fail() instead of always 200.
  • When creating API routes, export GET, POST, PUT, DELETE handlers from +server.ts returning a Response. In v3 json() and text() from @sveltejs/kit are deprecated: use Response.json(...) and new Response(text). Use error() for HTTP errors.
  • When configuring rendering, default to SSR, use export const prerender = true for static pages (marketing, docs, blog), and export const ssr = false for client-only pages.
  • When adding middleware, use src/hooks.server.ts with the handle function for auth, logging, and redirects, and sequence() to compose hooks. In v3 the Handle type is imported from @sveltejs/kit/hooks (alongside sequence), not @sveltejs/kit.
  • When deploying, choose the adapter: adapter-auto (detects some platforms, cannot build for a self-hosted box), adapter-node for self-hosting (node build, HOST/PORT env vars, default 0.0.0.0:3000), adapter-static for full SSG, or adapter-vercel, adapter-cloudflare, adapter-netlify.

SvelteKit 3 setup and upgrade notes

  • Configuration lives in vite.config.ts: options formerly under config.kit in svelte.config.js are now top-level options of the sveltekit({...}) Vite plugin (adapter, paths, csrf, compilerOptions). svelte.config.js is no longer read.
  • The $lib alias is replaced by #lib, declared by you in package.json imports ("#lib": "./src/lib/index.js", "#lib/*": "./src/lib/*"). Imports need the file extension: #lib/server/tasks.js. sv create writes this for new projects.
  • $app/environment became $app/env; $app/stores is gone (use $app/state: page, navigating, updated); base and assets from $app/paths are gone (use resolve() and asset()).
  • csrf.checkOrigin is replaced by csrf.trustedOrigins: ['https://billing.partner.dev']; CSRF protection is always on. Cross-origin form posts need a Content-Type header.
  • error(status, message) takes a string message only; extra fields go in a third argument. redirect() to another origin needs { external: true }. handleError now sees expected errors too.
  • adapter-node no longer reads ORIGIN: set paths.origin in the Vite config (for example paths: { origin: process.env.ORIGIN }) when the app sits behind a proxy that hides the host. adapter-vercel dropped the edge runtime.
  • data-sveltekit-preload-data="off" is now "false". invalidateAll is deprecated in favour of refreshAll.
  • 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.
Полный SKILL.md на GitHub

Установить sveltekit в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

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), без исполняемых скриптов.

Похожие скиллы

Сравнить sveltekit с