tools-and-features-hogql

Create HogQL queries to analyze PostHog events, properties, and sessions.

58|5|Updated Jan 19, 2026
One-click install
npx skills add https://github.com/PostHog/skills --skill tools-and-features-hogql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tools-and-features-hogql
Source: https://github.com/PostHog/skills/tree/main/skills/posthog/tools-and-features/skills/hogql
Command: npx skills add https://github.com/PostHog/skills --skill tools-and-features-hogql

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

HogQL enables users to query PostHog data; this skill helps you craft HogQL queries to analyze events, properties, cohorts, and sessions within PostHog analytics.

Core Features & Use Cases

  • Property access guidelines: Use properties.$name for event properties and person.properties.$name for person properties.
  • Common query patterns: event queries, property breakdowns, person property breakdowns, and cohort filtering.
  • Framework guidelines: Includes placeholders like {filters}, time-based groupings with dateTrunc/dateDiff, and testing patterns for dashboards.
  • Use references for advanced functions, aggregations, and date/time helpers as documented in the references.

Quick Start

Write a HogQL query to count pageviews by properties.$current_url for the last 7 days using the {filters} placeholder.

Frequently Asked Questions about tools-and-features-hogql

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

FAQPage Schema
How do I write a HogQL query to analyze PostHog events and properties?

To write a HogQL query for PostHog analytics, use property access conventions like properties.$name for event properties and person.properties.$name for person properties, applying the {filters} placeholder for event-level filtering and property breakdowns.

Can I use HogQL for time-based aggregations and session analysis in PostHog?

HogQL supports time-based aggregations and session analysis in PostHog by using date and time functions such as dateTrunc and dateDiff to group events and calculate time differences within your query framework.

What's the best way to filter PostHog cohorts using HogQL?

Filtering PostHog cohorts with HogQL involves applying cohort filtering query patterns alongside the {filters} placeholder to isolate specific user groups and analyze their event data and properties.

Does HogQL support event-level filtering and property-based grouping for dashboards?

HogQL supports event-level filtering and property-based grouping for dashboards by utilizing testing patterns and framework guidelines, ensuring accurate aggregations and property breakdowns across specified date ranges.

Why does my HogQL query need the {filters} placeholder for PostHog analytics?

The {filters} placeholder is required in HogQL queries for PostHog analytics to correctly apply event-level filtering and ensure your property breakdowns and aggregations function within the standard framework guidelines.