query_authoring_pglisted
Install: claude install-skill jedbjorn/subfloor
# query_authoring_pg — diagnostic SQL against the app's Postgres
The pg kit's query half: `dev_kit` = the sidecar, `test_authoring_pg` = the
test infra, this = ad-hoc SQL against the fork's app DB. Use when diagnosing
data issues, verifying a migration's effect, or checking an invariant by
query.
## Know which DB you're pointed at
| DB | Where | What its data proves |
|---|---|---|
| Sandbox sidecar (`$DATABASE_URL`) | inside your container | your dev/test copy — only what you or the tests put there. Empty/missing rows here prove NOTHING about the FnB's data. |
| The FnB's stack DB (dev/prod) | on the host, outside your container | the data actually being diagnosed — reachable only by handoff (below) |
Name the DB in every finding. An FnB-reported data issue lives in THEIR DB —
never confirm or refute it against your sidecar. Reproduce the shape locally
if useful; the verdict query runs on their side.
## psql mechanics
SQL is not a shell command — `SELECT …` pasted at a fish/bash prompt dies at
the shell. Run it through psql:
```bash
psql "$DATABASE_URL" -X -P pager=off -c "SELECT count(*) FROM users;" # one-shot
psql "$DATABASE_URL" -X -v ON_ERROR_STOP=1 -f diag.sql # scripted
```
- `-X` skips any psqlrc; `-P pager=off` keeps output capture-friendly.
- `\x auto` (in-session) for wide rows.
- Schema truth = `\dt` + `\d <table>` — check a column's actual type before
writing predicates against it; never guess from habit.
## Parameters — `:name` is