← ClaudeAtlas

read-only-db-probelisted

Use when a claim needs numbers from a live database and no committed report already produces them — sizing a cohort before a design decision, verifying a reviewer's assertion against the data instead of arguing, checking what a load actually left behind. Produces a throwaway read-only script in the session scratchpad and quotes what it printed. Do NOT fire for anything that writes (that is reversible-bulk-write), or when the repo ships a report command that already answers the question — run that instead.
damson/hard-won-skills · ★ 1 · Code & Development · score 67
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