# Pg Readonly

> PostgreSQL read-only data inspection skill. Use when users ask an agent to inspect rows, verify business state, compare owner and derived tables, or produce safe SELECT queries without running DML, DDL, or repairs.

- Skill: `phperkael/pg-readonly` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add phperkael/pg-readonly`
- Raw SKILL.md: https://api.skillmd.com/api/skills/phperkael/pg-readonly/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: PHPerKael (https://skillmd.com/u/phperkael)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/phperkael/pg-readonly

---


# 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

1. Pin one business key: order id, user id, tenant id, request id, object id, or exact time range.
2. Determine the owner table before reading derived tables.
3. Open the database through the approved access path for the environment.
4. Run narrow `SELECT` statements only.
5. Include exact predicates, status columns, timestamps, correlation ids, and conservative `limit`.
6. Compare owner rows with derived rows only when it answers the question.
7. Summarize row counts, decisive columns, and uncertainty.

## Guard Rails

Never run:

- `insert`
- `update`
- `delete`
- `truncate`
- `alter`
- `drop`
- `create`
- `grant`
- `reindex`
- 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](./references/commands.md) for query templates.

