Skip to content
Skillpedia
General coding12k · #11524

posthog-instrumentation

What it does

This skill helps your AI add PostHog tracking to your code. It is for people who want to measure what users do or test new features behind flags.

When to use it

  • ✓When you want to track button clicks or other user actions in your app.
  • ✓When you want to add PostHog or basic analytics to a website or software project.
  • ✓When you want to turn a new feature on or off for some users with feature flags.

Skill link

https://github.com/trycompai/crm/blob/release/.agents/skills/posthog-instrumentation/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/trycompai/crm/blob/release/.agents/skills/posthog-instrumentation/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Please add PostHog tracking to my app so I can see when people click the signup button.”

5 new skills a week. 1 minute to read.

How it works

The skill looks at which framework your project uses, checks whether PostHog is already set up, and then adds the matching tracking code.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

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
FAQ

Does this skill work with React and Python projects?

Yes. The skill includes code examples for JavaScript, TypeScript, React and Python.

Do I need a PostHog account?

The examples use a PostHog project API key, so you will need one from your own PostHog account.

What should event names look like?

The skill recommends short event names written in snake_case, such as button_clicked.

Details

Original description by the author

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.

repo: trycompai/crm

Popularity

GitHub stars
12k
Ranking position
#11524
License
MIT
Updated
11/1/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills