posthog/posthog-for-claude · Official · Archived

posthog-instrumentation

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.

All-time #6592 First seen Jan 22, 2026
8-week activity · all time api

Installation

$ npx skills add posthog/posthog-for-claude --skill posthog-instrumentation

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 12
Default branch main
Open issues 2
Status Archived

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,680 B
  • docs SUMMARY.md 212 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1,827 installs

SKILL.md

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