pi-skill-posthog
April 25, 2026 · View on GitHub
A pi skill for querying PostHog analytics via HogQL.
Install
pi skill install skyfallsin/pi-skill-posthog
Setup
Set environment variables:
export POSTHOG_API_KEY="phx_..." # Personal API key from PostHog settings
export POSTHOG_PROJECT_ID="12345" # Project ID from PostHog URL
export POSTHOG_HOST="https://us.posthog.com" # or https://eu.posthog.com
Get your API key: PostHog → Settings → Personal API Keys → Create
Usage
Once installed, the skill activates when you ask about analytics, events, user behavior, funnels, page views, or any PostHog data. The agent runs HogQL queries and returns results as ASCII tables.
Example prompts
- "How many unique users visited in the last 7 days?"
- "Show me the top events today"
- "What browsers are people using?"
- "Show me a funnel from pageview to sign up to purchase"
Direct script usage
node scripts/query.js "SELECT event, count() as cnt FROM events WHERE timestamp > now() - interval 1 day GROUP BY event ORDER BY cnt DESC LIMIT 20"
Options
--limit N— Override result limit (default: 100)--json— Output raw JSON instead of ASCII table--csv— Output CSV format
HogQL Reference
HogQL is PostHog's SQL dialect over ClickHouse. Key tables:
| Table | Description |
|---|---|
events | All tracked events (event, timestamp, person_id, properties.*) |
persons | Person profiles (id, properties.*) |
sessions | Session data |
Common properties: properties.$current_url, properties.$browser, properties.$os, properties.$referring_domain
Time functions: now(), interval N day/hour/minute, toDate(), toStartOfDay()
License
MIT
Pi Ecosystem
| Package | Description |
|---|---|
| pi-mem | Persistent markdown memory for coding agents |
| pi-reflect | Self-improving behavioral files |
| pi-boss | Multi-agent orchestration via tmux |
| pi-room | Multi-agent awareness and coordination |
| pi-vertex-anthropic | Claude via Google Cloud Vertex AI |