Svelte Code Writer

by sveltejs6b5d0dab3c9cNo license332 starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated today

CLI tools for Svelte 5 documentation lookup and code analysis. MUST be used whenever creating, editing or analyzing any Svelte component (.svelte) or Svelte module (.svelte.ts/.svelte.js). If possible, this skill should be executed within the svelte-file-editor agent for optimal results.

Instructions onlySoftware Development
AI-generated overview

Guides an agent to use the @sveltejs/mcp CLI for Svelte 5 documentation lookup and code analysis.

What it does
This skill instructs an agent to run the @sveltejs/mcp command-line tool through npx for Svelte-specific assistance. It covers listing documentation sections, retrieving full documentation for chosen sections, and running a Svelte autofixer that analyzes Svelte code and suggests fixes. It also defines a workflow: look up docs when syntax is uncertain, run the autofixer when reviewing or debugging, and validate before finalizing any Svelte component.
When to use it
Use it when creating, editing, or analyzing Svelte components (.svelte) or Svelte modules (.svelte.ts/.svelte.js). It is intended for checking Svelte 5 or SvelteKit documentation and for detecting common issues in Svelte code.
Requirements
Requires npx and network access to fetch the @sveltejs/mcp package. No scripts ship with the skill; it contains instructions only.

CLI tools

You have access to @sveltejs/mcp CLI for Svelte-specific assistance. Use these commands via npx:

List documentation sections

bash
npx @sveltejs/mcp list-sections

Lists all available Svelte 5 and SvelteKit documentation sections with titles and paths.

Get documentation

bash
npx @sveltejs/mcp get-documentation "<section1>,<section2>,..."

Retrieves full documentation for specified sections. Use after list-sections to fetch relevant docs.

Example:

bash
npx @sveltejs/mcp get-documentation "$state,$derived,$effect"

Svelte autofixer

bash
npx @sveltejs/mcp svelte-autofixer "<code_or_path>" [options]

Analyzes Svelte code and suggests fixes for common issues.

Options:

  • --async - Enable async Svelte mode (default: false)
  • --svelte-version - Target version: 4 or 5 (default: 5)

Examples:

bash
# Analyze inline code (escape $ as \$)npx @sveltejs/mcp svelte-autofixer '<script>let count = \$state(0);</script>'
# Analyze a filenpx @sveltejs/mcp svelte-autofixer ./src/lib/Component.svelte
# Target Svelte 4npx @sveltejs/mcp svelte-autofixer ./Component.svelte --svelte-version 4

Important: When passing code with runes ($state, $derived, etc.) via the terminal, escape the $ character as \$ to prevent shell variable substitution.

Workflow

  1. Uncertain about syntax? Run list-sections then get-documentation for relevant topics
  2. Reviewing/debugging? Run svelte-autofixer on the code to detect issues
  3. Always validate - Run svelte-autofixer before finalizing any Svelte component

Source and attribution

Source:sveltejs/ai-toolsintools/skills/svelte-code-writerat commit6b5d0da

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal