一键导入
svelte
// Svelte 5 component patterns for `.svelte` files: runes, snippets, keyed lifecycles, `{#await}`, TanStack Query, SvelteMap, shadcn-svelte, and workspace observers. Use when editing Svelte components or Svelte state modules.
// Svelte 5 component patterns for `.svelte` files: runes, snippets, keyed lifecycles, `{#await}`, TanStack Query, SvelteMap, shadcn-svelte, and workspace observers. Use when editing Svelte components or Svelte state modules.
How a workspace-backed app under `apps/*` is composed: the isomorphic doc factory (`create<App>`), the environment factories (`open<App>Browser` / `open<App>Extension` / tauri), the `#platform/*` build-time platform DI for multi-platform (Tauri) apps, the `session` singleton, daemon/script placement under per-project `workspaces/<app>/`, and the file layout itself. Use when creating a new app, naming or placing the iso/browser/extension factory, wiring `#platform/*` subpath imports for a Tauri seam, choosing between auth-gated (Shape A) vs module-singleton (Shape B), placing the session singleton, or registering daemon/script bindings.
Epicenter auth packages: `@epicenter/auth` and the Svelte wrapper at `@epicenter/svelte/auth`, OAuth sessions, identity state, auth-owned fetch/WebSocket, and workspace lifecycle binding. Use when editing Epicenter auth clients, session state, hosted sign-in, or auth/workspace integration.
Better Auth security hardening: rate limits, secrets, CSRF, trusted origins, cookies, sessions, OAuth tokens, and audit logging. Use when reviewing auth security, brute-force protection, token handling, or deployment safety.
Tauri commands, permissions, capabilities, security config, path handling, cross-platform file ops, and native filesystem APIs. Use when mentioning Tauri, desktop apps, Rust commands, invoke, capabilities, permissions, ResourceId, file paths, or platform differences.
Run a continuous collapse-and-simplify pass that surgically removes indirection failing to earn its boundary. Use when the user says 'collapse pass', 'simplify pass', 'reduce indirection', 'shrink the surface', 'find what to delete', when asking to audit a package for dead abstractions, or when the goal is a sequence of small refactor commits that delete more than they add. Pairs with code-audit (smell catalog), refactoring (per-change mechanics), one-sentence-test (cohesion gate), cohesive-clean-breaks (deep redesigns), approachability-audit (first-read sanity), and post-implementation-review (second-read after each commit).
TypeScript config conventions for this monorepo: the two-base layering, the eight leaf tiers, and the never-redeclare list. Use when adding a package, editing any tsconfig.json, picking a tier for a new app, or debugging module resolution.
| name | svelte |
| description | Svelte 5 component patterns for `.svelte` files: runes, snippets, keyed lifecycles, `{#await}`, TanStack Query, SvelteMap, shadcn-svelte, and workspace observers. Use when editing Svelte components or Svelte state modules. |
| metadata | {"author":"epicenter","version":"2.1"} |
Use this skill for Svelte 5 components and Svelte state modules in Epicenter apps. Keep the first pass focused on Svelte runes, component lifecycle, workspace-backed state, TanStack Query usage, and local UI composition.
When Svelte 5 runes, compiler behavior, SvelteKit integration, or component-library APIs affect correctness, ask DeepWiki a narrow question against sveltejs/svelte or the relevant upstream repo before relying on memory. Use it to orient, then verify decisive details against local installed types, source, or official docs before changing code.
Skip DeepWiki for stable basics and repo-local patterns already documented here or in references.
query-layer: TanStack Query integrationerror-handling: $lib/report, extractErrorMessage, and component error handlingstyling: CSS and Tailwind conventions, including the flex column scroll trapepicenter-ui: loading, empty, pending, tooltip, and component selection patternsUse this skill when you need to:
$state, $derived, $effect, snippets, and keyed blocks..svelte or .ts files.$state for reactive values that the component mutates. Use $state.raw for large reassigned objects or handles that should not be deep-proxied.$derived for computed state. Treat $effect as an escape hatch for DOM integration, analytics, subscriptions, and external systems.$props() should usually be $derived, not one-time initialization.{@render} over slots for new Svelte 5 code. Type snippet props with Snippet<[...args]>.$: declarations, export let, on:click, <svelte:component>, <svelte:self>, beforeUpdate, afterUpdate, and createEventDispatcher.{#key} or {#if}; open the resource synchronously in the child. Read lifecycle and reactivity.{#await} in the template instead of a $state(false) flag and a cancellation effect.$derived and {@const} only when they compute, narrow, or stabilize something useful.satisfies Record lookup, not nested ternaries or $derived.by() switches.SvelteMap for ID-keyed collections where individual entries need to update reactively. Convert maps to arrays with $derived before passing them to components..svelte files and call mutation.mutate(...) directly from template handlers unless the action earns a semantic helper. Read mutations and workspace inputs.@epicenter/ui loading, empty, pending, and tooltip components before ad hoc markup.Whispering components consume shared RPC adapters through .options inside an accessor:
<script lang="ts">
import { createMutation, createQuery } from '@tanstack/svelte-query';
import { rpc } from '$lib/rpc';
const playbackUrl = createQuery(() =>
rpc.audio.getPlaybackUrl(() => recordingId).options,
);
const transformRecording = createMutation(
() => rpc.transformer.transformRecording.options,
);
</script>
For a component-local operation lifecycle, do not add a new RPC adapter only to observe isPending. Wrap the operation locally:
<script lang="ts">
import { createMutation } from '@tanstack/svelte-query';
import { mutationOptions } from 'wellcrafted/query';
import { startManualRecording } from '$lib/operations/recording';
const startRecording = createMutation(() =>
mutationOptions({
mutationKey: ['recording', 'startManual'],
mutationFn: startManualRecording,
}),
);
</script>
Whispering error presentation goes through $lib/report at the UI or operation boundary:
if (error) {
report.error({ cause: error });
return;
}
SvelteMap, table state, state modules.