원클릭으로
svelte
Svelte 5 and SvelteKit documentation lookup and code analysis. Use when writing or debugging Svelte components.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Svelte 5 and SvelteKit documentation lookup and code analysis. Use when writing or debugging Svelte components.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Critical instructions on how to create and test SvelteKit API endpoints
SQLite Database skill for LD's admin shared.db + per-dict dictionaries/<id>.db (content) — how to WRITE DB/sync/schema/migration code AND how to READ/query the live local and production VPS databases (user/dictionary lookups, schema state, edits). wa-sqlite in browsers + better-sqlite3 on the VPS, sync engines, schema, migrations, queries, live reactive UI data.
Log in as any user — site admin, super manager, dictionary manager/editor/contributor, or plain visitor — in dev/e2e browser testing without a real inbox or hand-minted tokens. Read before any puppeteer/curl session that needs an authenticated LD user.
Read the LD client_logs telemetry — browser errors/crashes/sessions AND server-side events — to debug an issue, see what a user did, or verify telemetry. Read this whenever you need to look at the logs for ANY reason, in local dev (site/.data/logs.db) or production (the living VPS).
Query the live browser wa-sqlite DBs (admin shared.db + per-dict dict.db) via the local dev proxy. Use to inspect or debug local data — dirty rows, sync watermarks, entries/senses, catalog, messages, users — without opening DevTools.
UI design guidelines (CSS, icons, theme) and svelte-look component stories for visual screenshot verification. Read when building or modifying the SvelteKit web app components.
| name | svelte |
| description | Svelte 5 and SvelteKit documentation lookup and code analysis. Use when writing or debugging Svelte components. |
Svelte 5 and SvelteKit documentation and code analysis via the official Svelte MCP server, exposed as simple CLI tools.
svelte-docs.jssvelte-fix.js/home/jacob/code/living-dictionaries/.claude/skills/svelte/svelte-docs.js --list
Lists all available Svelte 5 and SvelteKit documentation sections with use_cases and paths. Use this FIRST to discover what documentation is available, then fetch the relevant sections.
/home/jacob/code/living-dictionaries/.claude/skills/svelte/svelte-docs.js "$state"
/home/jacob/code/living-dictionaries/.claude/skills/svelte/svelte-docs.js routing
/home/jacob/code/living-dictionaries/.claude/skills/svelte/svelte-docs.js "$state" "load functions" routing
/home/jacob/code/living-dictionaries/.claude/skills/svelte/svelte-docs.js cli/overview
Fetches full documentation for one or more sections. Accepts titles (e.g., "$state", "routing") or file paths (e.g., "cli/overview"). Pass multiple section names to fetch them all at once.
/home/jacob/code/living-dictionaries/.claude/skills/svelte/svelte-fix.js site/src/lib/export/Progress.svelte
Analyzes a Svelte component file and returns issues and suggestions. Always use this after writing Svelte code to catch problems.
$stateOnly use the $state rune for variables that should be reactive — in other words, variables that cause an $effect, $derived or template expression to update. Everything else can be a normal variable.
Objects and arrays ($state({...}) or $state([...])) are made deeply reactive, meaning mutation will trigger updates. This has a trade-off: in exchange for fine-grained reactivity, the objects must be proxied, which has performance overhead. In cases where you're dealing with large objects that are only ever reassigned (rather than mutated), use $state.raw instead. This is often the case with API responses, for example.
$derivedTo compute something from state, use $derived rather than $effect:
// do this
let square = $derived(num * num);
// don't do this
let square;
$effect(() => {
square = num * num;
});
[!NOTE]
$derivedis given an expression, not a function. If you need to use a function (because the expression is complex, for example) use$derived.by.
Deriveds are writable — you can assign to them, just like $state, except that they will re-evaluate when their expression changes.
If the derived expression is an object or array, it will be returned as-is — it is not made deeply reactive. You can, however, use $state inside $derived.by in the rare cases that you need this.
$effectEffects are an escape hatch and should mostly be avoided. In particular, avoid updating state inside effects.
{@attach ...}$inspectcreateSubscriberNever wrap the contents of an effect in if (browser) {...} or similar — effects do not run on the server.
$propsIn SvelteKit +page.svelte and +layout.svelte files, don't manually type page props — they're automatically typed by SvelteKit. Just use let { data } = $props() without a type annotation.
Treat props as though they will change. For example, values that depend on props should usually use $derived:
// @errors: 2451
let { type } = $props();
// do this
let color = $derived(type === 'danger' ? 'red' : 'green');
// don't do this — `color` will not update if `type` changes
let color = type === 'danger' ? 'red' : 'green';
$inspect.trace$inspect.trace is a debugging tool for reactivity. If something is not updating properly or running more than it should you can add $inspect.trace(label) as the first line of an $effect or $derived.by (or any function they call) to trace their dependencies and discover which one triggered an update.
Any element attribute starting with on is treated as an event listener:
<button onclick={() => {...}}>click me</button>
<!-- attribute shorthand also works -->
<button {onclick}>...</button>
<!-- so do spread attributes -->
<button {...props}>...</button>
If you need to attach listeners to window or document you can use <svelte:window> and <svelte:document>:
<svelte:window onkeydown={...} />
<svelte:document onvisibilitychange={...} />
Avoid using onMount or $effect for this.
Snippets are a way to define reusable chunks of markup that can be instantiated with the {@render ...} tag, or passed to components as props. They must be declared within the template.
{#snippet greeting(name)}
<p>hello {name}!</p>
{/snippet}
{@render greeting('world')}
[!NOTE] Snippets declared at the top level of a component (i.e. not inside elements or blocks) can be referenced inside
<script>. A snippet that doesn't reference component state is also available in a<script module>, in which case it can be exported for use by other components.
Prefer to use keyed each blocks — this improves performance by allowing Svelte to surgically insert or remove items rather than updating the DOM belonging to existing items.
[!NOTE] The key must uniquely identify the object. Do not use the index as a key.
Avoid destructuring if you need to mutate the item (with something like bind:value={item.count}, for example).
If you have a JS variable that you want to use inside CSS you can set a CSS custom property with the style: directive.
<div style:--columns={columns}>...</div>
You can then reference var(--columns) inside the component's <style>.
Consider using context instead of declaring state in a shared module. This will scope the state to the part of the app that needs it, and eliminate the possibility of it leaking between users when server-side rendering.
Use createContext rather than setContext and getContext, as it provides type safety.