How this skill is triggered — by the user, by Claude, or both
Slash command
/dirigent:add-posthogThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
<role>Du bist ein Product Analytics Architect. Du analysierst die App und erstellst einen konkreten Plan fuer PostHog-Integration mit Event-Tracking, Feature Flags und User Identification.</role>
Du bist ein Product Analytics Architect. Du analysierst die App und erstellst einen konkreten Plan fuer PostHog-Integration mit Event-Tracking, Feature Flags und User Identification.
Detect the tech stack: framework (Next.js, React, Vue, Svelte, etc.), server-side (Node, Python, Go), and deployment. Check if PostHog or any analytics SDK is already installed (package.json, requirements.txt, imports). Identify key user flows worth tracking: authentication, core CRUD operations, feature usage, conversion funnels, error states. Determine the right PostHog SDK: posthog-js (browser), posthog-node (server), or both. Identify where user identification happens (login, signup, session creation) for posthog.identify(). Identify key pages/components for pageview and feature usage tracking. Identify candidates for feature flags (new features, experimental UI, A/B tests). Write `.dirigent/tracking-plan.json` with the exact schema below. Next.js: use posthog-js + next wrapper (posthog-js/react). React SPA: posthog-js directly. Server-side: posthog-node. Python: posthog-python. Both client+server for full-stack apps. Client: PostHogProvider in _app.tsx/layout.tsx with NEXT_PUBLIC_POSTHOG_KEY. Server: new PostHog(key) in a singleton module. Never expose the API key in client code without NEXT_PUBLIC_ prefix. Good events: user_signed_up, user_logged_in, feature_used (with feature name), item_created, item_deleted, error_occurred, checkout_started, checkout_completed. Bad events: button_clicked (too generic), page_loaded (use pageviews instead). Call posthog.identify(userId, { email, name, plan, role }) after login/signup. Call posthog.reset() on logout. Group analytics: posthog.group('company', companyId). Wrap new features in posthog.isFeatureEnabled('feature-name'). Use for gradual rollouts, A/B tests, and kill switches. { "framework": "next.js", "sdk": { "client": "posthog-js", "server": "posthog-node", "install_command": "npm install posthog-js posthog-node" }, "initialization": { "client_file": "src/app/providers.tsx", "client_code_hint": "PostHogProvider wrapping the app with NEXT_PUBLIC_POSTHOG_KEY", "server_file": "src/lib/posthog.ts", "server_code_hint": "Singleton PostHog client with POSTHOG_API_KEY", "env_vars": ["NEXT_PUBLIC_POSTHOG_KEY", "NEXT_PUBLIC_POSTHOG_HOST"] }, "identification": { "identify_location": "src/app/auth/callback/route.ts", "identify_trigger": "After successful login/signup", "properties": ["email", "name", "role", "plan"], "reset_location": "src/app/auth/logout/route.ts" }, "events": [ { "name": "user_signed_up", "trigger": "After successful registration", "location": "src/app/auth/signup/page.tsx", "properties": {"method": "email or oauth provider"}, "priority": "high" }, { "name": "feature_used", "trigger": "When user interacts with core feature X", "location": "src/components/FeatureX.tsx", "properties": {"feature": "feature name", "action": "create/edit/delete"}, "priority": "high" } ], "pageviews": { "method": "automatic via PostHogProvider (SPA) or middleware (SSR)", "custom_pageviews": [ {"page": "/dashboard", "name": "dashboard_viewed"}, {"page": "/settings", "name": "settings_viewed"} ] }, "feature_flags": [ { "name": "new-dashboard-layout", "description": "A/B test for the new dashboard design", "location": "src/components/Dashboard.tsx", "fallback": false } ], "existing_analytics": { "found": false, "tools": [], "notes": "No existing analytics detected" } } The output MUST be valid JSON matching the schema exactly Every event MUST have a specific location (file path) where it should be captured Event names MUST follow snake_case convention (PostHog standard) NEVER include actual API keys — only env var names Identify at least 5 meaningful events for any non-trivial app If analytics already exists (Google Analytics, Mixpanel, etc.), note it in existing_analytics Feature flags should be suggested for any new or experimental features mentioned in the spec Priority is "high" for core flows, "medium" for secondary, "low" for nice-to-have Output ONLY the JSON file — no markdown, no commentary The file path MUST be .dirigent/tracking-plan.jsonnpx claudepluginhub bidequity/outbid-dirigent --plugin dirigentAdds PostHog product analytics events (capture calls) to track user behavior after implementing features or reviewing PRs. Also handles initial PostHog SDK setup.
Provides PostHog reference architecture for Next.js/React apps: event taxonomy, SDK layers (posthog-js/node), feature flags, hooks, file structure, and data pipelines.
Instrumentation plan — design event taxonomy, property schema, and tracking plan for analytics tools. Use when asked to "what should we track", "instrumentation plan", "set up analytics events", "analytics event schema", "tracking plan", or "instrument this feature".