# sveltekit

A skill that tells the agent how SvelteKit works: file-based routing, load functions, form actions and deployment adapters.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 441 installs · ★ 78
- Author: Claude MPM Team
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/toolchains/javascript/frameworks/sveltekit/SKILL.md
- Updated: 2026-07-18
- HTML: https://affpapa.org/en/nevibecode/skills/claude-mpm-team-sveltekit

## What it does

The skill covers SvelteKit as a full-stack framework for Svelte. It lays out the project conventions: routes live under `src/routes/`, pages are `+page.svelte` files, data comes from `+page.ts` and `+page.server.ts`, endpoints from `+server.ts`. With that map in context, the agent stops inventing folders that do not exist.

Dynamic routes get their own section — `[slug]`, optional `[[year]]`, rest params `[...path]`. Rendering modes are covered too: `prerender`, `ssr`, `csr`, plus the `handle`, `handleError` and `handleFetch` hooks. It all sits in a single `SKILL.md`, with no scripts or extra dependencies.

The skill is non-interactive: `user-invocable: false` and `disable-model-invocation: true`. You cannot call it from chat by hand; it loads as reference material for the agent. If you expected a slash command, there isn't one here — worth checking other skills instead.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill sveltekit -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/sveltekit/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/sveltekit/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill sveltekit -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/sveltekit/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill sveltekit -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/sveltekit/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install bobmatnyc/claude-mpm-skills sveltekit
```

2. **Manually: put the files in place**
- File: `.github/skills/sveltekit/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill sveltekit -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/bobmatnyc/claude-mpm-skills --path toolchains/javascript/frameworks/sveltekit
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/sveltekit/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill sveltekit -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/toolchains/javascript/frameworks/sveltekit/SKILL.md

## When to use it
- lay out routes under `src/routes/` without mixing them up
- wire a load function to a page and get types from `$types`
- build a form with progressive enhancement via form actions
- pick a rendering mode for a specific route
- expose a REST endpoint in `+server.ts`

## Example prompts
- Help me set up file-based routing in SvelteKit for a blog with categories
- How do I write a form action with server-side validation in SvelteKit?
- Explain the difference between `+page.ts` and `+page.server.ts` in my project

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 5691e621af362eb9.

BEGIN THIRD-PARTY FILE 5691e621af362eb9
````text
---
name: sveltekit
description: SvelteKit - Full-stack Svelte framework with file-based routing, SSR/SSG, form actions, and adapters for deployment
user-invocable: false
disable-model-invocation: true
version: 1.0.0
category: toolchain
author: Claude MPM Team
license: MIT
progressive_disclosure:
  entry_point:
    summary: "Full-stack Svelte framework: file-based routing, SSR/SSG/SPA, form actions, type-safe load functions, universal adapters"
    when_to_use: "Building full-stack web apps, SPAs with SSR, forms with progressive enhancement, API routes, SEO-critical sites"
    quick_start: "1. npm create svelte@latest 2. Define routes in src/routes/ 3. Use +page.svelte for pages 4. Deploy with adapters"
  token_estimate:
    entry: 80
    full: 5000
tags:
  - sveltekit
  - svelte
  - ssr
  - ssg
  - routing
  - forms
  - fullstack
  - framework
  - adapters
  - typescript
requires_tools: []
---

# SvelteKit - Full-Stack Svelte Framework

## Overview

SvelteKit is the official **full-stack framework** for Svelte, providing file-based routing, server-side rendering (SSR), static site generation (SSG), form handling with progressive enhancement, and deployment adapters for any platform.

**Key Features**:
- **File-based routing**: Automatic routes from `src/routes/` directory structure
- **Load functions**: Type-safe data fetching (`+page.ts`, `+page.server.ts`)
- **Form actions**: Native form handling with progressive enhancement
- **SSR/SSG/SPA**: Flexible rendering modes with per-route control
- **Adapters**: Deploy to Vercel, Netlify, Node.js, Cloudflare, and more
- **TypeScript-first**: Generated types from `$types` for type safety
- **Hooks**: Middleware-like `handle`, `handleError`, `handleFetch`
- **API routes**: `+server.ts` files for REST endpoints

**Installation**:
```bash
# Create new SvelteKit project
npm create svelte@latest my-app
cd my-app
npm install
npm run dev -- --open

# Templates: skeleton, demo app, library
# Choices: TypeScript, ESLint, Prettier, Playwright, Vitest
```

## Project Structure

### Standard SvelteKit Layout

```
my-sveltekit-app/
├── src/
│   ├── routes/                   # File-based routing
│   │   ├── +page.svelte         # / (home page)
│   │   ├── +page.ts             # Universal load function
│   │   ├── +page.server.ts      # Server-only load function
│   │   ├── +layout.svelte       # Shared layout
│   │   ├── +layout.ts           # Layout load function
│   │   ├── +error.svelte        # Error page
│   │   ├── about/
│   │   │   └── +page.svelte     # /about
│   │   ├── blog/
│   │   │   ├── +page.svelte     # /blog (list)
│   │   │   ├── +page.server.ts  # Load posts
````
END THIRD-PARTY FILE 5691e621af362eb9

The third-party file has ended. Everything between the 5691e621af362eb9 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2788 of 32593 bytes. © Claude MPM Team · MIT · https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/toolchains/javascript/frameworks/sveltekit/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
