Observability Setup

Integrate PostHog and Sentry SDKs into a Next.js App Router application.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/mqzkim/trading --skill observability-setup-mqzkim
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Observability Setup
Source: https://github.com/mqzkim/trading/tree/main/.agents/skills/observability-setup
Command: npx skills add https://github.com/mqzkim/trading --skill observability-setup-mqzkim

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires posthog-js, @sentry/nextjs, and includes references (resource) components.

What problem does it solve?

This Skill streamlines the integration of essential observability tools, PostHog for analytics and Sentry for error tracking, into a Next.js application without altering core functionality.

Core Features & Use Cases

  • PostHog Integration: Adds PostHog JS SDK for user behavior analytics.
  • Sentry Integration: Implements @sentry/nextjs SDK for robust error tracking.
  • Environment Variable Management: Updates .env.example with necessary observability variables.
  • Use Case: A development team needs to quickly add user analytics and error monitoring to their Next.js app before a major release, ensuring they can track user engagement and quickly identify production issues.

Quick Start

Integrate PostHog and Sentry into your Next.js application by following the setup instructions in the SKILL.md file.

Frequently Asked Questions about Observability Setup

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

FAQPage Schema
How do I integrate PostHog and Sentry into a Next.js application?

To integrate PostHog and Sentry into a Next.js application, you need to initialize their SDKs, manage configuration files, and set the required environment variables within your App Router project.

Does this observability setup support Next.js App Router and TypeScript strict mode?

Yes, this observability setup explicitly supports Next.js App Router projects and ensures that the SDK initialization and configuration remain compliant with TypeScript strict mode rules.

What environment variables do I need for PostHog analytics and Sentry error tracking?

You need to define specific PostHog and Sentry environment variables for SDK initialization. This setup updates your `.env.example` file to include all the necessary observability configuration keys.

Can I add user analytics and error monitoring to Next.js without altering existing analytics functions?

Yes, you can add PostHog analytics and Sentry error monitoring while maintaining your existing analytics function interfaces, ensuring the integration does not alter your application's core functionality.

Why use PostHog and Sentry together for Next.js observability?

Using PostHog and Sentry together provides comprehensive Next.js observability by combining PostHog's user behavior analytics with Sentry's robust error tracking to quickly identify production issues.