PluginBench
Skill
Official
Pass
Audit score 90

svelte-code-writer

sveltejs/ai-tools

CLI tools for Svelte 5 documentation lookup and code analysis.

What is svelte-code-writer?

Provides command-line access to Svelte 5 documentation, code analysis, and auto-fixing capabilities. Use this skill whenever creating, editing, or analyzing Svelte components (.svelte) and modules (.svelte.ts/.svelte.js) to ensure syntax correctness and best practices.

  • List all available Svelte 5 and SvelteKit documentation sections
  • Retrieve full documentation for specified topics like $state, $derived, $effect
  • Analyze Svelte code and suggest fixes for common issues
  • Support both Svelte 4 and Svelte 5 syntax validation
  • Detect and correct rune usage and component structure problems

How to install svelte-code-writer

npx skills add https://github.com/sveltejs/ai-tools --skill svelte-code-writer
Prerequisites
  • Node.js and npm installed
  • @sveltejs/mcp package available via npx
Claude Code
Cursor
Windsurf
Cline

How to use svelte-code-writer

  1. 1.Run `npx @sveltejs/mcp list-sections` to view available documentation topics
  2. 2.Use `npx @sveltejs/mcp get-documentation "<section1>,<section2>"` to fetch relevant docs (e.g., `get-documentation "$state,$derived,$effect"`)
  3. 3.Run `npx @sveltejs/mcp svelte-autofixer "<code_or_path>"` to analyze your component for issues
  4. 4.Add `--svelte-version 4` flag if targeting Svelte 4 instead of 5
  5. 5.Review suggestions and apply fixes to your component code

Use cases

Good for
  • Look up Svelte 5 rune syntax when uncertain about $state, $derived, or $effect usage
  • Debug existing Svelte components to identify syntax errors before deployment
  • Validate new component code against Svelte 5 best practices
  • Migrate Svelte 4 components to Svelte 5 by analyzing compatibility issues
  • Review component structure and reactivity patterns during code review
Who it's for
  • Svelte developers building components with Svelte 5
  • Teams migrating from Svelte 4 to Svelte 5
  • Developers new to Svelte runes and reactive features
  • Code agents and AI assistants editing Svelte files

svelte-code-writer FAQ

When should I use this skill?

Use it whenever creating, editing, or analyzing any .svelte component or .svelte.ts/.svelte.js module file. It's especially useful when uncertain about syntax or before finalizing code.

How do I look up documentation for a specific feature?

First run `list-sections` to see available topics, then use `get-documentation` with comma-separated section names, like `get-documentation "$state,$derived"`

How do I analyze code with runes like $state?

When passing code via terminal, escape the $ character as \$ to prevent shell substitution. For files, just pass the file path directly.

Can this tool help with Svelte 4 code?

Yes, use the `--svelte-version 4` flag with the svelte-autofixer command to validate and fix Svelte 4 syntax.

What does the autofixer do?

It analyzes your Svelte code for common issues and suggests fixes. You should run it before finalizing any component to catch errors early.

Full instructions (SKILL.md)

Source of truth, from sveltejs/ai-tools.


name: svelte-code-writer description: 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.

CLI tools

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

List documentation sections

npx @sveltejs/mcp list-sections

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

Get documentation

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

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

Example:

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

Svelte autofixer

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:

# Analyze inline code (escape $ as \$)
npx @sveltejs/mcp svelte-autofixer '<script>let count = \$state(0);</script>'

# Analyze a file
npx @sveltejs/mcp svelte-autofixer ./src/lib/Component.svelte

# Target Svelte 4
npx @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