TerminalSkills/skills

svelte

Svelte is a compiler-based UI framework that turns components into minimal vanilla JavaScript with no virtual DOM; SvelteKit adds routing, SSR and deployment adapters.

View source

How to use

  1. Copy the installation command and review the source package before installing it in your own agent environment.
  2. Check the source document for required tools, credentials and supported hosts.
  3. Describe your input and desired deliverable; review the output against the source material.
npx skills add https://github.com/TerminalSkills/skills --skill svelte

Before you start

  • Installation does not include a model subscription, API allowance or permission to access your files.
  • Repository stars and installation counts describe activity, not an independent quality or security test.
Original skill document

Rendered from the source repository. Headings, examples, code, tables, links, and referenced images are preserved.

Svelte — Compile-Time Reactive UI Framework

Overview

Svelte shifts work from runtime to compile time, producing minimal vanilla JavaScript with no virtual DOM. Svelte 5 introduces runes — explicit reactivity primitives that replace $: declarations and stores. SvelteKit provides SSR, routing, and deployment adapters; this skill was checked against Svelte 5.57 and SvelteKit 3.

Instructions

Runes Reference

`$state` — reactive state (deep by default):

svelte
<script lang="ts">
  let count = $state(0);
  let user = $state({ name: "Alice", age: 30 });
  user.age++;  // deep reactivity — triggers updates
</script>

`$state.raw` — shallow reactive (must reassign to trigger):

svelte
<script>
  let items = $state.raw([1, 2, 3]);
  items = [...items, 4];  // must reassign
</script>

`$state.snapshot` — plain non-reactive copy:

svelte
<script>
  let form = $state({ name: "", email: "" });
  const data = $state.snapshot(form);  // plain object for API calls
</script>

`$derived` and `$derived.by` — computed values:

svelte
<script>
  let price = $state(100);
  let quantity = $state(3);
  let total = $derived(price * quantity);

  let summary = $derived.by(() => {
    const t = items.reduce((sum, i) => sum + i.price, 0);
    return { total: t, count: items.length, avg: t / items.length };
  });
</script>

`$effect` — side effects with cleanup:

svelte
<script>
  let query = $state("");
  $effect(() => {
    if (!query) return;
    const controller = new AbortController();
    fetch(`/api/search?q=${encodeURIComponent(query)}`, { signal: controller.signal })
      .then(r => r.json()).then(data => { results = data; });
    return () => controller.abort();
  });
</script>

`$props` — component props:

svelte
<script>
  let { label, variant = "primary", onclick, class: className = "", ...rest } = $props();
</script>
<button class="btn btn-{variant} {className}" {onclick} {...rest}>{label}</button>

`$bindable` — two-way binding:

svelte
<!-- Input.svelte -->
<script>
  let { value = $bindable(""), placeholder = "" } = $props();
</script>
<input bind:value {placeholder} />

`$inspect` — debug reactive values (dev only):

svelte
<script>
  $inspect(count, doubled);
  $inspect(count).with((type, value) => console.log(`[${type}]`, value));
</script>

Snippets (Replacing Slots)

Svelte 5 replaces slots with typed, reusable markup fragments:

svelte
<!-- List.svelte -->
<script>
  let { items, row, children } = $props();
</script>
<ul>
  {#each items as item}
    <li>{@render row(item)}</li>
  {/each}
</ul>
{@render children?.()}
svelte
<!-- Parent.svelte -->
<List {items}>
  {#snippet row(item)}
    <strong>{item.name}</strong> — {item.description}
  {/snippet}
</List>

Stores (Shared State)

typescript
// stores/cart.ts — Writable store (Svelte 4 style, still works)
import { writable, derived } from "svelte/store";

export const cart = writable<CartItem[]>([]);
export const cartTotal = derived(cart, ($cart) =>
  $cart.reduce((sum, item) => sum + item.price * item.quantity, 0)
);

Svelte 5 alternative — $state in .svelte.ts modules:

typescript
// state/counter.svelte.ts
let count = $state(0);
let doubled = $derived(count * 2);

export function getCounter() {
  return {
    get count() { return count; },
    get doubled() { return doubled; },
    increment() { count++; },
  };
}

Transitions

svelte
<script>
  import { fade, fly, slide } from "svelte/transition";
  import { flip } from "svelte/animate";
  let items = $state(["Apple", "Banana"]);
</script>
{#each items as item (item)}
  <div animate:flip={{ duration: 300 }} transition:fade>{item}</div>
{/each}

Migration from Svelte 4

Svelte 4Svelte 5
let count = 0let count = $state(0)
$: doubled = count * 2let doubled = $derived(count * 2)
$: { sideEffect() }$effect(() => { sideEffect() })
export let proplet { prop } = $props()
<slot />{@render children()}
<slot name="header" />{@render header?.()}
Svelte stores$state in .svelte.ts files

SvelteKit 3

bash
npx sv create my-shop --template minimal --types ts --no-add-ons --install npm
cd my-shop && npm run dev

Changes from SvelteKit 2 that break copied code: Svelte options and the adapter are passed to the sveltekit() plugin in vite.config.ts (there is no svelte.config.js); the $lib alias is gone, so import with #lib/... and the full file extension (#lib/stores/cart.ts, #lib/state/counter.svelte.ts, #lib/Button.svelte); base/assets are removed from $app/paths; Node 22.17+, Vite 8 and TypeScript 6 are required.

svelte
<!-- +page.svelte -->
<script>
  let { data } = $props();  // from +page.ts load function
</script>
<h1>{data.title}</h1>

Examples

Example 1: Shopping cart with stores

src/lib/stores/cart.ts exports cart (a writable<CartItem[]>), cartTotal (a derived sum of price times quantity) and removeFromCart(id) (cart.update(items => items.filter(i => i.id !== id))). The component renders the items and, for a cart holding two keyboards at 49.50, shows Total: $99.00.

svelte
<!-- CartSummary.svelte -->
<script lang="ts">
  import { cart, cartTotal, removeFromCart } from "#lib/stores/cart.ts";
</script>
<div class="cart">
  {#each $cart as item (item.id)}
    <div>{item.name} x {item.quantity} — ${(item.price * item.quantity).toFixed(2)}
      <button onclick={() => removeFromCart(item.id)}>Remove</button>
    </div>
  {/each}
  <p>Total: ${$cartTotal.toFixed(2)}</p>
</div>

Example 2: Async data fetching with $effect

svelte
<script>
  let userId = $state(1);
  let user = $state(null);
  let loading = $state(false);

  $effect(() => {
    const controller = new AbortController();
    loading = true;
    fetch(`/api/users/${userId}`, { signal: controller.signal })
      .then(r => r.json())
      .then(data => { user = data; loading = false; })
      .catch(e => { if (e.name !== "AbortError") loading = false; });
    return () => controller.abort();  // cancels the stale request when userId changes
  });
</script>
{#if loading}<p>Loading...</p>
{:else if user}<p>{user.name}</p>{/if}

Guidelines

  1. Runes for state — Use $state(), $derived(), $effect() in Svelte 5; cleaner than Svelte 4's $: syntax
  2. Scoped styles — CSS in <style> is component-scoped; no CSS modules needed
  3. Stores vs runes — Use $state in .svelte.ts for new code; writable/derived stores still work
  4. Transitions built-in — Use transition:fade, transition:fly; no animation library needed
  5. Small bundles — Svelte compiles away; typical app ships 5-10KB vs 40KB+ for React
  6. SvelteKit for full-stack — SSR, routing, API endpoints, deployment adapters. In SvelteKit 3 use #lib/... imports with extensions, not $lib
  7. TypeScript — Use <script lang="ts"> for type-safe components
  8. Actions for DOM — Use use:action for reusable DOM behavior (click-outside, tooltip)
  9. Do not export reassigned `$state` — a module-level $state that is reassigned cannot be exported directly; export getter functions or mutate an object instead (as in counter.svelte.ts)
from this repository

More skills

All skills
TerminalSkills
Community

3dsmax-rendering

Scripts and configures production rendering in Autodesk 3ds Max with the V-Ray and Corona renderers: output size and files, render elements, denoising, light mix, batch and command-line rendering, and network rendering. Use when a user asks to set up a production render, render several cameras in one batch, render from the command line or on a render farm, add render passes for compositing, or cut render time for archviz and product shots.

installs
0
GitHub stars
180
Updated
Oct 25
TerminalSkills
Community

3dsmax-scripting

Covers scripting Autodesk 3ds Max, the 3D modeling and rendering application, with MAXScript and Python (pymxs): scene manipulation, object creation, material assignment, camera and light setup, batch operations, and file I/O. Use when tasks involve automating repetitive 3ds Max workflows, batch processing scenes, running scripts headless with 3dsmaxbatch, creating custom tools, or scripting scene setup for archviz, product visualization, or VFX.

installs
0
GitHub stars
180
Updated
Oct 25
TerminalSkills
Community

3proxy

3proxy is a small open-source proxy server that runs HTTP/HTTPS, SOCKS4/5, SNI and TCP/UDP port-mapping proxies from one config file. Use when a user asks to set up an HTTP or SOCKS5 proxy, add proxy users and passwords, write 3proxy access rules, chain or rotate upstream (parent) proxies, limit bandwidth, connections or monthly traffic per user, run 3proxy in Docker, or fix a 3proxy.cfg that will not start.

installs
0
GitHub stars
180
Updated
Oct 25
TerminalSkills
Community

a2a-protocol

Builds Agent2Agent (A2A) servers and clients, the open protocol (originally from Google, now under the Linux Foundation) that lets AI agents from different frameworks call each other. Use when the user wants to create an A2A-compliant agent, build an Agent Card, implement task management, connect agents across frameworks, set up agent discovery, handle streaming responses, implement push notifications, or orchestrate multi-agent workflows. Trigger words: a2a, agent to agent, agent2agent, a2a pro

installs
0
GitHub stars
180
Updated
Oct 25