bp-svelte

Refactor Svelte components to Svelte 5 Runes and SvelteKit load conventions.

9|4|Updated May 30, 2025
One-click install
npx skills add https://github.com/Kaikei-e/Alt --skill bp-svelte
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: bp-svelte
Source: https://github.com/Kaikei-e/Alt/tree/main/.claude/skills/bp-svelte
Command: npx skills add https://github.com/Kaikei-e/Alt --skill bp-svelte

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a concise, actionable set of Svelte 5 and SvelteKit component design rules to prevent inconsistent patterns, reactive misuse, and data-loading anti-patterns when editing or creating .svelte files.

Core Features & Use Cases

  • Svelte 5 Runes enforcement: Prefer $state, $derived, and $effect and prohibit legacy $: reactive declarations.
  • Props and large-data patterns: Use $props() for component props and $state.raw for large replace-only datasets, serializing with .snapshot().
  • Side effects and data loading: Restrict $effect to DOM/external/network side effects, return cleanup functions, and perform data fetching in +page.ts/+page.server.ts load functions.
  • Composition guidance: Use snippet composition ({#snippet} + {@render}) instead of slots for reusable fragments.
  • Use Case: Refactor or author alt-frontend-sv Svelte components to improve predictability, performance, and maintainability across the codebase.

Quick Start

Refactor the provided Svelte component to follow Svelte 5 Runes and SvelteKit load conventions as described in docs/best_practices/svelte.md, replacing legacy reactive statements with $state/$derived/$effect, using $props(), and moving data fetching into load functions.

Frequently Asked Questions about bp-svelte

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate Svelte legacy reactive declarations to Svelte 5 Runes?▼

To migrate Svelte legacy reactive declarations, replace `$:` syntax with Svelte 5 Runes like `$state` for reactive variables and `$derived` for computed values, ensuring consistent Svelte component reactivity and predictability.

What is the best way to handle data fetching in SvelteKit components?▼

The best way to handle data fetching in SvelteKit is moving it into `+page.ts` or `+page.server.ts` load functions rather than component `$effect`. This enforces proper data-loading patterns and improves application performance.

When should I use $state.raw instead of $state in Svelte 5?▼

Use `$state.raw` in Svelte 5 instead of `$state` for large, replace-only datasets. This prevents unnecessary deep reactivity tracking, optimizing performance when handling substantial arrays or objects via `.snapshot()`.

How do I pass props in Svelte 5 components correctly?▼

Pass props in Svelte 5 components using the `$props()` rune. This replaces the legacy `export let` syntax, providing a consistent and predictable API for component composition and prop handling.

Does Svelte 5 support slot composition for reusable fragments?▼

Svelte 5 prefers snippet composition using `{#snippet}` and `{@render}` instead of legacy slots for reusable fragments. This approach ensures better component composition and maintainability.

Why should $effect be restricted in Svelte 5 component design?▼

Svelte 5 `$effect` should be restricted to DOM, external, or network side effects and must return cleanup functions. Overusing it for state derivation causes reactive misuse and unpredictable component behavior.