Agent skill · posthog

querying-production-databases-via-metabase

Runs read-only production database analysis through PostHog's internal Metabase instances. Use for ClickHouse query logs, slow query cost, Postgres query plans, index selection, or tenant-size analysis. Covers US and EU database discovery, SSO login through `hogli`, safe query rules, and query patterns for both engines.

What it needs

About 6k tokens when loaded.

What this skill does

Querying production databases via Metabase PostHog's production databases are reachable for ad-hoc, read-only analysis through internal Metabase instances. Both Metabases sit behind an AWS ALB with Cognito OAuth, so authentication is SSO-gated — Metabase API keys alone won't work. Two engines are behind the same API surface, and the reason to reach for each is different: ClickHouse — system.querylog analysis: which queries are slow, what they read, who runs them. Postgres (the app database) — the real query plan for an app query, and how a per-project table's rows spread across the fleet. For pre-built canned ClickHouse queries (slow query summaries, materialization analysis), see the query-performance-analysis repo, which is the source of truth for those and uses the same Metabase API surface. Environment Region Metabase URL ------ -------------------------------------- US https://metabase.prod-us.posthog.dev EU https://metabase.prod-eu.posthog.dev Database IDs are not stable — they change when Metabase's metadata DB is rebuilt or connections are re-added. Never hardcode an ID. Always discover the current list: Regional layout (names may vary; re-check with metabase:databases): US exposes one ClickHouse database (used for querylog and data reads). EU exposes two ClickHouse databases — a query tier (use for querylog analysis) and a data tier (production reads: events, persons, etc.). Pick the one whose name indicates the query tier. Both Metabases also expose Postgres databases (the app DB) and, on EU, the ingestion-layer and migrations databases. Authentication Use hogli to get a valid cookie. It opens the system browser for SSO, captures cookies from the user's logged-in browser profile, and caches them at ~/.config/posthog/metabase/cookie-{region} (mode 0600). Prompt the user to run hogli metabase:login themselves — the harness blocks Keychain access from agent shells, so the user has to authenticate interactively. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills posthog/querying-production-databases-via-metabase

View the source on GitHub

Browse the @skills marketplace