--- name: svelte-cli license: Apache-2.0 description: Svelte CLI(sv)技能。当用户使用 sv 创建项目(sv create)、添加集成(sv add 如 drizzle/tailwind/prettier/eslint/playwright/storybook/vitest/mdsvex/paraglide/better-auth/sveltekit-adapter/mcp/experimental)、运行类型和编译检查(sv check)、运行迁移脚本(sv migrate svelte-5/sveltekit-2/app-state/self-closing-tags/package/routes)、或开发自定义 sv add-on 时使用。 --- # Svelte CLI (`sv`) ## When to use this skill Use this skill when the user wants to: - Create a new SvelteKit project (`sv create`) - Add an integration to an existing project (`sv add` with official or community add-ons) - Run type / compile / a11y diagnostics on a Svelte project (`sv check`) - Migrate a codebase between Svelte / SvelteKit versions (`sv migrate`) - Build, test, and publish a custom `sv` add-on - Read or edit `svelte.config.js` / `vite.config.js` programmatically via `sv-utils` Do **not** use this skill for general Svelte component API questions, routing conventions, or store/state management — those belong to the `svelte` / `sveltekit` skills. ## Overview — what is `sv`? `sv` is the official Svelte command-line toolkit for creating and maintaining Svelte(SvelteKit) applications. It ships as an npm package and is best run via `npx` / `pnpm dlx` / `bunx` / `deno run npm:sv`: ```sh npm -> npx sv pnpm -> pnpm dlx sv bun -> bunx sv deno -> deno run npm:sv yarn -> yarn dlx sv ``` If `sv` is already a devDependency in the project, the local copy is used; otherwise it is downloaded and run ephemerally. Five subcommands: | Command | Purpose | | ----------- | -------------------------------------------------------- | | `create` | Scaffold a new Svelte(Kit) project + optional add-ons | | `add` | Apply an add-on (official or community) to a project | | `check` | Type / compile / a11y diagnostics via `svelte-check` | | `migrate` | Run a codemod migration script (`svelte-migrate`) | | (programmatic) | `sv.create`, `sv.add`, `defineAddon`, `defineAddonOptions` | If `npx sv` appears to do nothing, see the Quick Fixes section — this is a known npm/yarn behaviour where the local tool is preferred over downloading. ## `sv create` ```sh npx sv create [options] [path] ``` Scaffolds a new SvelteKit project. If `path` is omitted, the current directory is used (after a non-empty check, unless `--no-dir-check` is passed). ### Options | Flag | Description | | ---- | ----------- | | `--from-playground ` | Create a project from a [svelte.dev/playground](https://svelte.dev/playground) URL | | `--template ` | `minimal`, `demo`, or `library` | | `--types