- Home
- Skills
- Frontend & Web Apps
- SvelteKit Safety Check
More screenshots
Works with the AI Agents you already use
SvelteKit Safety Check
This skill finds those and nine other SvelteKit mistakes before you deploy, and tells you how to fix each one.
$5
SvelteKit Safety Check
Example session with this skill installed
Check this project with sveltekit-safety-check.
- Read your context and instructions
- Compiled the sveltekit safety check
$ python3 scripts/check_sveltekit.py examples/risky
BLOCK .env.production:3 K01 SECRET_IN_PUBLIC_ENV
PUBLIC_STRIPE_SECRET_KEY=<redacted>
Why: A variable whose name says it holds a secret (secret, password, private key, service role, database URL, chat webhook URL, or an OpenAI, GitHub or similar API key or token) is made public: a PUBLIC_ name (the default public prefix), a VITE_ name read through import.meta.env, or public: true in src/env.ts (SvelteKit 3). Public values are sent to the browser or built into the client JavaScript, so anyone who opens the site can read them.
Safer: Remove the public prefix or public: true and read the value only in server code ($env/static/private or $env/dynamic/private in SvelteKit 2, $app/env/private in SvelteKit 3), then rotate the value that was exposed.
BLOCK src/hooks.server.ts:11 K03 CORS_REFLECTS_ORIGIN_WITH_CREDENTIALS
BLOCK src/routes/checkout/+page.server.ts:9 K04 SECRET_SENT_TO_BROWSER
BLOCK src/routes/search/+page.svelte:3 K01 SECRET_IN_PUBLIC_ENV
BLOCK src/routes/search/+page.svelte:13 K05 HTML_FROM_URL
BLOCK svelte.config.js:12 K02 CSRF_PROTECTION_OFF
BLOCK vite.config.ts:8 K04 SECRET_SENT_TO_BROWSER
REVIEW src/hooks.server.ts:20 K15 ERROR_DETAILS_SENT_TO_CLIENT
REVIEW src/routes/api/feed/+server.ts:7 K16 CORS_WILDCARD_WITH_CREDENTIALS
REVIEW src/routes/blog/[slug]/+page.svelte:12 K11 HTML_FROM_DATA
REVIEW src/routes/login/+page.server.ts:15 K13 SESSION_COOKIE_WEAKENED
REVIEW src/routes/login/+page.server.ts:17 K12 OPEN_REDIRECT
REVIEW svelte.config.js:16 K14 CSP_ALLOWS_INLINE_SCRIPT
(Each finding also has Why and Safer lines, as in the first one.)
Verdict: BLOCK. Checked 9 files, 9 with SvelteKit content.
This is a static check of file text. NOT FLAGGED is not a guarantee.
Connects securely to your tools. The creator never sees your data.
About this skill
A load function that returns { stripeKey: STRIPE_SECRET_KEY } sends your Stripe secret key to every visitor inside the page data, and csrf: { checkOrigin: false } lets any website submit your forms with your users' cookies. This skill finds those and nine other SvelteKit mistakes before you deploy, and tells you how to fix each one.
Your agent runs a scanner on svelte.config.js, vite.config, .svelte components, +page, +layout and +server files, hooks, remote functions, src/env.ts and .env files. It knows SvelteKit 2 and 3: it reads the @sveltejs/kit version from package.json, knows that redirect() in SvelteKit 3 refuses external URLs unless you allow them, that cookies.set() makes cookies httpOnly and secure by default, which modules are server-only, and that SvelteKit stops adding its CSP nonces when 'unsafe-inline' is in script-src. It follows URL, form and load data through variables, $derived and {#each} blocks, skips comments, and treats DOMPurify.sanitize() and similar calls as cleaned. It never builds or runs the app. It returns BLOCK, REVIEW, or NOT FLAGGED, with the file, line, reason, and a safer approach. Secrets are never printed.
What it checks
BLOCK
- K01: secret-named variables made public (secret, password, private key, service role, database URL, chat webhook URL, AI and GitHub tokens): PUBLIC_ names in .env files and public env imports, VITE_ names in import.meta.env, and public: true in src/env.ts
- K02: csrf.checkOrigin: false or '*' in csrf.trustedOrigins, written there or in a constant array
- K03: CORS that copies the request's Origin into Access-Control-Allow-Origin together with Allow-Credentials: true
- K04: secrets sent to the browser: private env values that server load functions, form actions or remote functions return (directly or in a local object), secret keys written in .svelte files, universal load or src/lib modules outside server folders, and process.env copied into the bundle by vite define. Browser keys such as publishable, anon, search-only and PostHog keys are not reported
- K05: {@html} with a value from the URL (search params, hash, route params), also when it is set in $effect or onMount; values only compared with or looked up by the URL are not counted
REVIEW
- K11: {@html} with load data, form results or component props and no sanitizer
- K12: open redirects to query-string or form values through redirect(), a Location header or window.location, without a same-origin check (a startsWith('/') test alone does not count)
- K13: session or auth cookies with httpOnly or secure turned off, sameSite none, set by the cookie package's serialize() or stringifySetCookie() without httpOnly, a raw Set-Cookie header or document.cookie
- K14: 'unsafe-inline' or 'unsafe-eval' in the CSP script-src (report-only policies and 'unsafe-inline' next to 'strict-dynamic' are not reported)
- K15: the server handleError hook, or a handler it wraps, returning error messages or stack traces
- K16: Access-Control-Allow-Origin: * together with Allow-Credentials: true
What's included
- The scanner (Python 3.9+, standard library only)
- A rules guide with the reason, safer approach and official documentation link for each rule
- A risky and a safe example SvelteKit project, and the real report the scanner produces on the risky one
Limits It reads each file on its own: a value passed through a function in another file, a secret imported from a shared module, or a sanitizer applied in another component is not followed. A custom kit.env.publicPrefix is not read (PUBLIC_ is assumed), and authorization inside load functions and actions, remote function input validation, and security headers set by a proxy or host are not checked. Without a package.json that lists @sveltejs/kit, redirects are judged by SvelteKit 2 rules. NOT FLAGGED is not a guarantee.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Frontend & Web Apps.
Static check of file text, one file at a time. Values passed between files, a custom public prefix, and headers set by a proxy or hosting platform are not seen. NOT FLAGGED is not a guarantee.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 4 days ago
Permissions
Runs one local Python script in the terminal. It reads your project's files, writes nothing, and makes no network calls. The example project includes clearly fake, inert keys (not-a-real-key-EXAMPLE...) for the scanner to find. Nothing is built or run.