[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6EFWPRVJNEE153MN0XT8YQX":3,"skill-same:01M6EFWPRVJNEE153MN0XT8YQX":45},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":25,"repositoryHtmlUrl":26,"repositoryHomepageUrl":27,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M6EFWPRVJNEE153MN0XT8YQX","posthog",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fposthog\u002FSKILL.md",[],[5],"2026-11-10 10:12:30",false,"# PostHog\n\nOpen-source product analytics platform. Track events, build funnels, watch session replays, and manage feature flags — self-hosted or on PostHog Cloud.\n\n## Self-Hosting with Docker Compose\n\n```yaml\n# docker-compose.yml — PostHog self-hosted stack.\n# Runs PostHog with PostgreSQL, Redis, ClickHouse, Kafka, and worker processes.\nversion: '3'\n\nservices:\n  posthog:\n    image: posthog\u002Fposthog:latest\n    environment:\n      DATABASE_URL: postgres:\u002F\u002Fposthog:posthog@db:5432\u002Fposthog\n      REDIS_URL: redis:\u002F\u002Fredis:6379\u002F\n      CLICKHOUSE_HOST: clickhouse\n      KAFKA_HOSTS: kafka:9092\n      SECRET_KEY: '\u003Cgenerate-a-secret-key>'\n      SITE_URL: https:\u002F\u002Fanalytics.example.com\n    ports:\n      - '8000:8000'\n    depends_on:\n      - db\n      - redis\n      - clickhouse\n      - kafka\n\n  db:\n    image: postgres:15-alpine\n    environment:\n      POSTGRES_DB: posthog\n      POSTGRES_USER: posthog\n      POSTGRES_PASSWORD: posthog\n    volumes:\n      - postgres-data:\u002Fvar\u002Flib\u002Fpostgresql\u002Fdata\n\n  redis:\n    image: redis:7-alpine\n    volumes:\n      - redis-data:\u002Fdata\n\n  clickhouse:\n    image: clickhouse\u002Fclickhouse-server:23.8\n    volumes:\n      - clickhouse-data:\u002Fvar\u002Flib\u002Fclickhouse\n\n  kafka:\n    image: bitnami\u002Fkafka:3.5\n    environment:\n      KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper:2181\n      ALLOW_PLAINTEXT_LISTENER: 'yes'\n    depends_on:\n      - zookeeper\n\n  zookeeper:\n    image: bitnami\u002Fzookeeper:3.8\n    environment:\n      ALLOW_ANONYMOUS_LOGIN: 'yes'\n\nvolumes:\n  postgres-data:\n  redis-data:\n  clickhouse-data:\n```\n\n```bash\n# deploy.sh — Start the PostHog stack.\ndocker compose up -d\n# Wait for PostHog to be ready\nuntil curl -sf http:\u002F\u002Flocalhost:8000\u002F_health; do sleep 5; done\necho \"PostHog is running at http:\u002F\u002Flocalhost:8000\"\n```\n\n## JavaScript SDK — Frontend Event Tracking\n\n```typescript\n\u002F\u002F lib\u002Fposthog.ts — Initialize PostHog JS SDK in a web app.\n\u002F\u002F Supports autocapture, custom events, and session recording.\nimport posthog from 'posthog-js'\n\nexport function initPostHog() {\n  posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {\n    api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || 'https:\u002F\u002Fapp.posthog.com',\n    autocapture: true,\n    capture_pageview: true,\n    capture_pageleave: true,\n    session_recording: {\n      recordCrossOriginIframes: true,\n    },\n    loaded: (posthog) => {\n      if (process.env.NODE_ENV === 'development') {\n        posthog.debug()\n      }\n    },\n  })\n}\n```\n\n```typescript\n\u002F\u002F lib\u002Fposthog-events.ts — Custom event tracking helpers.\n\u002F\u002F Define a typed event layer so tracking calls are consistent across the app.\nimport posthog from 'posthog-js'\n\nexport function trackSignup(method: 'google' | 'github' | 'email') {\n  posthog.capture('user_signed_up', {\n    method,\n    $set: { signup_method: method },\n  })\n}\n\nexport function trackFeatureUsed(feature: string, metadata?: Record\u003Cstring, any>) {\n  posthog.capture('feature_used', {\n    feature_name: feature,\n    ...metadata,\n  })\n}\n\nexport function trackOnboardingStep(step: number, stepName: string) {\n  posthog.capture('onboarding_step_completed', {\n    step_number: step,\n    step_name: stepName,\n  })\n}\n\nexport function identifyUser(userId: string, properties: Record\u003Cstring, any>) {\n  posthog.identify(userId, properties)\n}\n```\n\n## Python SDK — Backend Event Tracking\n\n```python\n# posthog_client.py — Server-side PostHog tracking with the Python SDK.\n# Use for backend events that don't originate from a browser session.\nfrom posthog import Posthog\n\nposthog = Posthog(\n    project_api_key='phc_your_project_key',\n    host='https:\u002F\u002Fanalytics.example.com'  # or https:\u002F\u002Fapp.posthog.com\n)\n\ndef track_subscription_created(user_id: str, plan: str, amount_cents: int):\n    \"\"\"Track when a user subscribes — fired from the Stripe webhook handler.\"\"\"\n    posthog.capture(\n        distinct_id=user_id,\n        event='subscription_created',\n        properties={\n            'plan': plan,\n            'amount_cents': amount_cents,\n            'currency': 'usd',\n        }\n    )\n\ndef track_api_call(user_id: str, endpoint: str, latency_ms: float):\n    \"\"\"Track API usage for metering and performance analysis.\"\"\"\n    posthog.capture(\n        distinct_id=user_id,\n        event='api_call',\n        properties={\n            'endpoint': endpoint,\n            'latency_ms': latency_ms,\n        }\n    )\n\ndef update_user_properties(user_id: str, properties: dict):\n    \"\"\"Set person properties for segmentation and cohorts.\"\"\"\n    posthog.identify(user_id, properties)\n\n# Flush events before process exit\ndef shutdown():\n    posthog.shutdown()\n```\n\n## Feature Flags\n\n```typescript\n\u002F\u002F lib\u002Ffeature-flags.ts — Check PostHog feature flags client-side.\n\u002F\u002F Use for gradual rollouts, A\u002FB tests, and beta features.\nimport posthog from 'posthog-js'\n\nexport function isFeatureEnabled(flag: string): boolean {\n  return posthog.isFeatureEnabled(flag) ?? false\n}\n\nexport function getFeatureFlagPayload(flag: string): any {\n  return posthog.getFeatureFlagPayload(flag)\n}\n\n\u002F\u002F React component usage example\nexport function useFeatureFlag(flag: string): boolean {\n  \u002F\u002F PostHog React SDK provides useFeatureFlagEnabled hook\n  \u002F\u002F import { useFeatureFlagEnabled } from 'posthog-js\u002Freact'\n  \u002F\u002F return useFeatureFlagEnabled(flag)\n  return isFeatureEnabled(flag)\n}\n```\n\n```python\n# feature_flags_server.py — Server-side feature flag evaluation.\n# Evaluate flags without a network call using local evaluation.\nfrom posthog import Posthog\n\nposthog = Posthog(\n    project_api_key='phc_your_project_key',\n    host='https:\u002F\u002Fanalytics.example.com',\n    personal_api_key='phx_your_personal_api_key'  # Required for local evaluation\n)\n\ndef check_flag(user_id: str, flag: str, properties: dict = None) -> bool:\n    \"\"\"Evaluate a feature flag for a user. Uses local evaluation when possible.\"\"\"\n    return posthog.feature_enabled(\n        flag,\n        distinct_id=user_id,\n        person_properties=properties or {}\n    )\n\ndef get_flag_variant(user_id: str, flag: str) -> str | None:\n    \"\"\"Get the multivariate flag variant for A\u002FB testing.\"\"\"\n    return posthog.get_feature_flag(flag, distinct_id=user_id)\n```\n\n## Session Replay Configuration\n\n```typescript\n\u002F\u002F lib\u002Fsession-replay.ts — Configure session replay with privacy controls.\n\u002F\u002F Mask sensitive inputs and define recording triggers.\nimport posthog from 'posthog-js'\n\nexport function configureSessionReplay() {\n  posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {\n    api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST!,\n    session_recording: {\n      maskAllInputs: false,\n      maskInputOptions: {\n        password: true,\n        color: false,\n        date: false,\n        email: true,\n        tel: true,\n      },\n      maskTextSelector: '[data-ph-mask]',\n      blockSelector: '[data-ph-block]',\n      recordCrossOriginIframes: true,\n    },\n  })\n}\n\n\u002F\u002F Manually control recording\nexport function startRecording() {\n  posthog.startSessionRecording()\n}\n\nexport function stopRecording() {\n  posthog.stopSessionRecording()\n}\n```\n\n## Funnel and Cohort Queries via API\n\n```python\n# posthog_api.py — Query PostHog API for funnels and cohorts.\n# Use for building dashboards or exporting analytics data.\nimport requests\n\nPOSTHOG_HOST = 'https:\u002F\u002Fanalytics.example.com'\nPERSONAL_API_KEY = 'phx_your_personal_api_key'\nPROJECT_ID = '1'\n\nheaders = {'Authorization': f'Bearer {PERSONAL_API_KEY}'}\n\ndef create_funnel_insight(funnel_steps: list[dict]) -> dict:\n    \"\"\"Create a funnel insight via the API.\"\"\"\n    response = requests.post(\n        f'{POSTHOG_HOST}\u002Fapi\u002Fprojects\u002F{PROJECT_ID}\u002Finsights\u002F',\n        headers=headers,\n        json={\n            'name': 'Onboarding Funnel',\n            'filters': {\n                'insight': 'FUNNELS',\n                'events': funnel_steps,\n                'funnel_window_days': 14,\n            }\n        }\n    )\n    return response.json()\n\ndef get_cohort_users(cohort_id: int, limit: int = 100) -> list:\n    \"\"\"Fetch users in a cohort.\"\"\"\n    response = requests.get(\n        f'{POSTHOG_HOST}\u002Fapi\u002Fprojects\u002F{PROJECT_ID}\u002Fcohorts\u002F{cohort_id}\u002Fpersons\u002F',\n        headers=headers,\n        params={'limit': limit}\n    )\n    return response.json()['results']\n\n# Example: Create an onboarding funnel\nfunnel = create_funnel_insight([\n    {'id': 'user_signed_up', 'type': 'events', 'order': 0},\n    {'id': 'onboarding_step_completed', 'type': 'events', 'order': 1,\n     'properties': [{'key': 'step_number', 'value': 3, 'type': 'event'}]},\n    {'id': 'feature_used', 'type': 'events', 'order': 2},\n])\n```\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FTerminalSkills\u002Fskills\u002Fposthog",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill posthog",{"tool":37,"command":38},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill posthog",{"tool":40,"command":41},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill posthog","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FTerminalSkills\u002Fskills\u002Fposthog\u002FSKILL.md",true,[],[46,55,64,73,79,85],{"skillNo":47,"name":48,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[52,53,54],"model","model hierarchy","model hierarchy skill",{"skillNo":56,"name":57,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":18},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[61,62,63],"MCP","zoom","zoom mcp",{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":18},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[70,71,72,62],"sdk","zoom apps sdk","apps",{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[75],{"skillNo":80,"name":81,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[81],{"skillNo":86,"name":87,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":18},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[87]]