querying-local-postgres

Installation
SKILL.md

Querying local Postgres (READ-ONLY) — PostHog repo

User's query: $ARGUMENTS

Scope: This repo uses PostgreSQL for app metadata (teams, projects, flags, Django models, etc.). Analytics event data lives in ClickHouse, not Postgres — use HogQL / ClickHouse tools for events-style questions unless the user explicitly wants Postgres.

When to use

  • User asks to query the database, inspect tables, or run SQL against Postgres
  • Debugging: Row-level checks (e.g. why a team/project/flag row looks wrong), migrations, constraints, duplicate keys
  • Performance: EXPLAIN / EXPLAIN (ANALYZE, …) on read-only SELECT against Django or app tables

Instructions

  1. Strictly forbid mutations — See "Mutations strictly forbidden" below. If the user asks for any write or mutation, refuse and explain the skill is read-only.
  2. Translate the user's question into one or more read-only SQL statements.
  3. Show the SQL in a code block before running.
  4. Run using the command pattern below (always with PGOPTIONS='-c default_transaction_read_only=on' to force a read-only connection).
  5. Show results and give a brief interpretation (especially when used for debugging or plan review).
Installs
3
GitHub Stars
513
First Seen
3 days ago
querying-local-postgres — posthog/posthog-foss