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.mdCopy 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
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
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
- Identify the framework (React, Next.js, Python, Node.js, etc.)
- Check for existing PostHog setup
- 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
Comments
- …
More skills from this repository
ai-elements
12kHelps your agent build AI chat interfaces with ready-made components for conversations, messages, tool displays and prompt inputs.
ai-sdk
12kHelps your agent build AI features with the Vercel AI SDK, including text generation, streaming, tool calling and agents.
better-accessibility
12kHelps your agent make interfaces usable with a keyboard and screen readers, covering focus, labels, ARIA and forms.
better-auth-best-practices
12kHelps your agent set up Better Auth for login, sessions, OAuth and plugins in a TypeScript app, following its documented steps.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.