querying-posthog-data

Query PostHog analytics data using HogQL and SQL foundations.

75|14|Updated Feb 18, 2026
One-click install
npx skills add https://github.com/PostHog/ai-plugin --skill querying-posthog-data
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: querying-posthog-data
Source: https://github.com/PostHog/ai-plugin/tree/main/skills/querying-posthog-data
Command: npx skills add https://github.com/PostHog/ai-plugin --skill querying-posthog-data

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

PostHog data is rich but often requires guidance to search, filter, and aggregate effectively. This skill provides structured guidance on HogQL/SQL usage, system schemas, and query patterns to help users query analytics data across insights, dashboards, cohorts, feature flags, experiments, data warehouse, and more.

Core Features & Use Cases

  • HogQL & SQL guidance for building correct queries, including syntax nuances and schema discovery
  • Data Schema references and available functions to speed up query construction
  • Use cases covering trends, funnels, retention, paths, web analytics, errors, logs, LLm traces, and data warehouse integration
  • Practical workflows for discovery, validation, and safe execution

Quick Start

Read the guidelines in references/guidelines.md and run a basic HogQL query against the events table to validate connectivity and syntax.

Frequently Asked Questions about querying-posthog-data

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write HogQL queries for PostHog data discovery?

To write HogQL queries for PostHog data discovery, apply SQL foundations to filter and aggregate events. Follow schema references and time-range discipline to ensure valid syntax and safe querying workflows across your analytics data.

When should I use HogQL instead of standard SQL in PostHog?

Use HogQL instead of standard SQL when querying PostHog-specific entities like events, dashboards, cohorts, and feature flags. HogQL provides tailored functions and schema access for precise analytics, whereas standard SQL handles external data warehouse tables.

What PostHog data schemas are available for building analytics queries?

PostHog data schemas cover events, insights, dashboards, cohorts, feature flags, and experiments. Referencing these schemas and available HogQL functions speeds up query construction and ensures accurate filtering for trends, funnels, retention, and paths.

Can I query web analytics, errors, and LLM traces using HogQL?

Yes, you can query web analytics, errors, logs, and LLM traces using HogQL. The skill provides query patterns and data schema references to help you search, filter, and aggregate these specific data types effectively within PostHog.

What are the best practices for safe querying workflows in PostHog?

Safe querying workflows in PostHog require enforcing time-range discipline and validating data schemas before execution. Following best-practice patterns for post-hoc analytics prevents errors and ensures precise discovery across your events and insights.

Does querying PostHog data with HogQL require connecting a data warehouse?

Querying PostHog data with HogQL does not strictly require a data warehouse for native events and insights, but schema references and query patterns also support data warehouse integration if you need to analyze external data sources.