Svelte Code Writer

sveltejs/ai-tools/plugins/cursor/svelte/skills/svelte-code-writer

作者 sveltejs6b5d0dab3c9c083387247ab20dc684573481076b無授權條款332 個星標收錄於 2026年10月9日更新於 2026年10月9日儲存庫今天更新

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位於plugins/cursor/svelte/skills/svelte-code-writer提交6b5d0da

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架