posthog-instrumentation작성자: posthog
Automatically instrument PostHog analytics, event tracking, and feature flags across multiple frameworks. Supports JavaScript/TypeScript, React, Python, and Node.js with framework-specific setup patterns Covers three core capabilities: event capture with custom properties, feature flag evaluation for gradual rollouts, and user identification Detects existing PostHog configuration and adds instrumentation without duplicating setup Includes best practices for event naming conventions, property...
npx skills add https://github.com/posthog/posthog-for-claude --skill posthog-instrumentationPostHog 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
posthog의 다른 스킬
error-tracking-go
by posthog
PostHog error tracking for Go
integration-laravel
by posthog
PostHog integration for Laravel applications
integration-nextjs-app-router
by posthog
PostHog integration for Next.js App Router applications
logs-other
by posthog
PostHog logs for Other Languages
logs-python
by posthog
PostHog logs for Python
analyzing-experiment-session-replays
by posthog
Analyze session replay patterns across experiment variants to understand user behavior differences. Use when the user wants to see how users interact with…
auditing-experiments-flags
by posthog
Audit PostHog experiments and feature flags for configuration issues, staleness, and best-practice violations. Read when the user asks to audit, health-check,…
auditing-warehouse-data-health
by posthog
This skill produces a project-wide audit of the data warehouse pipeline. Use it when the user wants a summary of everything broken , not a deep-dive on one sync. The deep-dive on individual failures is diagnosing-failed-warehouse-syncs ; this skill is the scan that tells them where to look first.