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- Node.js and npm installed
- @sveltejs/mcp package available via npx
How to use svelte-code-writer
- 1.Run `npx @sveltejs/mcp list-sections` to view available documentation topics
- 2.Use `npx @sveltejs/mcp get-documentation "<section1>,<section2>"` to fetch relevant docs (e.g., `get-documentation "$state,$derived,$effect"`)
- 3.Run `npx @sveltejs/mcp svelte-autofixer "<code_or_path>"` to analyze your component for issues
- 4.Add `--svelte-version 4` flag if targeting Svelte 4 instead of 5
- 5.Review suggestions and apply fixes to your component code
Use cases
- 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
- 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
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.
First run `list-sections` to see available topics, then use `get-documentation` with comma-separated section names, like `get-documentation "$state,$derived"`
When passing code via terminal, escape the $ character as \$ to prevent shell substitution. For files, just pass the file path directly.
Yes, use the `--svelte-version 4` flag with the svelte-autofixer command to validate and fix Svelte 4 syntax.
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
- Uncertain about syntax? Run
list-sectionsthenget-documentationfor relevant topics - Reviewing/debugging? Run
svelte-autofixeron the code to detect issues - Always validate - Run
svelte-autofixerbefore finalizing any Svelte component
Related skills
More from sveltejs/ai-tools and the wider catalog.

svelte-core-bestpractices
Best practices for writing fast, robust Svelte code with modern runes and patterns.

ux-designer
Applies modern UX/UI best practices to interface design and review. Use for UI design and critique; accessibility audits (WCAG, EAA); microcopy; forms, navigation, and onboarding; internationalization and RTL; voice, multimodal, and AI interfaces; design systems; and frontend code review.

pdf-converter
Convert PDFs, images, and Office docs to Markdown, Word, HTML, or LaTeX with OCR and 80+ language support.

tanstack-ai
Provider-agnostic, type-safe AI SDK for streaming, tool calling, structured output, and multimodal content.

tanstack-cli
Interactive scaffolding CLI for TanStack Start projects with 30+ integrations and MCP server support.

tanstack-config
Opinionated toolkit for building, versioning, and publishing high-quality JavaScript/TypeScript packages with Vite, ESLint, and semantic versioning.