error-tracking-svelte

Instrument SvelteKit applications to report runtime errors to PostHog.

58|5|Updated Jan 19, 2026
One-click install
npx skills add https://github.com/PostHog/skills --skill error-tracking-svelte
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-tracking-svelte
Source: https://github.com/PostHog/skills/tree/main/skills/posthog/all/skills/error-tracking-svelte
Command: npx skills add https://github.com/PostHog/skills --skill error-tracking-svelte

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

PostHog error tracking for Svelte provides instrumentation and guidance to capture and report runtime errors from Svelte applications, enabling quicker detection and triage.

Core Features & Use Cases

  • Instrument client and server errors in SvelteKit apps with PostHog.
  • Automatically capture exceptions, attach relevant context, and route issues to your team for faster resolution.
  • Use cases include monitoring client errors in SPA components, server-side error handling, and alerting on high-severity issues.

Quick Start

Install and initialize the PostHog SDK in your Svelte app, then trigger a test error to verify that captures are sent to PostHog.

Frequently Asked Questions about error-tracking-svelte

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

FAQPage Schema
How do I track runtime errors in a SvelteKit application?

To track runtime errors in a SvelteKit application, install the PostHog SDK and enable autocapture to automatically report client-side and server-side exceptions. This allows you to detect and triage frontend issues quickly by routing them to your team with relevant context.

What is error tracking in Svelte and how does it work?

Error tracking in Svelte works by instrumenting the frontend to capture and report runtime exceptions to PostHog. It automatically collects errors from SPA components and server-side routes, attaching relevant context so your team receives alerts for faster resolution.

Can I capture server-side route errors with PostHog in SvelteKit?

Yes, you can capture server-side route errors in SvelteKit by optionally wiring server-side error capture into your PostHog configuration. This provides enhanced visibility beyond client-side rendering by monitoring exceptions across your entire application environment.

Do I need to configure environment variables for PostHog error tracking in Svelte?

Yes, configuring environment variables for your project host is required to enable PostHog error tracking in Svelte. You must set these variables during SDK initialization to ensure captured exceptions are correctly routed to your PostHog project.

How do I test exception capture in a Svelte app after setup?

To test exception capture in a Svelte app after setup, trigger a test error within your application to verify that the capture is sent to PostHog. This confirms your SDK initialization and environment variables are correctly configured for monitoring.