Svelte 5 Coder LLM

A specialized local LLM for Svelte 5 and SvelteKit development, optimized for use as an IDE coding assistant (e.g., in Antigravity).

Overview

  • Base Model: Llama 3 (8B)
  • Specialization: Strictly enforces Svelte 5 syntax (Runes, Snippets, Event Attributes).
  • Optimization: Tuned for conciseness, low latency, and direct code output (no conversational filler).

Features

1. Strict Svelte 5 Syntax

The model is engineered to avoid legacy Svelte 4 patterns.

  • ✅ Uses $state(), $derived(), $effect()
  • ✅ Uses onclick={handler} (Standard HTML attributes)
  • No export let, $:, or on:click

2. IDE Integration

Designed to act as a pair programmer:

  • Concise: Minimal explanations, maximum code.
  • Diff-Friendly: Outputs clean code blocks ready for insertion.
  • Tool Aware: Knows about svelte-mcp tools for documentation lookup.

Setup & Usage

Prerequisites

  • Ollama installed and running.
  • Python 3.

Build the Model

The model is built using a Python script that assembles the Modelfile with the correct template and system prompts.

  1. Generate Modelfile:

    python3 build_modelfile.py
    
  2. Create Ollama Model:

    ollama create svelte5-coder -f Modelfile
    

Run the Model

ollama run svelte5-coder "create a counter component using runes"

Project Structure

  • build_modelfile.py: Script to generate the Modelfile. Contains the System Prompt, Few-Shot Examples, and Template configuration.
  • Modelfile: The generated configuration file for Ollama.
  • svelte-knowledge_base_small.txt: Compressed Svelte 5 documentation (optional/reference).
  • svelte5-core.txt / sveltekit-core.txt: Raw documentation files.

Development Notes

Syntax Enforcement Strategy: We found that injecting the entire Svelte documentation caused the 8B model to revert to legacy syntax due to the prevalence of older patterns in its pre-training or noise in the docs. Solution: We rely on a strong System Prompt with Few-Shot Examples to strictly enforce Svelte 5 patterns, while keeping the context window clean.

Top categories

Loading Svelte Themes