Svelte and SvelteKit checklist¶
Copy this list into a pull request, design review or project kickoff and tick what applies. Rules are grouped by level and sorted by score (criteria). Each links to the file that explains it and cites its sources. Automatable names tools that can check the rule in CI (see the file's "How to enforce" section).
Also apply the general checklist.
This file is generated by python3 scripts/rank.py fix from the guidelines. Don't edit it by hand.
Strongly recommended (9–10)¶
-
SVELTE-5(9) Never keep user or request data in module-level variables or other shared state on the server: return it fromload, pass it down as props or through context, and persist it in a database. Keeploadfunctions free of side effects for the same reason. (specific/svelte) -
SVELTE-11(9) Treat every form action,+server.jshandler and remote function as a public HTTP endpoint: make sure an authorization check covers it, and validate its input on the server. (specific/svelte) -
SVELTE-12(9) Declare environment variables insrc/env.ts, mark onepublic: trueonly if its value may be public, and import secrets only from$app/env/private. (specific/svelte) Automatable: Server-only module check.
Recommended (6–8)¶
-
SVELTE-13(8) Check authentication in thehandlehook or in each+page.server.jsloadfunction, not only in a+layout.server.jsloadfunction. (specific/svelte) -
SVELTE-1(7) Write new components in runes mode, and don't use legacy features that have modern replacements, such as$:statements,export let,on:directives, slots, and stores for shared state. (specific/svelte) Automatable: Svelte compilerrunesoption. -
SVELTE-2(7) Compute values from state and props with$derived, not by assigning state in an$effect, and keep$effectas an escape hatch for things such as analytics and direct DOM manipulation. (specific/svelte) Automatable: eslint-plugin-svelte. -
SVELTE-3(7) Type-check.sveltefiles in CI withsv check(svelte-check). (specific/svelte) Automatable: sv check. -
SVELTE-6(7) Load data that needs the database, the filesystem or private credentials in serverloadfunctions (+page.server.js), and use universalloadfunctions (+page.js) only for public APIs or for values that can't be serialized. (specific/svelte) -
SVELTE-9(7) Choose rendering per route with page options: prerender pages that every user sees the same, server-render dynamic pages, and turn offssronly for pages that can't run on the server. (specific/svelte) -
SVELTE-14(7) Put code that uses secrets, the database or other server-only APIs in server-only modules: files with aserversegment in their name, such asdb.server.ts, or files in aserverdirectory. (specific/svelte) Automatable: Server-only module check. -
SVELTE-4(6) Share reactive state between components with$stateobjects or classes with$statefields, defined in.svelte.jsor.svelte.tsmodules, and keep stores for complex asynchronous streams or for when you need manual control over updates. (specific/svelte) -
SVELTE-7(6) Avoid request waterfalls: make dependent backend calls in serverloadfunctions, use thefetchthatloadreceives, and callawait parent()only after the requests that don't depend on it. (specific/svelte) -
SVELTE-8(6) Implement mutations as form actions that work without JavaScript, return validation errors withfail(), and progressively enhance the form withuse:enhance. (specific/svelte) -
SVELTE-15(6) Set each page's<title>in<svelte:head>, and thelangattribute insrc/app.html. (specific/svelte) -
SVELTE-16(6) Fix the compiler's accessibility warnings, and silence one with<!-- svelte-ignore -->only for a false positive, with a note saying why. (specific/svelte) Automatable: eslint-plugin-svelte, sv check.
Conditional (1–5)¶
-
SVELTE-10(5) Replaceadapter-autowith the adapter for your platform once you've chosen where to deploy, and host the app in the same data center as its backend. (specific/svelte)