Installs just this skill. Get the whole plugin for auto-invocation.
โก How it fires
How this skill gets triggered: by you, by Claude, or both.
Fires itselfClaude auto-loads it when your prompt matches the work.
You can call itInvoke it directly when you want it.
Slash command/bun-sveltekit
๐๏ธ Context preview
The summary Claude sees to decide when to auto-load this skill.
Use when building or running SvelteKit apps on Bun, including SSR, adapters, and Bun-specific APIs
๐ Stats
Stars194
Forks29
LanguageTypeScript
LicenseMIT
๐ฆ Ships with claude-skills
</> SKILL.md
bun-sveltekit.SKILL.md
---name: bun-sveltekit
description: Use when building or running SvelteKit apps on Bun, including SSR, adapters, and Bun-specific APIs
metadata:
keywords: "SvelteKit, Svelte 5, Bun, SSR, adapters, Vite, database, file operations"
license: MIT
---# Bun SvelteKit
Run SvelteKit applications with Bun for faster development and builds.
## Quick Start
```bash
# Create new SvelteKit project
bunx sv create my-app
cd my-app
# Install dependencies
bun install
# Development
bun run dev
# Build
bun run build
# Preview
bun run preview
```
## Secure Installation
Scaffolding tools like `bunx sv create` download and execute remote code. Before running, follow supply chain security best practices:
- **Block post-install scripts** โ Bun disables them by default; allow specific packages via `trustedDependencies` in `package.json`
- **Cooldown period** โ Configure `minimumReleaseAge` in `bunfig.toml` to wait 7 days for new versions
- **Audit before installing** โ Run `socket package score npm <pkg>` or use `socket npm install <pkg>` to check packages
Load the `dependency-upgrade` skill for full security configuration including Socket CLI integration, cooldown setup, lockfile validation, and CI enforcement.
## Project Setup
### package.json
```json
{
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^7.0.0",
"@sveltejs/kit": "^2.0.0",
"svelte": "^5.0.0",
"vite": "^7.3.0"
}
}
```
### Use Bun Adapter
```bash
bun add -D svelte-adapter-bun
```
```javascript
// svelte.config.js
import adapter from "svelte-adapter-bun";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
/** @type {import('@sveltejs/kit').Config} */
export default {
preprocess: vitePreprocess(),
kit: {
adapter: adapter(),
},
};
```
## Using Bun APIs
### Server Load Functions
```typescript
// src/routes/users/+page.server.ts
import { Database } from "bun:sqlite";
import type { PageServerLoad } from "./$types";
export const load: PageServerLoad = async () => {
const db = new Database("data.sqlite");
const users = db.query("SELECT * FROM users").all();
db.close();
return { users };
};
```
### Form Actions
```typescript
// src/routes/users/+page.server.ts
import { Database } from "bun:sqlite";
import type { Actions } from "./$types";
import { fail } from "@sveltejs/kit";
export const actions: Actions = {
create: async ({ request }) => {
const data = await request.formData();
const name = data.get("name") as string;
if (!name) {
return fail(400, { error: "Name required" });
}
const db = new Database("data.sqlite");
db.run("INSERT INTO users (name) VALUES (?)", [name]);
db.close();
return { success: true };
},
delete: async ({ request }) => {
const data = await request.formData();
const id = data.get("id") as string;
const db = new Database("data.sqlite");
db.run("DELETE FROM users WHERE id = ?", [id]);
db.close();
return { success: true };
},
};
```
### API Routes
```typescript
// src/routes/api/users/+server.ts
import { Database } from "bun:sqlite";
import { json } from "@sveltejs/kit";
import type { RequestHandler } from "./$types";
export const GET: RequestHandler = async () => {
const db = new Database("data.sqlite");
const users = db.query("SELECT * FROM users").all();