read-only-db-probelisted
Install: claude install-skill damson/hard-won-skills
# Read-only probe against a live database
The deliverable is a number quoted from the probe's stdout — never from the
query looking right, and never from memory of a previous run.
## Procedure
1. **Check for an existing report first.** A repo that measures itself ships
commands for the recurring questions (a queue-shape report, a health
report). Re-deriving one of those by hand produces a second number that can
disagree with the one everybody else quotes.
2. **Write the script to the session scratchpad** — its own step, never
bundled into the shell call that runs it: a permission denial on a bundled
call means the file was never written, and whatever runs next reads
nothing, silently.
The template. Every line is here because its absence has cost a session a
retry:
```ts
// Read-only: <the question this probe answers>
import { pool } from '<absolute path to the repo's pool helper>';
async function main() { // scratchpad files transpile as CJS —
const { rows } = await pool.query(`
select count(*)::int as n from …
`); // top-level await crashes, main() doesn't
console.log(rows);
await pool.end(); // or the process hangs, looking stuck
}
main().catch((e) => { console.error(e); process.exit(1); });
```
3. **Cast anything aggregated from catalog columns to `text`** —
`array_agg(attname::text)`, not `array_agg(attname)`. Postgres drivers
parse onl