SvelteKit web app visualizing a 2012 sailing journey with interactive map and timeline. Live: https://www.ein-tierischer-segelsommer.de | Deployment: Netlify (static site)
- Use ONLY
$state(),$derived(),$effect(),$props(),$bindable() - FORBIDDEN:
$:reactive statements (Svelte 4 syntax) — use$derived()or$effect()instead $effect()MUST return cleanup function when managing resources (event listeners, timers, overlays, subscriptions)
- Type all function parameters and return values
- Use
import typefor type-only imports - Prefer
interfaceovertypefor objects
- ALWAYS write or update tests BEFORE implementing features, fixes, or refactors
- Workflow: Write failing test → Implement code → Verify test passes
- For bug fixes: Write a test that reproduces the bug first, then fix
After every code change, run the full validation chain:
npm run check && npm run lint && npm run testDo NOT consider a task complete until all three commands pass.
ALWAYS use Context7 MCP tools (resolve-library-id → query-docs) for Svelte, SvelteKit, and OpenLayers documentation. Never rely on training data for library APIs.
npm run check # TypeScript + Svelte validation (MUST pass)
npm run lint # ESLint + Prettier (MUST pass)
npm run test # Vitest tests (MUST pass)
npm run build-ci # Full CI: svelte-kit sync + vite build + vitest run-
OpenLayers Layer Order (bottom → top, in
src/lib/ol/map.ts): OSM Base → SeaMap Overlay → Track Layer → Logbook Markers -
Static Site Generation: All routes prerendered at build time via
@sveltejs/adapter-static. No server-side logic, no user input processing. Data from static JSON/KML files. -
State Management:
- Component state:
$state()in.sveltefiles - App-wide state:
src/lib/AppState.svelte.ts(Svelte 5 runes) - Map instance:
src/lib/stores.ts(Writable store — needed for OpenLayers integration with non-Svelte code)
- Component state:
-
Design Tokens: All visual values (colors, spacing, shadows, z-index, radii, transitions) defined in
src/lib/scss/_tokens.scss. NEVER hardcode these values in components. See.claude/rules/design-system.mdfor full rules.
| File | Purpose |
|---|---|
src/lib/types.ts |
TypeScript type definitions + custom event helpers |
src/lib/ol/map.ts |
Map factory (layer order defined here) |
src/lib/AppState.svelte.ts |
Global app state with $state |
src/lib/ol/overlays/tooltip.ts |
Reference cleanup pattern for overlays |
src/lib/scss/_tokens.scss |
Design token definitions (CSS custom properties) |
src/lib/scss/_mixins.scss |
SCSS mixins (breakpoints, glass, accessibility) |
See .claude/README.md for full documentation index, decision tree (Rule vs Skill vs Agent vs Hook), and available skills/agents.
Rules auto-load based on file path globs. Skills: /svelte5-expert, /openlayers-expert, /fix-issue, /create-pr, /security-audit, /performance-check
When context is compacted, always preserve:
- Full list of modified files (absolute paths)
- Test commands and their results
- Svelte 5 runes requirement (no
$:syntax) $effectcleanup requirement- Context7 usage mandate for library documentation
- TDD mandate: tests before implementation
- Post-change validation:
npm run check && npm run lint && npm run test - Current task progress and remaining steps
- Design tokens mandate: use
var(--token)from_tokens.scss, never hardcode
Last Updated: 2026-02-16