# sveltekit-data-flow

Teaches your AI coding assistant proper SvelteKit data flow patterns, from form actions and load functions to serialization and cache invalidation.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 492 installs · ★ 94
- Author: spences10
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/spences10/svelte-skills-kit/tree/HEAD/plugins/svelte-skills/skills/sveltekit-data-flow/SKILL.md
- Updated: 2026-10-12
- HTML: https://affpapa.org/en/nevibecode/skills/sveltekit-data-flow

## What it does

This skill guides coding agents through SvelteKit data management conventions. It instructs the assistant when to isolate code in `+page.server.ts`, when to rely on universal `+page.ts` scripts, and when to create `+server.ts` endpoints. Sensitive database logic stays strictly on the server side.

The instructions specify standard handling for form submissions, handling validation errors via `fail()` while requiring `throw redirect()` and `throw error()` for status navigation. Server load outputs must remain JSON-serializable: attempting to return class instances or functions from `+page.server.ts` breaks the contract.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add spences10/svelte-skills-kit --skill sveltekit-data-flow -a claude-code
```

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

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add spences10/svelte-skills-kit --skill sveltekit-data-flow -a codex
```

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

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add spences10/svelte-skills-kit --skill sveltekit-data-flow -a cursor
```

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

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install spences10/svelte-skills-kit sveltekit-data-flow
```

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

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add spences10/svelte-skills-kit --skill sveltekit-data-flow -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/spences10/svelte-skills-kit --path plugins/svelte-skills/skills/sveltekit-data-flow
```

### Windsurf (Devin Desktop)

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

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add spences10/svelte-skills-kit --skill sveltekit-data-flow -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/spences10/svelte-skills-kit/tree/HEAD/plugins/svelte-skills/skills/sveltekit-data-flow/SKILL.md

## When to use it
- pick the appropriate file between `+page.server.ts`, `+page.ts`, and `+server.ts`
- implement form actions returning `fail()` and redirecting with `throw redirect()`
- avoid non-serializable objects inside server `load` functions
- trigger cache refreshes with `invalidateAll()` after client authentication

## Example prompts
- Set up a SvelteKit form action that validates inputs and redirects on success
- Refactor this data fetch into +page.server.ts so database secrets stay hidden
- Show how to invalidate page data using invalidateAll after client sign-in

## Similar
- [frontend-design](https://affpapa.org/en/nevibecode/skills/frontend-design.md) — skill · 1025790 installs
- [design-taste-frontend](https://affpapa.org/en/nevibecode/skills/design-taste-frontend.md) — skill · 678700 installs
- [prototype](https://affpapa.org/en/nevibecode/skills/prototype.md) — skill · 986201 installs
- [hyperframes](https://affpapa.org/en/nevibecode/skills/heygen-com-hyperframes.md) — skill · 1200000 installs
- [hyperframes-cli](https://affpapa.org/en/nevibecode/skills/heygen-com-hyperframes-cli.md) — skill · 1300000 installs
- [webapp-testing](https://affpapa.org/en/nevibecode/skills/webapp-testing.md) — skill · 186758 installs

From the same set: [spences10/svelte-skills-kit](https://affpapa.org/en/nevibecode/by/spences10/svelte-skills-kit.md) — 4 cards

---
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
