[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BR2P12DKB902VNEF7PX8BY":3,"skill-same:01M7BR2P12DKB902VNEF7PX8BY":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M7BR2P12DKB902VNEF7PX8BY","read-only-db-probe",null,"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\u002Fhard-won-skills","damson","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F804217?v=4","01M7BR01SMVEGA4HRD46VV1SXF","Damien D.","01M7BR01TR37MB9R73C1C0ENGG",1,"MIT","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdata-safety\u002Fskills\u002Fread-only-db-probe\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: read-only-db-probe\ndescription: >\n  Use when a claim needs numbers from a live database and no committed report already\n  produces them: sizing a cohort before a design decision, verifying a reviewer's\n  assertion against the data instead of arguing, checking what a load actually left\n  behind. Produces a throwaway read-only script in the session scratchpad and quotes what\n  it printed. Do NOT fire for anything that writes (that is reversible-bulk-write), or\n  when the repo ships a report command that already answers the question: run that\n  instead.\n---\n\n# Read-only probe against a live database\n\nThe deliverable is a number quoted from the probe's stdout. Never from the\nquery looking right, and never from memory of a previous run.\n\n## Procedure\n\n1. **Check for an existing report first.** A repo that measures itself ships\n   commands for the recurring questions (a queue-shape report, a health\n   report). Re-deriving one of those by hand produces a second number that can\n   disagree with the one everybody else quotes.\n\n2. **Write the script to the session scratchpad**. Its own step, never bundled\n   into the shell call that runs it: a permission denial on a bundled call\n   means the file was never written, and whatever runs next reads nothing,\n   silently.\n\n   The template. Every line is here because its absence has cost a session a\n   retry:\n\n   ```ts\n   \u002F\u002F Read-only: \u003Cthe question this probe answers>\n   import { pool } from '\u003Cabsolute path to the repo's pool helper>';\n\n   async function main() {           \u002F\u002F scratchpad files transpile as CJS: \n     const { rows } = await pool.query(`\n       select count(*)::int as n from …\n     `);                             \u002F\u002F top-level await crashes, main() doesn't\n     console.log(rows);\n     await pool.end();               \u002F\u002F or the process hangs, looking stuck\n   }\n   main().catch((e) => { console.error(e); process.exit(1); });\n   ```\n\n3. **Cast anything aggregated from catalog columns to `text`**:\n   `array_agg(attname::text)`, not `array_agg(attname)`. Postgres drivers parse\n   only the array types they know; `name[]` and friends arrive as the literal\n   string `'{a,b}'`, and spreading a string silently yields its characters. The\n   failure mode is an empty result that reads as \"none found\", not an error.\n\n4. **Run it with the repo's env sourced by absolute path:**\n\n   ```bash\n   set -a; source \u002Fabsolute\u002Fpath\u002Fto\u002Frepo\u002F.env; set +a\n   npx tsx \u003Cscratchpad>\u002Fprobe.ts\n   ```\n\n   Absolute, because the working directory resets between shell calls and a\n   relative `source` that finds nothing leaves the connection string unset,\n   which surfaces as a missing-variable error naming the right fix, at best.\n\n5. **Quote the printed numbers.** If the probe informs a reply to a reviewer or\n   a design decision, the stdout lines are the evidence: paste them, don't\n   paraphrase them. A probe that produced a surprising number gets re-read for\n   what it actually measured before the number gets used (a filter measuring\n   presence-in-text is not a filter measuring headwords).\n\n## When to STOP\n\n- **The probe wants to write**: even \"just a flag\". Hand over to\n  `reversible-bulk-write`: invariant first, dry-run, rollback before apply.\n- **A committed report command answers the question**: run it; do not fork the\n  truth.\n- **The only reachable database is production and the query is heavy.** A\n  `count(*)` is fine; a scan that would sit on a busy table during work hours\n  is a conversation, not a probe.\n","# Read-only probe against a live database\n\nThe deliverable is a number quoted from the probe's stdout. Never from the\nquery looking right, and never from memory of a previous run.\n\n## Procedure\n\n1. **Check for an existing report first.** A repo that measures itself ships\n   commands for the recurring questions (a queue-shape report, a health\n   report). Re-deriving one of those by hand produces a second number that can\n   disagree with the one everybody else quotes.\n\n2. **Write the script to the session scratchpad**. Its own step, never bundled\n   into the shell call that runs it: a permission denial on a bundled call\n   means the file was never written, and whatever runs next reads nothing,\n   silently.\n\n   The template. Every line is here because its absence has cost a session a\n   retry:\n\n   ```ts\n   \u002F\u002F Read-only: \u003Cthe question this probe answers>\n   import { pool } from '\u003Cabsolute path to the repo's pool helper>';\n\n   async function main() {           \u002F\u002F scratchpad files transpile as CJS: \n     const { rows } = await pool.query(`\n       select count(*)::int as n from …\n     `);                             \u002F\u002F top-level await crashes, main() doesn't\n     console.log(rows);\n     await pool.end();               \u002F\u002F or the process hangs, looking stuck\n   }\n   main().catch((e) => { console.error(e); process.exit(1); });\n   ```\n\n3. **Cast anything aggregated from catalog columns to `text`**:\n   `array_agg(attname::text)`, not `array_agg(attname)`. Postgres drivers parse\n   only the array types they know; `name[]` and friends arrive as the literal\n   string `'{a,b}'`, and spreading a string silently yields its characters. The\n   failure mode is an empty result that reads as \"none found\", not an error.\n\n4. **Run it with the repo's env sourced by absolute path:**\n\n   ```bash\n   set -a; source \u002Fabsolute\u002Fpath\u002Fto\u002Frepo\u002F.env; set +a\n   npx tsx \u003Cscratchpad>\u002Fprobe.ts\n   ```\n\n   Absolute, because the working directory resets between shell calls and a\n   relative `source` that finds nothing leaves the connection string unset,\n   which surfaces as a missing-variable error naming the right fix, at best.\n\n5. **Quote the printed numbers.** If the probe informs a reply to a reviewer or\n   a design decision, the stdout lines are the evidence: paste them, don't\n   paraphrase them. A probe that produced a surprising number gets re-read for\n   what it actually measured before the number gets used (a filter measuring\n   presence-in-text is not a filter measuring headwords).\n\n## When to STOP\n\n- **The probe wants to write**: even \"just a flag\". Hand over to\n  `reversible-bulk-write`: invariant first, dry-run, rollback before apply.\n- **A committed report command answers the question**: run it; do not fork the\n  truth.\n- **The only reachable database is production and the query is heavy.** A\n  `count(*)` is fine; a scan that would sit on a busy table during work hours\n  is a conversation, not a probe.\n",{"name":5,"description":7},"main","9435f9fa04b69d2217f8cab3c817dd5c3c1d1021","plugins\u002Fdata-safety\u002Fskills\u002Fread-only-db-probe",0,"https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills","https:\u002F\u002Fgithub.com\u002Fdamson","http:\u002F\u002Fgoo.gl\u002F3UwFRt","2026-11-14 14:28:11",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add damson\u002Fhard-won-skills --skill read-only-db-probe",{"tool":38,"command":39},"bunx","bunx skills add damson\u002Fhard-won-skills --skill read-only-db-probe",{"tool":41,"command":42},"pnpm","pnpm dlx skills add damson\u002Fhard-won-skills --skill read-only-db-probe","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdata-safety\u002Fskills\u002Fread-only-db-probe\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"README.md","REFERENCE","参考文档",4259,"https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fdata-safety\u002Fskills\u002Fread-only-db-probe\u002FREADME.md",[53,60,66,71,76,81],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7BRCESR9BRFAH87J2ZQY5T2","skill-two","Fixture skill","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fwrong_welcome_total\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-two\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7BRCDPHEPZES71BYBRTZ1G3","skill-one","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fwrong_welcome_total\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-one\u002FSKILL.md",[],[],{"skillNo":67,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7BRCCHHB3Q07BR0QN339D3F","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fwrong_table_count\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-two\u002FSKILL.md",[],[],{"skillNo":72,"name":62,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7BRC9J97QKZHGKVXMER5ZEE","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fwrong_table_count\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-one\u002FSKILL.md",[],[],{"skillNo":77,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7BRC8C39NM8VVAQ3TKP0CRS","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fvalid_marketplace\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-two\u002FSKILL.md",[],[],{"skillNo":82,"name":62,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7BRC75THG394KDGYV35ET19","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fvalid_marketplace\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-one\u002FSKILL.md",[],[]]