PostgreSQL Readonly
Use this skill for read-only PostgreSQL investigation.
This skill is not for data repair, migrations, DML, DDL, backfills, or production writes.
Required Inputs
Before querying, identify:
- environment
- database
- connection method
- business key or time window
- owning service or owning table when known
Do not print passwords or full DSNs in the final answer.
Workflow
- Pin one business key: order id, user id, tenant id, request id, object id, or exact time range.
- Determine the owner table before reading derived tables.
- Open the database through the approved access path for the environment.
- Run narrow
SELECTstatements only. - Include exact predicates, status columns, timestamps, correlation ids, and conservative
limit. - Compare owner rows with derived rows only when it answers the question.
- Summarize row counts, decisive columns, and uncertainty.
Guard Rails
Never run:
insertupdatedeletetruncatealterdropcreategrantreindex- ad hoc repair SQL
Avoid broad table scans unless the user explicitly asks for aggregate investigation and a bounded time window exists.
Output
Include:
- database and tables queried
- query intent
- row count
- decisive values
- whether the data is source of truth or derived
- remaining risk
References
Read commands.md for query templates.