Index of every page on this site: llms.txt
All skills
spences10 avatar

/svelte-deployment

@5fe4989
Run it yourself

Svelte deployment guidance. Use for adapters, Vite config, pnpm setup, library authoring, PWA, or production builds.

Use this Skill: https://skilld.dev/gh/spences10/svelte-skills-kit/svelte-deployment

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencespwa-setup.md

≈491 tokens on demand. Your agent reads this file only when SKILL.md points to it.

PWA Setup with SvelteKit

Basic PWA with Workbox

pnpm add -D workbox-precaching

Service Worker

// src/service-worker.ts
/// <reference lib="webworker" />
import { precacheAndRoute } from 'workbox-precaching';

declare const self: ServiceWorkerGlobalScope;

precacheAndRoute(self.__WB_MANIFEST);

Manifest

// static/manifest.json
{
	"name": "My App",
	"short_name": "App",
	"start_url": "/",
	"display": "standalone",
	"background_color": "#ffffff",
	"theme_color": "#ff3e00",
	"icons": [
		{
			"src": "/icon-192.png",
			"sizes": "192x192",
			"type": "image/png"
		},
		{
			"src": "/icon-512.png",
			"sizes": "512x512",
			"type": "image/png"
		}
	]
}

HTML Head

<!-- src/app.html -->
<head>
	<link rel="manifest" href="/manifest.json" />
	<meta name="theme-color" content="#ff3e00" />
	<link rel="apple-touch-icon" href="/icon-192.png" />
</head>

SvelteKit Config

// svelte.config.js
import adapter from '@sveltejs/adapter-static';

export default {
	kit: {
		adapter: adapter({
			fallback: 'index.html',
		}),
		serviceWorker: {
			register: true,
		},
	},
};

Offline-First Strategy

// src/service-worker.ts
import { precacheAndRoute } from 'workbox-precaching';
import { registerRoute } from 'workbox-routing';
import { NetworkFirst, CacheFirst } from 'workbox-strategies';

declare const self: ServiceWorkerGlobalScope;

// Precache static assets
precacheAndRoute(self.__WB_MANIFEST);

// Cache API responses
registerRoute(
	({ url }) => url.pathname.startsWith('/api/'),
	new NetworkFirst({
		cacheName: 'api-cache',
	}),
);

// Cache images
registerRoute(
	({ request }) => request.destination === 'image',
	new CacheFirst({
		cacheName: 'image-cache',
	}),
);

Testing PWA

  1. Build: pnpm build
  2. Preview: pnpm preview
  3. Open DevTools → Application → Service Workers
  4. Check "Offline" to test offline behavior

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning25d4 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    This skill provides legitimate deployment guidance for SvelteKit projects, including configuration for various adapters (Cloudflare, Node, Static), PWA setup, and library authoring. It uses official Svelte ecosystem packages and follows standard practices for environment variable access and project configuration.

  • Socket25d

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

  • Runlayer9mo

    4/4 files flagged

Signed by skilld at 5fe4989. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated 7 months ago

README badge

README badge for spences10/svelte-skills-kit/svelte-deployment