sveltekit-structure

Guide SvelteKit project structure with routing, layouts, and error handling.

Updated Oct 14, 2025
One-click install
npx skills add https://github.com/kensleDev/dotfiles --skill sveltekit-structure-kensledev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sveltekit-structure
Source: https://github.com/kensleDev/dotfiles/tree/main/claude/.claude/skills/svelte
Command: npx skills add https://github.com/kensleDev/dotfiles --skill sveltekit-structure-kensledev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides clear guidance on organizing your SvelteKit projects, ensuring efficient routing, effective layout management, and robust error handling.

Core Features & Use Cases

  • Routing: Understand file naming conventions for pages and API routes.
  • Layouts: Implement nested layouts and route groups for structured UIs.
  • Error Handling: Set up error boundaries using +error.svelte for graceful failure.
  • SSR & Hydration: Learn best practices for code that runs on both server and client.
  • Use Case: You're building a dashboard with different sections (e.g., public marketing pages vs. authenticated app pages). This Skill helps you structure routes and apply distinct layouts using route groups.

Quick Start

Use the sveltekit-structure skill to understand how to name files for SvelteKit routes and layouts.

Frequently Asked Questions about sveltekit-structure

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

FAQPage Schema
How do I structure routes and layouts in a SvelteKit project?

SvelteKit uses file naming conventions to define routes and layouts, placing them in the src/routes directory. You can implement nested layouts and route groups to structure distinct UI sections like public pages versus authenticated app areas.

What is the best way to handle routing errors in SvelteKit?

SvelteKit handles routing errors using +error.svelte files to create error boundaries. Setting up these files ensures graceful failure by catching issues within specific route segments instead of crashing the entire application.

How do I name files for SvelteKit pages and API endpoints?

SvelteKit relies on specific file naming conventions for pages and API endpoints, using prefixes like +page and +server. Route parameters and route groups are also configured directly through these file and directory names.

Does SvelteKit support different layouts for public and authenticated sections?

Yes, SvelteKit supports route groups to apply distinct layouts to different sections. You can structure your routes to separate public marketing pages from authenticated app pages, giving each section a unique UI wrapper.

How does server-side rendering and client-side hydration work in SvelteKit?

SvelteKit executes code on both the server and client, utilizing server-side rendering and client-side hydration. Following best practices for these mechanisms ensures your components render correctly and maintain state when transitioning from server to browser.