Skip to content
Back to skills

Svelte Apps

ASecurity

Build Svelte 5 and SvelteKit apps cleanly: runes state flow, server boundaries, form actions and SSR safety

  • 5 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 30, 2026
developmenttypescriptreactapidatabaseperformance

Works with

  • cli
  • api

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add AdityaaaTiwari/ANVIL --skill svelte-apps --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Svelte Apps?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Svelte Apps
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adityaaatiwari-svelte-apps-anvil/badge)](https://www.skillsdirectory.com/skills/adityaaatiwari-svelte-apps-anvil)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: svelte-apps
description: "Build Svelte 5 and SvelteKit apps cleanly: runes state flow, server boundaries, form actions and SSR safety"
---

<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->

# Svelte and SvelteKit apps

Use when creating or updating Svelte components, SvelteKit routes, or load/form handlers.

## Reactivity and state
- In Svelte 5, prefer `$derived` / `$derived.by` for computed values instead of synchronizing `$state` inside `$effect`.
- Reserve `$effect` strictly for external side effects (DOM listeners, canvas, timers) and return a cleanup function.
- Avoid leaking shared mutable state across SSR requests via module-level singletons; pass request-scoped data through `load` and context (`setContext`).

## Server vs universal boundaries
- Put database queries, private env vars (`$env/static/private`), and auth checks inside `+page.server.ts`, `+layout.server.ts`, or `+server.ts`, never in universal `+page.ts` or client `$lib/`.
- Validate form actions with a schema on the server and use `fail(400, ...)` for field errors with `use:enhance` for progressive enhancement.
- Re-check authorization in every action and API route; layout `load` checks alone do not protect sibling actions or endpoints.

## Navigation and performance
- Return only serializable, minimal fields needed by the page from `load` functions to avoid bloating the SSR hydration payload.
- Guard browser-only globals (`window`, `document`) with `browser` checks from `$app/environment` or run them inside `onMount`.

## Verify
Run `svelte-check`, TypeScript compilation, unit/component tests, and SSR/hydration smoke checks on dynamic routes without console warnings.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.