From svelte-v4
Use when writing or modifying Svelte v4 components (.svelte files targeting svelte@^4). Triggers - "Svelte 4", "Svelte v4", "legacy Svelte", projects with `"svelte": "^4"` in package.json. CRITICAL - do NOT use Svelte 5 runes ($state, $derived, $effect, $props, $bindable, $inspect) or snippets ({#snippet}, {@render}) here. For Svelte 5 projects skip this skill.
How this skill is triggered — by the user, by Claude, or both
Slash command
/svelte-v4:svelte-v4The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Expert guidance for authoring Svelte v4 components. Covers core runtime and template syntax only — **SvelteKit is out of scope** for this skill.
Expert guidance for authoring Svelte v4 components. Covers core runtime and template syntax only — SvelteKit is out of scope for this skill.
Activate on any of:
.svelte and the project's package.json lists svelte@^4 / ~4.x / exact 4.x.y.export let, $:, createEventDispatcher, <slot> — all v4 idioms.svelte@^5 in package.json — use runes/snippets idioms instead.$state, $derived, $effect, {#snippet}, {@render} — it is Svelte 5.load, form actions, hooks.server.ts — that's a different domain.Before editing any .svelte file:
Read package.json at the project root.devDependencies.svelte or dependencies.svelte.^4.x, ~4.x, or an exact 4.x.y → this skill applies.^5.x / next / beta → abort and use Svelte 5 idioms.svelte entry or ambiguous (git dep, workspace *) → ask the user which major version.Never generate or suggest:
$state, $state.raw, $state.snapshot, $derived, $derived.by, $effect, $effect.pre, $effect.root, $effect.tracking, $props, $bindable, $inspect, $host.{#snippet name(params)}…{/snippet}, {@render snippet(args)}, children prop as a function.untrack(), mount(), hydrate(), unmount(), getAllContexts() usage outside init, svelte/reactivity classes (SvelteMap, SvelteSet, SvelteDate, SvelteURL).$host() for custom-element exports.If the user asks for any of those, stop and confirm — they may be in the wrong skill.
<script lang="ts">
import { onMount, createEventDispatcher, tick } from 'svelte';
import { writable, derived } from 'svelte/store';
export let count = 0; // prop with default
export let label: string; // required prop
export const version = '1.0'; // read-only export
const dispatch = createEventDispatcher<{ change: number }>();
const store = writable(0);
const doubled = derived(store, ($s) => $s * 2);
$: parity = count % 2 === 0 ? 'even' : 'odd'; // reactive declaration
$: if (count > 10) dispatch('change', count); // reactive side-effect
onMount(() => {
const id = setInterval(() => store.update((n) => n + 1), 1000);
return () => clearInterval(id);
});
function increment() {
count += 1;
}
</script>
<button on:click={increment} class:big={count > 5}>
{label}: {count} ({parity}) — store={$store}, doubled={$doubled}
</button>
<slot name="footer" {count} />
<style>
button { padding: 0.5rem 1rem; }
.big { font-size: 1.25rem; }
</style>
Load the relevant reference file when you need detail — don't guess. Paths are relative to this skill directory.
references/component.md — component anatomy, props, events, slots, bindings, TypeScript, client-side API (new Component, $set, $on, $destroy).references/reactivity.md — $: labels, stores (writable / readable / derived), auto-subscription, common pitfalls.references/lifecycle.md — onMount, onDestroy, beforeUpdate, afterUpdate, tick, Context API, SSR gotchas.references/template.md — {#if} / {#each} / {#await} / {#key}, directives (class:, style:, use:, transition:, animate:), special elements (<svelte:…>), actions, built-in transitions/animations.references/motion.md — svelte/motion (tweened, spring) and svelte/easing (31 named functions).references/accessibility.md — full list of a11y-* compile warnings with descriptions, common fix patterns.Canonical reference: https://v4.svelte.dev/docs/. Svelte does not ship an llms.txt for v4 (only v5) — use WebFetch against specific v4 doc pages when you need detail beyond this skill:
https://v4.svelte.dev/docs/component-formathttps://v4.svelte.dev/docs/template-syntaxhttps://v4.svelte.dev/docs/special-elementshttps://v4.svelte.dev/docs/svelte (module: onMount, tick, createEventDispatcher, etc.)https://v4.svelte.dev/docs/svelte-store, /svelte-motion, /svelte-transition, /svelte-animate, /svelte-easing, /svelte-actionhttps://v4.svelte.dev/docs/client-side-component-apihttps://v4.svelte.dev/docs/typescripthttps://v4.svelte.dev/docs/accessibility-warningsexport let → $props, $: → $derived/$effect, slots → snippets, createEventDispatcher → callback props) and confirm scope first.Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
npx claudepluginhub aimuzov/claude-svelte-v4 --plugin svelte-v4