posthog-instrumentation
作成者: posthog
複数のフレームワークにわたってPostHogの分析、イベントトラッキング、フィーチャーフラグを自動でインストルメント化します。JavaScript/TypeScript、React、Python、Node.jsをサポートし、フレームワーク固有のセットアップパターンを提供します。カスタムプロパティを用いたイベントキャプチャ、段階的ロールアウトのためのフィーチャーフラグ評価、ユーザー識別という3つのコア機能をカバーします。既存のPostHog設定を検出し、設定を重複させることなくインストルメンテーションを追加します。イベント命名規則やプロパティに関するベストプラクティスを含みます。
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
posthog
PostHogのGo向けエラートラッキング
official
integration-laravel
posthog
PostHog統合 for Laravelアプリケーション
official
integration-nextjs-app-router
posthog
PostHogのNext.js App Routerアプリケーション向け統合
official
logs-other
posthog
PostHog のその他の言語向けログ
official
logs-python
posthog
PostHogのPython用ログ
official
analyzing-experiment-session-replays
posthog
実験バリアント間のセッションリプレイパターンを分析し、ユーザー行動の違いを理解します。ユーザーがどのように操作しているかを確認したい場合に使用します。
official
auditing-experiments-flags
posthog
PostHogの実験とフィーチャーフラグを監査し、設定の問題、陳腐化、ベストプラクティス違反をチェックします。ユーザーが監査やヘルスチェックを依頼した際に読み取ります。
official
auditing-warehouse-data-health
posthog
このスキルは、データウェアハウスパイプラインのプロジェクト全体の監査を生成します。ユーザーが1つの同期の詳細な調査ではなく、すべての障害の概要を求めている場合に使用します。個別の障害の詳細な調査はdiagnosing-failed-warehouse-syncsが担当し、このスキルは最初にどこを見るべきかを示すスキャンです。
official