querying-production-databases

querying-production-databases is a skill for Claude Code, Codex from PostHog/posthog-foss. It costs 175 tokens per session (3,360 once invoked), scanned A, original, MIT.

A guide for running read-only SQL queries against PostHog's live production databases in the US and EU. SQL is a language for asking databases for selected data; the guide covers both ClickHouse and PostgreSQL connections.

In plain words
What is it for?
Use it to query production data, choose the US or EU route, and run read-only analysis through PostHog's tools.
Why use it?
It explains how to reach the correct regional database without accidentally using the wrong connection or writing data.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it to query production data, choose the US or EU route, and run read-only analysis through PostHog's tools.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/posthog/posthog-foss/querying-production-databases
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add PostHog/posthog-foss --skill querying-production-databases
Clone the repo
git clone --depth 1 https://github.com/PostHog/posthog-foss

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for querying-production-databases

README.md
[![agentmods](https://agentmods.dev/badge/skills/posthog/posthog-foss/querying-production-databases/github.svg)](https://agentmods.dev/skills/posthog/posthog-foss/querying-production-databases)
Your own site
<a href="https://agentmods.dev/skills/posthog/posthog-foss/querying-production-databases"><img src="https://agentmods.dev/badge/skills/posthog/posthog-foss/querying-production-databases/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for querying-production-databases

Your own site · 80×15
<a href="https://agentmods.dev/skills/posthog/posthog-foss/querying-production-databases"><img src="https://agentmods.dev/badge/skills/posthog/posthog-foss/querying-production-databases.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 175 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,360 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00175 $0.03360
Opus 5.5 $0.00070 $0.01344
Sonnet 5.5 $0.00035 $0.00672
Haiku 4.5 $0.00017 $0.00336

Measured 13d ago against content hash cdb0296152d6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

querying-production-databases scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 13d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/querying-production-databases/SKILL.md · 219 lines

How it starts

The opening of the file, as written. The whole thing — 219 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Querying production databases

PostHog runs two separate instances: US and EU. Each one has an internal project that holds direct-connect SQL sources: read-only, live connections to that region's production ClickHouse and Postgres. execute-sql with a connectionId sends a query to one of these sources and returns the rows.

Staff work from one place, US team 2, through the PostHog MCP:

  • US sources are in team 2, so the MCP queries them directly.
  • EU sources are in the EU instance, which a US login cannot reach. A personal PostHog connection links your EU login to US team 2. posthog-connection-call then runs the same tools in the EU project, as your EU user.
flowchart LR
    agent{{Agent}} --> mcp[PostHog MCP<br/>US team 2]
    mcp -->|execute-sql + connectionId| us[(US direct-connect sources<br/>ClickHouse, Postgres)]
    mcp -->|posthog-connection-call| eu[EU internal project<br/>as your EU login]
    eu -->|execute-sql + connectionId| eus[(EU direct-connect sources<br/>ClickHouse, Postgres)]
    classDef phBlue fill:#1d4aff,stroke:#1d4aff,color:#fff;
    classDef phGray fill:#e5e7eb,stroke:#c7ccd1,color:#000;
    class agent,mcp,eu phBlue;
    class us,eus phGray;

One-time setup

1. Point the MCP at US team 2

Authenticate the PostHog MCP against US cloud. If the session starts in another project, run switch-project to team 2.

2. Connect your EU login to US team 2

Do this in the US app, while team 2 is the current project. The connection belongs to the project you are in when you create it.

  1. Open Account settings → Personal integrations → PostHog project (/settings/user-personal-integrations). The section needs the POSTHOG_CONNECT feature flag.
  2. Click Connect a PostHog project.
  3. Set the region to European Union (EU).
  4. Select only these scopes: query read, external_data_source read and user read. Do not pick a preset. user read lets the connection read your EU user, which is how it finds the EU project.
  5. In a separate tab, open eu.posthog.com and switch your current project to the EU internal project that holds the direct-connect sources. The connection reads your current EU project to find its name and organization. If your current EU project is a different one, such as a demo project, target can fail to read the project you pick in step 6.
  6. Click Connect EU, sign in with your EU login, and choose only that EU internal project on the consent screen. The connection can use only the projects you pick there.

Read the full file on GitHub · 219 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 13d ago Changed cdb0296152d6
  2. 17d ago Changed · +43 lines 81d5587e0856
  3. 20d ago Changed · +18 lines 5151195f4626
  4. 1mo ago First seen · 158 lines · 175 tokens per session scan A aec580edb00b

Subscribe to this mod's changes

querying-production-databases is a skill published in the GitHub repository PostHog/posthog-foss (736 stars, last pushed today), licensed MIT. It adds 175 tokens to every session and 3,360 once invoked, about $0.0007 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-28.

Related

querying-production-databases compared with skills from other repositories

querying-production-databases next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
querying-production-databasesPostHog/posthog-fossSkill736todayMITA175Claude Code, Codex
alloydb-basicsgoogle/skillsSkill26ktodayApache-2.0A72Claude Code, Codex
postgresql-table-designwshobson/agentsSkill43kyesterdayMITA37Claude Code
db-repairgarrytan/gbrainSkill34ktodayMITA96Claude Code
dsqlawslabs/agent-pluginsSkill958todayApache-2.0A247Claude Code
volcengine-rds-postgresqlbytedance/agentkit-samplesSkill496yesterdayApache-2.0A63Claude Code, Codex
postgresdbericrisco/rsc-harnessSkill707yesterdayMITA91Claude Code, Codex