Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
spences10 avatar

Sveltekit Patterns

  • 1 installs
  • 6 repo stars
  • Updated August 3, 2026
  • spences10/devhub-crm

Provides SvelteKit remote-function patterns for query, form, and command types with valibot validation and user-scoped security.

About

Documents SvelteKit remote functions (query, form, command) with valibot validation, user_id scoping, and .refresh() patterns. A developer uses it for routing and server-side logic in a SvelteKit app.

  • Distinguishes query (read), form (mutations plus redirect), and command types
  • Uses valibot schemas and query.batch() for N+1 prevention

Sveltekit Patterns by the numbers

  • 1 all-time installs (skills.sh)
  • Ranked #1,912 of 2,245 Frontend Development skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/spences10/devhub-crm --skill sveltekit-patterns

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1
repo stars6
Last updatedAugust 3, 2026
Repositoryspences10/devhub-crm

What it does

Provides SvelteKit remote-function patterns for query, form, and command types with valibot validation and user-scoped security.

Files

SKILL.mdMarkdownGitHub ↗

SvelteKit Patterns

Quick Start

// Query: Read data
export const get_contacts = query(() =>
	db.prepare('SELECT * FROM contacts').all(),
);

// Form: Validated mutation with redirect
export const create = form(
	v.object({ name: v.string() }),
	async ({ name }) => {
		db.prepare('INSERT INTO contacts ...').run(id, name);
		redirect(303, '/contacts');
	},
);

// Command: Mutation with refresh
export const delete_contact = command(v.string(), async (id) => {
	db.prepare('DELETE FROM contacts WHERE id = ?').run(id);
	await get_contacts().refresh();
	return { success: true };
});

Core Principles

  • Types: query (read), form (mutations + redirects), command

(mutations only)

  • Validation: Use valibot schemas for all inputs
  • Security: Always include user_id in WHERE clauses
  • Batching: Use query.batch() for N+1 prevention
  • Refresh: Call .refresh() in form/command handlers
  • Use `.current`: Store queries in variables, check

.current === undefined for initial load

  • No manual keys: Never use refresh_key++ or {#key} blocks
  • Return values: Commands must return { success: true }

Reference Files

  • remote-functions.md - Complete

remote functions API

  • routing.md - File-based routing patterns
  • database-patterns.md - Advanced

database queries

Related skills

Frontend Developmentfrontendbackend

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.