svelte-code-writer — Claude Code skill: what it does, how to install
Fetches Svelte 5 documentation and analyzes components using autofixer. Useful when authoring or debugging .svelte and .svelte.ts files.
npx skills add sveltejs/ai-tools --skill svelte-code-writer -a claude-codeWhat svelte-code-writer does
This skill connects to the @sveltejs/mcp CLI via npx. By running list-sections, the agent inspects the table of contents for Svelte 5 and SvelteKit documentation, then fetches targeted passages with get-documentation. This keeps code generation aligned with modern runes.
To check component syntax, it runs svelte-autofixer on a file path or inline snippet. The tool detects common pitfalls and outputs recommendations. It targets Svelte 5 by default. Passing --svelte-version 4 or an exact version from package.json switches checks to the requested release, while --async enables async mode.
Shell escaping requires extra care when testing inline snippets. The dollar character in runes like $state must be escaped as \$, otherwise the shell expands it as an empty environment variable before the CLI runs.
What it helps with
- validate Svelte components with autofixer before finalizing edits
- fetch official Svelte 5 documentation for runes like
$stateand$derived - browse available Svelte and SvelteKit documentation topics via
list-sections - target Svelte 4 validation rules using the
--svelte-versionflag
Example prompts for the agent
- Check `./src/lib/Component.svelte` with svelte-autofixer and fix any issues
- Fetch documentation for `$state` and `$derived` before refactoring this file
- Run `list-sections` to see all available SvelteKit documentation topics
How to install svelte-code-writer
1Skills CLI (Vercel)
npx skills add sveltejs/ai-tools --skill svelte-code-writer -a claude-code2Manually: put the files in place
~/.claude/skills/svelte-code-writer/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/svelte-code-writer/
1Skills CLI (Vercel)
npx skills add sveltejs/ai-tools --skill svelte-code-writer -a codex2Manually: put the files in place
.agents/skills/svelte-code-writer/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add sveltejs/ai-tools --skill svelte-code-writer -a cursor2Manually: put the files in place
.cursor/skills/svelte-code-writer/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install sveltejs/ai-tools svelte-code-writer2Manually: put the files in place
.github/skills/svelte-code-writer/SKILL.md1Skills CLI (Vercel)
npx skills add sveltejs/ai-tools --skill svelte-code-writer -a gemini-cli2Platform CLI
gemini skills install https://github.com/sveltejs/ai-tools --path tools/skills/svelte-code-writerManually: put the files in place
.devin/skills/svelte-code-writer/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add sveltejs/ai-tools --skill svelte-code-writer -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set2
The whole set →Similar
Questions about svelte-code-writer
How to install svelte-code-writer in Claude Code?
Run npx skills add sveltejs/ai-tools --skill svelte-code-writer -a claude-code in your terminal.
What does svelte-code-writer do?
It provides CLI commands via @sveltejs/mcp to look up official Svelte 5 documentation and analyze components with svelte-autofixer.
Does svelte-code-writer support Svelte 4 projects?
Yes. Pass --svelte-version 4 or the exact version string from your package.json to the autofixer command.
Source text
SKILL.md · MIT
--- 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` subagent for optimal results. --- ## 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, ideally the full version from `package.json` (e.g. `5.16.0`) so version-specific suggestions are enabled. The major must be 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 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
© sveltejs · MIT · sveltejs/ai-tools