/harness-claude:svelte-routing-patternfrom harness-claude
Builds SvelteKit routes using file-system conventions with +page.svelte, +layout.svelte, route groups, and dynamic segments.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /harness-claude:svelte-routing-pattern still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Build SvelteKit routes using the file-system convention with +page.svelte, +layout.svelte, route groups, and dynamic segments
+page.svelte, +layout.svelte, and their server counterparts relate/users/[id]), catch-all routes, or optional paramsBasic file structure:
src/routes/. The +page.svelte file renders the page content:src/routes/
+page.svelte → /
+layout.svelte → wraps all pages
about/
+page.svelte → /about
blog/
+page.svelte → /blog
[slug]/
+page.svelte → /blog/:slug
+layout.svelte — it wraps all sibling and descendant pages. Use <slot /> to render child content:<!-- src/routes/+layout.svelte -->
<script lang="ts">
import Nav from '$lib/components/Nav.svelte'
let { children } = $props()
</script>
<Nav />
<main>
{@render children()}
</main>
Dynamic segments:
[param] for dynamic route segments. Read them via $page.params or from the load function:routes/
users/
[id]/
+page.svelte → /users/:id
+page.server.ts → server load for this route
<!-- +page.svelte -->
<script lang="ts">
import { page } from '$app/stores'
const userId = $page.params.id
</script>
[...rest] for catch-all segments that match one or more path parts:routes/
docs/
[...path]/
+page.svelte → /docs/a/b/c — params.path = 'a/b/c'
[[optional]] for optional segments:routes/
[[lang]]/
+page.svelte → / and /:lang both match
Route groups — layout without URL impact:
routes/
(marketing)/
+layout.svelte → marketing layout
+page.svelte → /
about/
+page.svelte → /about
(app)/
+layout.svelte → app layout with auth check
dashboard/
+page.svelte → /dashboard
Navigation:
<a> tags for client-side navigation — SvelteKit intercepts them automatically. Use goto for programmatic navigation:<script lang="ts">
import { goto } from '$app/navigation'
async function handleSubmit() {
await submitForm()
goto('/dashboard')
}
</script>
<a href="/about">About</a>
data-sveltekit-preload-data attribute:<a href="/expensive-page" data-sveltekit-preload-data="hover">Load on hover</a>
Named layouts (breaking out of parent layouts):
+layout-reset.svelte or using the @ syntax for matching a specific ancestor:routes/
+layout.svelte → root layout
admin/
+layout.svelte → admin layout
[email protected] → reset: only uses root layout
File naming reference:
| File | Purpose |
|---|---|
+page.svelte | Page UI component |
+page.ts | Universal load (client + server) |
+page.server.ts | Server-only load + form actions |
+layout.svelte | Layout wrapper with <slot /> |
+layout.ts | Universal layout load |
+layout.server.ts | Server-only layout load |
+error.svelte | Error boundary for the route |
+server.ts | API endpoint (no UI) |
Data flow:
Parent layout load() runs before child page load(). Data from a layout load is available to all descendant pages. Data does not flow upward.
$page store:
The $page store from $app/stores provides reactive access to the current route:
import { page } from '$app/stores';
$page.url; // URL object
$page.params; // route params
$page.data; // merged data from all load functions
$page.status; // HTTP status
$page.error; // error object if on error page
Nested layouts and data isolation:
Each layout can have its own load function. The data prop in a layout component only receives data from that layout's load — not child page data. Use $page.data to read the full merged data object.
API routes:
Use +server.ts for routes that return JSON or other non-HTML responses:
// src/routes/api/users/+server.ts
import { json } from '@sveltejs/kit';
export const GET = async ({ locals }) => {
const users = await locals.db.users.findMany();
return json(users);
};
https://kit.svelte.dev/docs/routing
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeRead when SKILL.md points to them.
793 skills in this plugin
/a11y-aria-patternsARIA Patterns> Apply ARIA roles, states, and properties correctly to enhance assistive technology support for custom widgets/a11y-color-contrastColor Contrast and Color Independence> Ensure sufficient color contrast ratios and never use color as the sole means of conveying information/a11y-form-patternsAccessible Form Patterns> Build accessible forms with proper labeling, grouped controls, inline validation, and clear error communicationOther plugins' skills for the same job