svelte-code-writer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSvelte 5 Code Writer
Svelte 5 代码编写器
CLI Tools
CLI工具
You have access to CLI for Svelte-specific assistance. Use these commands via :
@sveltejs/mcpnpx你可以使用 CLI来获取Svelte相关的辅助支持。通过执行以下命令:
@sveltejs/mcpnpxList Documentation Sections
列出文档章节
bash
npx @sveltejs/mcp list-sectionsLists all available Svelte 5 and SvelteKit documentation sections with titles and paths.
bash
npx @sveltejs/mcp list-sections列出所有可用的Svelte 5和SvelteKit文档章节,包含标题和路径。
Get Documentation
获取文档
bash
npx @sveltejs/mcp get-documentation "<section1>,<section2>,..."Retrieves full documentation for specified sections. Use after to fetch relevant docs.
list-sectionsExample:
bash
npx @sveltejs/mcp get-documentation "$state,$derived,$effect"bash
npx @sveltejs/mcp get-documentation "<section1>,<section2>,..."获取指定章节的完整文档。在执行后使用该命令来获取相关文档。
list-sections示例:
bash
npx @sveltejs/mcp get-documentation "$state,$derived,$effect"Svelte Autofixer
Svelte 自动修复工具
bash
npx @sveltejs/mcp svelte-autofixer "<code_or_path>" [options]Analyzes Svelte code and suggests fixes for common issues.
Options:
- - Enable async Svelte mode (default: false)
--async - - Target version: 4 or 5 (default: 5)
--svelte-version
Examples:
bash
undefinedbash
npx @sveltejs/mcp svelte-autofixer "<code_or_path>" [options]分析Svelte代码并针对常见问题提供修复建议。
选项:
- - 启用Svelte异步模式(默认值:false)
--async - - 目标版本:4或5(默认值:5)
--svelte-version
示例:
bash
undefinedAnalyze inline code (escape $ as $)
分析内联代码(将$转义为$)
npx @sveltejs/mcp svelte-autofixer '<script>let count = $state(0);</script>'
npx @sveltejs/mcp svelte-autofixer '<script>let count = $state(0);</script>'
Analyze a file
分析文件
npx @sveltejs/mcp svelte-autofixer ./src/lib/Component.svelte
npx @sveltejs/mcp svelte-autofixer ./src/lib/Component.svelte
Target Svelte 4
目标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.npx @sveltejs/mcp svelte-autofixer ./Component.svelte --svelte-version 4
**重要提示:** 当通过终端传递包含runes(如`$state`、`$derived`等)的代码时,需将`$`字符转义为`\$`,以避免shell变量替换。Workflow
工作流程
- Uncertain about syntax? Run then
list-sectionsfor relevant topicsget-documentation - Reviewing/debugging? Run on the code to detect issues
svelte-autofixer - Always validate - Run before finalizing any Svelte component
svelte-autofixer
- 对语法不确定? 先执行,然后针对相关主题执行
list-sectionsget-documentation - 审核/调试代码? 对代码执行以检测问题
svelte-autofixer - 务必验证 - 在最终确定任何Svelte组件之前执行
svelte-autofixer