Skip to main content
skill CX Codex

svelte · mindrally — Claude Code skill: what it does, how to install

Guides AI assistants through modern Svelte 5 and SvelteKit development, covering runes, snippets, SSR, and Svelte 4 migration.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill svelte -a claude-code
Open on GitHub

What svelte does

This skill instructs coding agents to write idiomatic Svelte 5 and SvelteKit code. It enforces explicit reactivity using runes: $state replaces reactive variables, $derived replaces computed statements, and $effect replaces reactive code blocks. Event handling shifts to regular HTML attributes like onclick, eliminating legacy event modifiers in favor of calling e.preventDefault() inside handlers.

Markup patterns rely on {#snippet} and {@render} instead of classic <slot> elements. Within SvelteKit, the guidelines prioritize server load functions, form actions, and minimal client-side JavaScript. Shared state stays inside .svelte.js or .svelte.ts files using runes or state classes, steering models away from external state packages by default.

Runes act as compiler primitives. Writing import { $state } from 'svelte' breaks compilation immediately. When editing legacy Svelte 4 repositories, the instructions keep the existing export let and $: patterns intact rather than mixing two distinct reactivity paradigms in the same file.

What it helps with

  • migrate components from Svelte 4 reactive statements to Svelte 5 runes
  • replace legacy slots with composable snippets and render tags
  • write SvelteKit server load functions and form actions with minimal client JS
  • manage application state cleanly using reactive classes and .svelte.ts modules

Example prompts for the agent

  • Refactor this legacy component to Svelte 5 runes and snippets.
  • Build a SvelteKit route with a server load function and form actions.
  • Convert this slot-based markup into a parameterized Svelte 5 snippet.

How to install svelte

1Skills CLI (Vercel)

npx skills add Mindrally/skills --skill svelte -a claude-code

2Manually: put the files in place

~/.claude/skills/svelte/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/svelte/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about svelte

How to install svelte in Claude Code?

Run npx skills add Mindrally/skills --skill svelte -a claude-code. The prompt file will be placed at ~/.claude/skills/svelte/SKILL.md.

What does the svelte skill do?

It enforces modern Svelte 5 runes, SvelteKit data loading conventions, and correct migration boundaries during code generation.

Do Svelte 5 runes need to be imported?

No, runes are compiler syntax and must never be imported. Only utilities like tick, untrack, mount, or unmount use explicit imports.

Source text

SKILL.md · Apache-2.0
---
name: svelte
description: "Modern Svelte 5 and SvelteKit development covering runes-based reactivity, snippets, SSR/SSG, and state management, including migration notes from legacy Svelte 4 syntax. Use when writing or reviewing Svelte components, deciding between runes and legacy reactive statements, building SvelteKit routes and load functions, or migrating a Svelte 4 codebase to Svelte 5."
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# Svelte / SvelteKit

This skill covers Svelte and SvelteKit development with deep knowledge of SSR, SSG, and modern web patterns, including the Svelte 5 runes system and how it differs from legacy Svelte 4 reactivity.

## Core Principles

- Write concise, technical components with accurate SvelteKit examples
- Emphasize SSR/SSG capabilities and performance optimization
- Use TypeScript with proper naming conventions
- Prioritize minimal client-side JavaScript through server-side rendering
- Follow functional and declarative programming patterns

## Svelte 5 Runes

Svelte 5 introduces runes — compiler-level primitives that make reactivity explicit, replacing Svelte 4's implicit `let`/`$:` reactivity.

- Use `$state` for reactive state (replaces plain `let` bindings that needed reactivity)
- Use `$derived` for computed values (replaces `$: computed = ...`)
- Use `$effect` for side effects (replaces `$: { ... }` blocks)
- Use `$props` for component properties (replaces `export let prop`)
- Use `$bindable` for two-way bindable props (replaces implicit `bind:` support on exported props)
- Use `$inspect` during development to log reactive value changes
- Runes are compiler syntax, not imports — never `import { $state } from 'svelte'`. Only import genuine utilities that still require it, such as `tick`, `untrack`, `mount`, or `unmount`.

### Svelte 4 vs. Svelte 5

**Svelte 4 (legacy reactivity):**
```svelte
<script>
  let count = 0;
  $: double = count * 2;
  $: {
    if (count > 10) alert('Too high!');
  }
</script>
<button on:click={() => count++}>{count} / {double}</button>
```

**Svelte 5 (runes):**
```svelte
<script>
  let count = $state(0);
  let double = $derived(count * 2);

  $effect(() => {
    if (count > 10) alert('Too high!');
  });
</script>
<button onclick={() => count++}>{count} / {double}</button>
```

Key differences to apply when writing or reviewing components:

1. **Reactivity is explicit** — `$state()` marks reactive variables, `$derived()` replaces `$:` for computed values, `$effect()` replaces `$: {}` blocks for side effects.
2. **Event handling is standardized** — Svelte 5 treats event handlers as ordinary HTML properties (`onclick={handler}`) instead of Svelte-specific directives (`on:click={handler}`). There are no more event modifiers like `|preventDefault`; call `e.preventDefault()` inline instead: `onclick={e => { e.preventDefault(); handler(e); }}`.
3. **Component props** use `let { propName } = $props()` instead of multiple `export let propName` declarations. Mark a prop bindable from the parent with `$bindable()`.
4. **Snippets replace slots** for most reusable markup — `{#snippet name(params)}...{/snippet}` and `{@render name(args)}` reduce duplication and are more composable than named slots. Existing `<slot>` usage still works but prefer snippets in new Svelte 5 code.

When maintaining an existing Svelte 4 codebase, keep using `export let`, `on:event`, and `$:` reactive statements consistently within that codebase rather than mixing paradigms — full-file migrations to runes should be deliberate, not incidental.

## Styling

- Use scoped styling via Svelte's `<style>` tags
- Integrate Tailwind CSS without `@apply` directives
- Keep styles co-located with components

## State Management

- Use Svelte stores (or exported `$state` in `.svelte.js`/`.svelte.ts` modules under Svelte 5) for shared state
- Implement state management via classes for complex scenarios, using `$state` fields for reactive class properties
- Leverage Svelte's reactivity system effectively rather than reaching for external state libraries by default

## SvelteKit Features

- Use file-based routing
- Implement proper load functions
- Handle errors appropriately
- Use form actions for mutations
- Leverage server-side data loading

## Performance

- Focus on Web Vitals optimization
- Minimize client-side JavaScript
- Use preloading for faster navigation
- Implement lazy loading where appropriate

## Internationalization

- Use Paraglide.js for i18n support
- Implement proper locale handling

## Testing

- Use Vitest for unit testing
- Use Lighthouse for performance auditing
- Write comprehensive component tests

## Accessibility

- Ensure accessibility compliance
- Use semantic HTML
- Implement proper ARIA attributes

© Mindrally · Apache-2.0 · Mindrally/skills

Similar skills

Everything for Frontend and UI →

svelte by other authors comes first.

svelte vercel-labs Guides AI coding agents through building Svelte 5 component trees from json-render specs, including state, events, bindings, and catalogs. CX Codex +1 1,200installs svelte Claude MPM Team Get Svelte 5 guidance for reactive components and SvelteKit apps. Use it when building UI state, bindings, routes, or data-loading flows. CX Codex +1 343installs frontend-design official anthropics This skill guides intentional visual design for new interfaces and redesigns. Use it when a generic generated UI is not enough. 1,025,790installs design-taste-frontend Leonxlnx This skill directs the design of public pages and work screens, then checks the result in a browser through screenshots. Use it when an interface feels generic or unfinished. CX Codex +1 678,700installs prototype Matt Pocock Creates throwaway prototypes for checking state logic or exploring UI before committing the decision to the main codebase. 986,201installs hyperframes heygen-com Instructs coding agents on creating, validating, and rendering HTML-based videos using the HyperFrames framework and CLI. CX Codex +1 1,200,000installs hyperframes-cli heygen-com Controls HyperFrames video workflows from the CLI: audits layouts and contrast, edits timeline clips, captures snapshots, and renders locally or in cloud runtimes. CX Codex +1 1,300,000installs webapp-testing official anthropics This skill tests local web apps with Playwright, helping agents debug UI behavior, capture screenshots, and inspect browser logs. 186,758installs

From the same set214

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor