querying-production-databases-via-metabase
Skill by PostHog
Runs read-only analysis on PostHog's production ClickHouse and Postgres databases through internal Metabase instances. It is a fallback for query plans, the test cluster, live query_log, and shareable links.
Install querying-production-databases-via-metabase
Built from the published package, never by AI.
git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.claude/skills && cp -r /tmp/posthog/.agents/skills/querying-production-databases-via-metabase ~/.claude/skills/querying-production-databases-via-metabaRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install querying-production-databases-via-metabase in Claude Code
git clone --depth 1 https://github.com/PostHog/posthog /tmp/posthog && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/posthog/.agents/skills/querying-production-databases-via-metabase ~/.gemini/antigravity-cli/skills/querying-production-databases-via-metabaAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install querying-production-databases-via-metabase in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill runs read-only analysis against PostHog's production databases through internal Metabase instances in the US and EU regions. It covers two engines: ClickHouse for system.query_log analysis and Postgres for the app database. It is a fallback for work the default querying-production-databases skill cannot do, such as Postgres query plans with EXPLAIN, the test cluster, live query_log across the cluster, and shareable Metabase links.
Access is SSO-gated because the Metabase instances sit behind an AWS ALB with Cognito OAuth. Users run hogli metabase:login once per region to cache a session cookie. Agents use hogli metabase:query so the session value stays out of the transcript. The skill also covers database discovery, safe query rules, and query patterns for both engines. It is intended for people who have access to PostHog's internal Metabase instances.
Written from the project's SKILL.md and checked against it.
What it can do
- Discover databasesLists the current Metabase database IDs for each region with hogli metabase:databases.
- Log in with SSOUses hogli metabase:login to capture and cache a session cookie for each region.
- Run ClickHouse queriesUses hogli metabase:query to send SQL to a ClickHouse database and save results.
- Analyze query_logFinds slow queries and per-team query cost across the cluster using system.query_log.
- Inspect Postgres plansRuns EXPLAIN on the app database to check query plans and index selection.
- Look up a query by query_idUses a saved Metabase card or a WHERE query_id clause to find one query.
What you need
- Access to PostHog's internal Metabase instances
- Browser login through SSO
- hogli installed
- macOS Full Disk Access for the terminal app, to read browser cookies
Try asking
- Find the slowest ClickHouse queries from the last 24 hours in the US region
- Show the EXPLAIN plan for this Postgres app query without running it
- Summarize per-team query cost over the last 7 days using query_log
Good to know
- Read-only: only SELECT and EXPLAIN are allowed on a shared read replica.
- Metabase native queries time out after about 60 seconds, so wide scans can be cut off.
- Cookies are cached per region, so login is needed for each region used.
- Users must run hogli metabase:login themselves because agent shells cannot access Keychain.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/querying-production-databases-via-metabase/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to querying-production-databases-via-metabase
All alternatives →Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.
Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.
Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.
Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.
Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.
Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.
Compare with hugging-face-datasets, db-repair or alloydb-basics
querying-production-databases-via-metabase: common questions
Which databases can this skill query?
It queries ClickHouse and the Postgres app database through PostHog's internal Metabase instances in the US and EU regions. Database IDs are discovered at runtime and should not be hardcoded.
Can it write to production data?
No. The source says to run only SELECT and EXPLAIN statements and not to run writes or schema changes.
Why does it need SSO instead of an API key?
The Metabase instances sit behind an AWS ALB with Cognito OAuth, so Metabase API keys alone will not work.
How do I install querying-production-databases-via-metabase?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is querying-production-databases-via-metabase free?
The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.
Is querying-production-databases-via-metabase safe to use?
It scores 80 of 100. Grades: maintenance A, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to querying-production-databases-via-metabase?
Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.
