agentskills.codes
SV

sveltekit-adapters

Use when selecting, configuring, or troubleshooting SvelteKit adapters for deployment to Node.js, static hosts, Vercel, Cloudflare, and other targets.

Install

mkdir -p .claude/skills/sveltekit-adapters && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14971" && unzip -o skill.zip -d .claude/skills/sveltekit-adapters && rm skill.zip

Installs to .claude/skills/sveltekit-adapters

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Use when selecting, configuring, or troubleshooting SvelteKit adapters for deployment to Node.js, static hosts, Vercel, Cloudflare, and other targets.
150 chars✓ has a “when” trigger

About this skill

SvelteKit Adapters

Specialization

Expert guidance for SvelteKit adapter selection, configuration, and deployment. Covers adapter-auto, adapter-node, adapter-static, adapter-vercel, adapter-cloudflare, platform-specific platform.env access, and the constraints each adapter places on rendering modes and runtime APIs.

Trigger Conditions

  • Deploying a SvelteKit application to a specific hosting platform.
  • Choosing the correct adapter for the target environment.
  • Diagnosing runtime errors caused by adapter-incompatible APIs.
  • Configuring environment variables and platform bindings for edge or serverless runtimes.
  • Building a fully static site with adapter-static.

Scope Boundaries

In scope:

  • @sveltejs/adapter-auto: zero-config detection for supported platforms.
  • @sveltejs/adapter-node: self-hosted Node.js server output.
  • @sveltejs/adapter-static: fully static HTML export.
  • @sveltejs/adapter-vercel: Vercel Functions and Edge Functions.
  • @sveltejs/adapter-cloudflare: Cloudflare Workers and Pages.
  • svelte.config.js adapter configuration.
  • platform.env and platform.context for platform-specific bindings.
  • BODY_SIZE_LIMIT, ORIGIN, and ADDRESS_HEADER node adapter options.
  • Adapter compatibility matrix: which adapters support SSR, edge, and static.

Out of scope:

  • Page rendering mode decisions (covered by sveltekit-page-options).
  • CI/CD pipeline setup (covered by ci-cd-workflows).
  • Load function implementation (covered by sveltekit-load).
  • Container packaging for Node adapter output (separate concern).

Inputs

  • Target deployment platform.
  • Rendering mode requirements (SSR, static, edge).
  • Platform-specific bindings needed (KV, D1, R2, Vercel Blob, etc.).
  • Environment variable strategy.
  • Evaluation date in ISO format (YYYY-MM-DD).

Required Outputs

OutputDescription
Adapter selection decisionChosen adapter with documented rationale
svelte.config.js configurationCorrect adapter import and options
Platform binding accessplatform.env typed access for applicable adapters
Environment variable plan$env/static/private, $env/dynamic/private, or platform env usage
Adapters quality checklistPass/fail against the checklist below

Depth Modes

LevelIntentExit Rule
L1 OrientationBuild output reaches the target platformApp deploys and responds to requests
L2 Practical DeliveryCorrect adapter with platform bindings and env varsSSR or static output verified; env vars accessible; platform bindings working
L3 Specialist HardeningOptimise for cold start, edge latency, and bundle sizeBundle analysed; cold start measured; incompatible Node APIs removed
L4 Expert StandardisationAdapter and deployment policy for a projectAdapter selection guide, platform env registry, and incompatibility matrix documented

Adapter Selection Guide

Target PlatformRecommended AdapterNotes
Verceladapter-vercelAuto-detects Edge vs. Serverless per route
Cloudflare Pages / Workersadapter-cloudflareUse platform.env for KV, D1, R2
Node.js server (self-hosted)adapter-nodeProduces build/ with index.js entry
Netlifyadapter-netlify (community)Not in @sveltejs org; verify currency
Fully static siteadapter-staticRequires all routes to be prerenderable
Unknown / multi-platformadapter-autoDetects at build time; not for production use in CI

Workflow

  1. Identify the target deployment platform and runtime (Node.js, edge, static CDN).
  2. Select the adapter using the guide above; reject adapter-auto for production CI builds.
  3. Install the adapter package and update svelte.config.js with adapter import and options.
  4. Audit page options: adapter-static requires all routes to have prerender = true; SSR routes require a server-capable adapter.
  5. Configure environment variable access: use $env/static/private for build-time secrets, $env/dynamic/private for runtime secrets.
  6. For edge adapters, audit load functions and actions for incompatible Node.js APIs (fs, crypto, net); replace with Web API equivalents.
  7. Access platform-specific bindings through event.platform.env in load functions and actions; type via App.Platform augmentation.
  8. Test the production build locally (vite build + adapter output) before deploying.
  9. Run the adapters quality checklist.

Adapters Quality Checklist

  • Adapter matches the target deployment runtime; adapter-auto is not used in CI.
  • svelte.config.js references the correct adapter with explicit options, not defaults.
  • All routes rendered at runtime use a server-capable adapter; static-only routes use prerender = true.
  • Secrets are accessed via $env/static/private or $env/dynamic/private; they are never exposed to the client.
  • Edge adapter routes contain no Node.js-only APIs.
  • platform.env is accessed through App.Platform typed interface augmentation.
  • Production build output is tested locally before first deployment.

Security Notes

  • Never access $env/static/public or $env/dynamic/public for secrets; these are exposed to the browser.
  • $env/static/private values are inlined at build time; do not use for secrets that rotate.
  • For rotating secrets use $env/dynamic/private or platform secret manager bindings.

L4 Coverage Matrix

Requested OutcomeSkill Section
Adapter selectionAdapter Selection Guide
ConfigurationWorkflow steps 3–4
Environment variablesWorkflow step 5 + Security Notes
Edge API compatibilityWorkflow step 6
Platform bindingsWorkflow step 7
Quality validationAdapters Quality Checklist

References

See references/source-catalog.md for active source tracking.

Execution Context

Input Context

  • Request objective and scope boundary.
  • Applicable constraints and required outputs.

Process Context

  • Follow this skill's deterministic workflow from intake to closure.
  • Record ownership and decisions for required outputs.

Output Context

  • Deliverables with explicit completion status.
  • Residual risks and next actions.

Search skills

Search the agent skills registry