Labsco
posthog logo

instrument-error-tracking

β˜… 59

by posthog Β· part of posthog/ai-plugin

Use this skill to add PostHog error tracking that captures and monitors exceptions in your application. Use it after implementing features or reviewing PRs to ensure errors are tracked with full stack traces and source maps. If PostHog is not yet installed, this skill also covers initial SDK setup. Supports any platform or language.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup
🧩 One of 7 skills in the posthog/ai-plugin package β€” works on its own, and pairs well with its siblings.

This is the playbook your agent receives when the skill activates β€” you don't need to read it to use the skill, but it's here to audit before installing.

by posthog

Use this skill to add PostHog error tracking that captures and monitors exceptions in your application. Use it after implementing features or reviewing PRs to ensure errors are tracked with full stack traces and source maps. If PostHog is not yet installed, this skill also covers initial SDK setup. Supports any platform or language. npx skills add https://github.com/posthog/ai-plugin --skill instrument-error-tracking Download ZIPGitHub59

Add PostHog error tracking

Use this skill to add PostHog error tracking that captures and monitors exceptions in your application. Use it after implementing features or reviewing PRs to ensure errors are tracked with full stack traces and source maps. If PostHog is not yet installed, this skill also covers initial SDK setup. Supports any platform or language.

Supported platforms: React, Next.js, Web (JavaScript), Node.js, Python, PHP, Ruby, Ruby on Rails, Go, Elixir, Angular, Svelte, Nuxt, React Native, Flutter, iOS, Android, and Hono.

Instructions

Follow these steps IN ORDER:

STEP 1: Analyze the codebase and detect the platform.

Reference files

  • references/react.md - React error tracking installation - docs

  • references/web.md - Web error tracking installation - docs

  • references/nextjs.md - Next.js error tracking installation - docs

  • references/node.md - Node.js error tracking installation - docs

  • references/python.md - Python error tracking installation - docs

  • references/django.md - Django - docs

  • references/flask.md - Flask - docs

  • references/php.md - Php error tracking installation - docs

  • references/laravel.md - Laravel - docs

  • references/ruby.md - Ruby error tracking installation - docs

  • references/ruby-on-rails.md - Ruby on rails error tracking installation - docs

  • references/ruby-on-rails.md - Ruby on rails - docs

  • references/go.md - Go error tracking installation - docs

  • references/dotnet.md - .net error tracking installation - docs

  • references/dotnet.md - .net - docs

  • references/elixir.md - Elixir error tracking installation - docs

  • references/angular.md - Angular error tracking installation - docs

  • references/svelte.md - Sveltekit error tracking installation - docs

  • references/nuxt-3-7.md - Nuxt error tracking installation (v3.7 and above) - docs

  • references/nuxt-3-6.md - Nuxt error tracking installation (v3.6 and below) - docs

  • references/react-native.md - React native error tracking installation - docs

  • references/flutter.md - Flutter error tracking installation - docs

  • references/ios.md - Ios error tracking installation - docs

  • references/android.md - Android error tracking installation - docs

  • references/hono.md - Hono error tracking installation - docs

  • references/fingerprints.md - Fingerprints - docs

  • references/alerts.md - Send error tracking alerts - docs

  • references/monitoring.md - Monitor and search issues - docs

  • references/assigning-issues.md - Assign issues to teammates - docs

  • references/upload-source-maps.md - Upload source maps - docs

Each platform reference contains SDK-specific installation and manual capture patterns. Find the one matching the user's stack.

Key principles

  • Environment variables: Always use environment variables for PostHog keys. Never hardcode them.

  • Minimal changes: Add error tracking alongside existing error handling. Don't replace or restructure existing code.

  • Autocapture first: Enable exception autocapture before adding manual captures.

  • Source maps: Upload source maps so stack traces resolve to original source code, not minified bundles.

  • Manual capture for boundaries: Use captureException() at error boundaries and catch blocks for errors that don't propagate to the global handler.