
Posthog Instrumentation
This handles the grunt work of adding PostHog analytics to your codebase across React, Next.js, Python, and Node.js projects. It'll instrument event tracking, set up feature flags, and add user identification when you ask it to add analytics or tracking. The patterns are straightforward: posthog.capture() for events, feature flag checks, and user identification calls. It knows to look for existing PostHog setup before adding new code and follows their recommended conventions like snake_case event names. Saves you from context switching to docs when you just want to start tracking button clicks or gate a feature behind a flag.
- skills.sh installs
- 2.2K
- GitHub stars
- 13
- last updated
- Jul 14, 2026
Install
$ npx -y skills add posthog/posthog-for-claude --skill posthog-instrumentation --agent claude-codeInstalls into .claude/skills of the current project.
Files
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()
Sponsors
Details
- Repository
- github.com/posthog/posthog-for-claude
- First seen
- Apr 16, 2026