Svelte Code Writer

作者 sveltejs6b5d0dab3c9c无许可证332 个星标收录于 2026年10月8日更新于 2026年10月8日仓库今天更新

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.

AI 生成的概览

指导智能体使用 @sveltejs/mcp 命令行工具查询 Svelte 5 文档并分析代码。

功能
该技能指示智能体通过 npx 运行 @sveltejs/mcp 命令行工具,以获得 Svelte 相关的辅助。它涵盖列出文档章节、获取指定章节的完整文档,以及运行 Svelte 自动修复器来分析 Svelte 代码并给出修复建议。它还定义了工作流程:语法不确定时查阅文档,审查或调试时运行自动修复器,并在最终确定任何 Svelte 组件前进行验证。
适用场景
适用于创建、编辑或分析 Svelte 组件(.svelte)或 Svelte 模块(.svelte.ts/.svelte.js)的场景。它用于查阅 Svelte 5 或 SvelteKit 文档,以及发现 Svelte 代码中的常见问题。
运行要求
需要 npx 以及网络访问以获取 @sveltejs/mcp 包。该技能不附带脚本,仅包含说明。

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

来源与署名

来源:sveltejs/ai-tools位于tools/skills/svelte-code-writer提交6b5d0da

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架