svelte-best-practices
Use when implementing, reviewing, or migrating Svelte components, SvelteKit routes, Svelte CLI setup, Astro Svelte islands, or Tailwind styling in a Svelte project.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-01
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- svelte-best-practices
- description
- Use when implementing, reviewing, or migrating Svelte components, SvelteKit routes, Svelte CLI setup, Astro Svelte islands, or Tailwind styling in a Svelte project.
02 资源文件 1
- 参考文档references/sources.md3.0 KB
03 SKILL.md 正文
Svelte and SvelteKit project guidance
Use the project's installed versions and the live documentation to choose the right API. This skill routes the work; it is not a frozen copy of the framework manual.
Establish the version
- Find the app root and read
package.jsonplus the relevant lockfile. Identify installedsvelte,@sveltejs/kit,sv,astro,@astrojs/svelte, and Tailwind packages as applicable. A manifest range is not proof of an installed version. - Inspect existing conventions before editing. If the project uses Svelte 4 or SvelteKit 2, preserve that baseline unless migration is requested. If it is migrating, use the official migration guides and name the compatibility boundary.
- Consult the source map and the
svelte-docs-and-autofixerskill for current signatures. For release-dependent behavior, inspect the relevant package changelog for the interval between the installed version and the documentation.
Apply the relevant rules
| Area | Check before coding |
|---|---|
| Svelte 5 reactivity | $state, $derived, $effect, $props, and their placement; avoid using effects to compute derived state. |
| Templates | Event attributes, snippets, render tags, declaration tags, attachments, keyed lists, and accessibility diagnostics. |
| SvelteKit | Route filenames, universal versus server loads, forms and remote functions, hooks, env modules, navigation, adapters, and configuration for the installed major version. |
| Security | Server-only imports, user data in shared module state, untrusted HTML, redirects, CSRF, CSP, and deployment origin. |
| Integrations | Read Astro and Tailwind guidance only when those dependencies or files occur in the task. Check island hydration, serializable props, and Tailwind CSS processing against their installed versions. |
The official SvelteKit 3 migration guide is the primary source for a Kit 2 to 3 migration; do not infer every breaking change from a single example. Run a codemod only when the user requested migration, inspect its diff, and complete manual tasks it reports.
Source order and verification
For exact behavior at the installed version, prefer package source and changelog, then official documentation, then this skill's topic map. Report material disagreements. Fetch relevant sections before writing unfamiliar, experimental, or version-sensitive APIs. After editing, use the docs/autofixer skill and the project's check command; a clean autofixer alone is not a type check or runtime test.
For an editing request, follow svelte-component-editor. For a review request, follow svelte-code-auditor. For symbol questions or a rename, follow svelte-code-navigation.
04 同仓库更多 Skills
example-workflow
Use when the user needs the specific workflow supplied by this plugin.
svelte-docs-and-autofixer
Use when a Svelte or SvelteKit task needs current official API documentation, a Svelte compiler check, autofixer feedback, or a Svelte playground link.
svelte-component-editor
Use when creating, editing, fixing, or migrating Svelte components, Svelte modules, SvelteKit routes, forms, loads, hooks, or related integration code.
svelte-code-navigation
Use when locating Svelte symbol definitions or references, tracing callers, checking types or diagnostics, or assessing a Svelte rename or deletion.
svelte-code-auditor
Use when reviewing or auditing Svelte or SvelteKit code, a pull request, a migration, or framework-related security and accessibility concerns without editing source files.
lsp-setup
Use when installing, verifying, updating, or troubleshooting the LSP Intelligence plugin and its local mcpls language-server runtime.