agentleFS
G1JoshiG1Joshi/Agent-Skills/skills/frameworks/svelte/SKILL.md

svelte

Skill15 starsChanged 44 days agoMITView on GitHub

Expert Svelte assistance covering Svelte 5 Runes, reactive declarations, stores, animations, and transitions. Use when building fast, reactive web UIs with minimal boilerplate.

9 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use modern Svelte 5 Runes ($state, $derived, $effect):

    line 66
  2. Very specific:

    Use Runes: Migrate from legacy let syntax to $state and $derived for explicit reactivity.

    line 87
  3. Very specific:

    Use onclick: Svelte 5 prefers native attributes (onclick) over on:click directives.

    line 88
  4. Very specific:

    Use Snippets: Replace slots with Snippets for better type safety and flexibility.

    line 89

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Svelte

Svelte compiles declarative components into minimal vanilla JavaScript, utilizing explicit Runes for fine-grained reactivity without Virtual DOM overhead.

When to Use

  • High Performance defaults: Svelte apps are tiny and fast by default.
  • Embedded Apps: Great for widgets/embeds because of small bundle size.
  • Simplicity: HTML, CSS, and JS in one file, with very little boilerplate.

Quick Start

<script>
  let count = $state(0);
  let double = $derived(count * 2);

  function increment() {
    count += 1;
  }
</script>

<button onclick={increment}>
  Count: {count} / Double: {double}
</button>

Core Concepts

Runes

Svelte 5 reactivity markers.

  • $state: Declares reactive state.
  • $derived: Declares a value that updates when dependencies change.
  • $effect: Runs code when dependencies change (side effects).
  • $props: Declares component props.

Snippets

Reusable chunks of markup within a component.

{#snippet figure(src, caption)}
  <figure>
    <img {src} alt={caption} />
    <figcaption>{caption}</figcaption>
  </figure>
{/snippet}

{@render figure(imageSrc, "A nice image")}

Common Patterns

Svelte 5 Runes for Fine-Grained Reactive State

Problem: Legacy Svelte 3/4 let bindings and $: labels lack universal TypeScript ergonomics across .svelte.ts modules.

Solution: Use modern Svelte 5 Runes ($state, $derived, $effect):

<script lang="ts">
  let count = $state(0);
  let double = $derived(count * 2);

  $effect(() => {
    console.log(`Count changed to: ${count}`);
  });
</script>

<button on:click={() => count++}>
  Count: {count} (Double: {double})
</button>

Best Practices

Do:

  • Use Runes: Migrate from legacy let syntax to $state and $derived for explicit reactivity.
  • Use onclick: Svelte 5 prefers native attributes (onclick) over on:click directives.
  • Use Snippets: Replace slots with Snippets for better type safety and flexibility.

Don't:

  • Rely on auto-reactivity (Legacy): In Svelte 5 settings, opting into Runes disables the "magic" assignment tracking of Svelte 3/4.
  • Mutate state directly across component boundaries without explicit callbacks or binding props.

Troubleshooting

ErrorCauseSolution
Array/Object mutation not triggering update in Svelte 3/4Mutating array in-place without reassignment (arr.push(x)).Reassign array: arr = [...arr, x] or upgrade to Svelte 5 $state().
Cannot bind to undefined propertyMissing export let propName in child component definition.Declare export let propName; (Svelte 3/4) or let { propName } = $props() (Svelte 5).
Component is not defined in scriptTypo in import or relative path missing .svelte file extension.Include explicit .svelte extension on component imports.

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.