PluginBench
Skill
Official
Fail
Audit score 45

posthog-instrumentation

posthog/posthog-for-claude

Automatically add PostHog analytics, event tracking, and feature flags to your codebase.

What is posthog-instrumentation?

This skill helps you instrument your code with PostHog analytics. Use it when you need to add event tracking, implement feature flags, or set up user identification in JavaScript, TypeScript, Python, React, Next.js, or Node.js applications.

  • Add event tracking to capture user actions and behaviors
  • Implement feature flags for gradual feature rollouts
  • Set up user identification to track individual users
  • Detect existing PostHog setup and avoid duplication
  • Provide framework-specific instrumentation patterns for React, Next.js, Python, and Node.js

How to install posthog-instrumentation

npx skills add https://github.com/posthog/posthog-for-claude --skill posthog-instrumentation
Claude Code
Cursor
Windsurf
Cline

How to use posthog-instrumentation

  1. 1.Describe what analytics or feature flags you want to add to your code
  2. 2.Specify your framework (React, Next.js, Python, Node.js, etc.)
  3. 3.The skill will identify existing PostHog setup and suggest appropriate instrumentation
  4. 4.Review and apply the generated code patterns to your codebase

Use cases

Good for
  • Adding analytics to a React component to track button clicks and user interactions
  • Implementing feature flags in a Next.js app to gradually roll out new features
  • Instrumenting a Python backend to capture purchase or signup events
  • Setting up user identification to correlate events with specific users
  • Adding PostHog to an existing codebase that currently has no analytics
Who it's for
  • Full-stack developers building analytics into new or existing applications
  • Product teams implementing feature flags for gradual rollouts
  • Backend engineers instrumenting Python or Node.js services
  • Frontend developers adding event tracking to React or Next.js applications

posthog-instrumentation FAQ

What frameworks does this skill support?

JavaScript/TypeScript, React, Next.js, Python, and Node.js. The skill detects your framework and provides appropriate code patterns.

Will it overwrite existing PostHog setup?

No, the skill checks for existing PostHog configuration and avoids duplication.

What event naming convention should I use?

Snake_case is recommended for consistent event naming across your analytics.

How do I use feature flags with this skill?

The skill provides patterns for checking feature flags using posthog.isFeatureEnabled() in JavaScript or posthog.feature_enabled() in Python.

Do I need to set up PostHog separately?

Yes, you need a PostHog project and API key. The skill helps you instrument your code to use PostHog, but doesn't create the PostHog account or project.

Full instructions (SKILL.md)

Source of truth, from posthog/posthog-for-claude.


name: posthog-instrumentation description: Automatically add PostHog analytics instrumentation to code. Triggers when user asks to add tracking, instrument events, add analytics, or implement feature flags in their codebase.

PostHog Instrumentation Skill

Help users add PostHog analytics, event tracking, and feature flags to their code.

When to Use

  • User asks to "add PostHog" or "add analytics"
  • User wants to track events or user actions
  • User needs to implement feature flags
  • User asks about instrumenting their code

Workflow

  1. Identify the framework (React, Next.js, Python, Node.js, etc.)
  2. Check for existing PostHog setup
  3. Add appropriate instrumentation

Code Patterns

JavaScript/TypeScript

// Event tracking
posthog.capture('button_clicked', { button_name: 'signup' })

// Feature flags
if (posthog.isFeatureEnabled('new-feature')) {
  // Show new feature
}

// User identification
posthog.identify(userId, { email: user.email })

Python

from posthog import Posthog
posthog = Posthog(api_key='<ph_project_api_key>')

# Event tracking
posthog.capture(distinct_id='user_123', event='purchase_completed')

# Feature flags
if posthog.feature_enabled('new-feature', 'user_123'):
    # Show new feature

React

import { usePostHog } from 'posthog-js/react'

function MyComponent() {
  const posthog = usePostHog()

  const handleClick = () => {
    posthog.capture('button_clicked')
  }
}

Best Practices

  • Use consistent event naming (snake_case recommended)
  • Include relevant properties with events
  • Identify users early in their session
  • Use feature flags for gradual rollouts

Related skills

More from posthog/posthog-for-claude and the wider catalog.