smithery/spences10

sveltekit-patterns

SvelteKit patterns for devhub-crm. Use for remote functions (query, form, command), routing, and server-side logic.

Installation

$ npx skills add smithery/spences10 --skill sveltekit-patterns

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/spences10 · top by installs.

npx skills add smithery/spences10

Browse all from smithery/spences10

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,619 B
  • docs SUMMARY.md 141 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

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](references/remote-functions.md) - Complete

remote functions API

  • [routing.md](references/routing.md) - File-based routing patterns
  • [database-patterns.md](references/database-patterns.md) - Advanced

database queries