hrodrig/pgwd — reverse-engineered prompt

Reverse engineered prompt

GitHub

Build me a Go command line tool called pgwd that watches PostgreSQL connections and tells me when things look unhealthy.

I want to give it a database URL, or a config file with one or more databases, then have it check active, idle, total, and stale connections. It should support simple thresholds, plus a three level warning system like warning, critical, and danger based on percentages. It should be able to run once for scripts, or keep checking on an interval.

When a threshold is crossed, send a clear message to Slack through a webhook, and also optionally send structured logs to Grafana Loki. Let me configure everything through a YAML config file, environment variables, or command line options, with command line options winning.

Please include useful help output, sane defaults, examples, tests, and a Dockerfile so I can run it in automation or containers. Keep the setup straightforward and document common usage.

Want more depth? Deep Reverse