PostHog Query for Openclaw

A powerful tool for executing HogQL (ClickHouse) queries against PostHog product analytics data directly from your terminal.

quinlanjager
v1.0.0
Feb 20, 2026
0
0
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install posthog-query

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install posthog-query using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is PostHog Query?

The PostHog Query skill enables developers and data analysts to interface with PostHog analytics through the PostHog CLI. By leveraging HogQL, a ClickHouse-compatible SQL dialect, users can programmatically access event counts, trends, and specific user behaviors without leaving their development environment.

This integration within the Openclaw Skills ecosystem streamlines the process of fetching raw data or high-level insights for reporting, debugging, and data-driven decision making. It provides a direct bridge between your terminal and PostHog's robust data warehouse.

PostHog Query Use Cases

  • Monitoring real-time event counts like pageviews or custom conversions.
  • Generating daily or weekly trend reports using timestamp-based aggregations.
  • Debugging event properties and tracking issues by inspecting the most recent events.
  • Filtering analytics data by specific URLs or browser properties using HogQL syntax.
  • Automating the extraction of analytics data for external reporting tools.

How PostHog Query Works

  1. The skill utilizes the posthog-cli to interact with the PostHog API.
  2. Users provide a HogQL query string which is passed to the exp query run subcommand.
  3. The CLI handles authentication via a stored token in the user's home directory.
  4. PostHog processes the ClickHouse-compatible SQL and returns the dataset.
  5. The results are output as JSON lines to stdout, facilitating easy parsing and integration with Openclaw Skills workflows.

PostHog Query Setup

First, install the PostHog CLI globally using npm:

npm install -g posthog-cli

Next, perform the one-time authentication. Ensure your API key has the query:read scope:

posthog-cli login

This process stores your credentials in ~/.posthog/credentials.json for future sessions.

PostHog Query Data Schema & Taxonomy

The skill interacts with PostHog's underlying ClickHouse structure. Data is typically returned in the following format:

Component Description
events The primary table containing all tracked user actions.
properties A collection of metadata attached to events, accessed via bracket notation (e.g., properties['$browser']).
timestamp The UTC time when the event was recorded.
results Standard output is JSON lines; use --debug to see full metadata including column types.

PostHog Query Advanced Features

  • Interactive Querying: Use the posthog-cli exp query editor for a guided SQL writing experience.
  • Syntax Validation: The check subcommand allows you to verify HogQL syntax and types without consuming query resources.
  • Debug Mode: Append --debug to retrieve comprehensive response metadata, including cache status and precise column definitions.
  • ClickHouse Compatibility: Leverage standard ClickHouse functions for advanced data transformations directly within your Openclaw Skills queries.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Requires
Bins posthog-cli
Github Stars: 0
forks: 0

Featured*