Skip to content
cccskills
FreePublished on GitHub

querying-posthog-data

Required reading before writing any HogQL/SQL or calling execute-sql against PostHog. Use whenever the user wants to search, find, or do complex aggregations PostHog entities (insights, dashboards, cohorts, feature flags, experiments, surveys, hog flows, data warehouse, persons, etc.) and query analytics data (trends, funnels, retention, lifecycle, paths, stickiness, web analytics, error tracking, logs, sessions, LLM traces). Covers HogQL syntax differences from ClickHouse SQL, system table schemas (system.*), available functions, query examples, and the schema-discovery workflow.

The English summary is being prepared. Showing the original description.

See how to install

Files included (57)

  • SKILL.md7.3 KB
  • references/available-functions.md11.6 KB
  • references/example-error-tracking.md2.8 KB
  • references/example-event-taxonomy.md1.8 KB
  • references/example-funnel-breakdown.md2.9 KB
  • references/example-funnel-trends.md2.2 KB
  • references/example-lifecycle.md3.8 KB
  • references/example-llm-trace.md3.3 KB
  • references/example-llm-traces-list.md3.8 KB
  • references/example-logs.md1.2 KB
  • references/example-observability-correlation.md4.8 KB
  • references/example-paths.md4.7 KB
  • references/example-person-property-taxonomy.md630 B
  • references/example-retention.md2.6 KB
  • references/example-session-replay.md1.9 KB
  • references/example-sessions.md468 B
  • references/example-stickiness.md1.8 KB
  • references/example-team-taxonomy.md521 B
  • references/example-trends-breakdowns.md4.4 KB
  • references/example-trends-unique-users.md1.3 KB
  • references/example-web-overview.md1.4 KB
  • references/example-web-path-stats.md3.2 KB
  • references/example-web-traffic-by-device-type.md1.2 KB
  • references/example-web-traffic-channels.md1.4 KB
  • references/guidelines.md15.0 KB
  • references/hogql-extensions.md5.7 KB
  • references/models-actions.md2.8 KB
  • references/models-activity-logs.md2.7 KB
  • references/models-ai-observability-events.md3.3 KB
  • references/models-ai-observability-reviews.md7.5 KB
  • references/models-alerts.md2.1 KB
  • references/models-annotations.md2.1 KB
  • references/models-apm-spans.md8.3 KB
  • references/models-batch-exports.md4.8 KB
  • references/models-cohorts.md5.6 KB
  • references/models-dashboards-insights.md3.2 KB
  • references/models-data-warehouse.md8.2 KB
  • references/models-early-access-features.md2.4 KB
  • references/models-endpoints.md2.7 KB
  • references/models-error-tracking.md5.0 KB
  • references/models-flags-experiments.md3.6 KB
  • references/models-heatmaps.md3.0 KB
  • references/models-hog-flows.md1.9 KB
  • references/models-hog-functions.md2.7 KB
  • references/models-integrations.md2.5 KB
  • references/models-logs.md14.4 KB
  • references/models-metrics.md10.2 KB
  • references/models-notebooks.md2.8 KB
  • references/models-session-recording-playlists.md2.0 KB
  • references/models-session-recordings.md2.3 KB
  • references/models-support-tickets.md2.5 KB
  • references/models-surveys.md2.8 KB
  • references/models-usage-metrics.md3.1 KB
  • references/models-variables.md2.7 KB
  • references/person-property-modes.md2.4 KB
  • references/taxonomy-dynamic-properties.md2.8 KB
  • references/taxonomy-skipped-events.md1.0 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Querying data in PostHog

The guidelines contain the same instructions as posthog:execute-sql. If you've already read posthog:execute-sql, you don't need to read them again.

When to use this skill

Finding a specific PostHog entity

When the user wants to find a specific entity created in PostHog (insights, dashboards, cohorts, feature flags, experiments, surveys, hog flows, data warehouse items, etc.), or when a list/search tool returns too many results to narrow down:

  1. Read the appropriate schema reference under Data Schema to understand the entity's table and columns.
  2. Use posthog:execute-sql to query the system table and find the matching entity (typically returning its ID).
  3. Use the dedicated read tool for that entity type (e.g. posthog:insight-get, posthog:dashboard-get) to retrieve the full entity by ID.

Don't try to reconstruct the entity from SQL — execute-sql is for discovery, the read tool is for retrieval.

Querying analytics data

When the user wants analytics data (trends, funnels, retention, paths, sessions, LLM traces, web analytics, errors, logs, etc.) and the existing insight schemas don't fit the request:

  1. Look for a matching example under Analytics Query Examples. The list is not exhaustive — there may not be an example for every scenario. If one is a close fit (same domain, similar aggregation), read it; otherwise skip this step.
  2. Adapt the example query (if one was found) to the user's request and run it via posthog:execute-sql. If no example fit, compose the query from scratch using the Data Schema and HogQL References.

Data Schema

Schema reference for PostHog's core system models, organized by domain:

HogQL References

Analytics Query Examples

Use the examples below to create optimized analytical queries.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Use Cursor's browser aria snapshots to audit a page for accessibility issues — missing labels, broken tab order, contrast, and ARIA misuse.

The English summary is being prepared. Showing the original description.

0xAidan/polymarket-bot-test4Updated Sep 4, 2026

Add PostHog analytics to a web application, including event tracking, page views, feature flags, and session replay.

The English summary is being prepared. Showing the original description.

0xAidan/polymarket-bot-test4Updated Sep 4, 2026

Generate OpenAPI/Swagger documentation for an API, including endpoint schemas, request/response types, and interactive docs UI.

The English summary is being prepared. Showing the original description.

0xAidan/polymarket-bot-test4Updated Sep 4, 2026

Add authentication to a web application using NextAuth.js (Auth.js), including OAuth providers, session management, and protected routes.

The English summary is being prepared. Showing the original description.

0xAidan/polymarket-bot-test4Updated Sep 4, 2026

Dockerize an application with a production-ready Dockerfile, docker-compose setup, and .dockerignore.

The English summary is being prepared. Showing the original description.

0xAidan/polymarket-bot-test4Updated Sep 4, 2026

Set up Playwright end-to-end testing in a project, including test configuration, example tests, and CI integration.

The English summary is being prepared. Showing the original description.

0xAidan/polymarket-bot-test4Updated Sep 4, 2026

See all skills by 0xAidan

Report a problem with this skill