agentsclimarketplace

Sveltekit fullstack architecture

Skill meyverick/agy-skills/skills/sveltekit-fullstack-architecture

Architects scalable full-stack applications using SvelteKit. Use when configuring routing, writing server endpoints, handling form actions, or defining SSR strategies.From its SKILL.md

Install
npx -y skills add meyverick/agy-skills --skill sveltekit-fullstack-architecture

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.0 KB, 648 tokens by cl100k_base, as published. Nobody here has run it

SvelteKit Fullstack Architecture

This skill enforces strict boundaries between the client and server within a SvelteKit application. It guarantees secure data fetching, mutation via Actions, optimal Server-Side Rendering (SSR), and strictly adheres to the 12-Factor App and Defensive Programming pillars.

When to Use

  • Use when creating new routes (+page.svelte, +layout.svelte).
  • Use when fetching data securely from a database (+page.server.ts).
  • Use when mutating data via forms (+page.server.ts actions).
  • NOT for complex client-side animation logic.

Core Process

Phase 1: Routing & 12-Factor Boundaries

  • Ensure every route has a distinct purpose. Group related routes using (directories) following Domain-Driven Design (DDD).
  • Secrets Management: All environment variables must be externalized. Server-only secrets MUST be imported via $env/static/private. Never expose these to the client bundle.

Phase 2: Secure Data Fetching (Load Functions)

  • Server-Only: If data requires secrets, database access, or API keys, it MUST be fetched in +page.server.ts.
  • Universal: Only use +page.ts if the data fetching can safely execute on the client-side (e.g., public APIs, static markdown parsing).

Phase 3: Data Mutation & Fail-Fast Defensive Design

  • Never use manual fetch calls to REST endpoints for standard data mutations. Define actions inside +page.server.ts.
  • Fail-Fast Exception Handling: If an action receives invalid boundaries or an unauthorized state, throw an explicit SvelteKit error(400, "message") immediately. Do not return soft { success: false } payloads for hard system failures.
  • Enhance forms using SvelteKit's enhance action (<form method="POST" use:enhance>).

Common Rationalizations

RationalizationReality
"I'll just return { error: 'Not Found' } from my form action."Soft errors swallow HTTP status codes. Defensive programming mandates explicitly throwing SvelteKit's error() or fail() to trigger the +error.svelte boundary correctly.
"I'll fetch the database records directly in +page.ts."+page.ts runs on the client. Database queries will leak secrets. Always use +page.server.ts.

Red Flags

  • Secrets ($env/static/private) imported into .svelte files or +page.ts.
  • Client-side fetch POST requests replacing native <form> actions.
  • Returning soft JSON errors instead of explicitly throwing error() for system-level faults.

Verification

Before finalizing the SvelteKit architecture, verify:

  • Sensitive data and database queries are strictly confined to *.server.ts files and utilize $env/static/private.
  • Data mutations utilize Form Actions with use:enhance.
  • Invalid boundary states instantly throw an error() to fail fast.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,645. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.