Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add iliaal/whetstone --skill ia-postgresqlgit clone --depth 1 https://github.com/iliaal/whetstoneWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/iliaal/whetstone/ia-postgresql)<a href="https://agentmods.dev/skills/iliaal/whetstone/ia-postgresql"><img src="https://agentmods.dev/badge/skills/iliaal/whetstone/ia-postgresql.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00049 | $0.05945 |
| Opus 5 | $0.00024 | $0.02972 |
| Sonnet 5 | $0.00010 | $0.01189 |
| Haiku 4.5 | $0.00005 | $0.00594 |
Grade A, and why
ia-postgresql scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 267 lines — stays where its author put it; the contents beside it link to each section on GitHub.
PostgreSQL
Data Type Defaults
| Need | Use | Avoid |
|---|---|---|
| Primary key | BIGINT GENERATED ALWAYS AS IDENTITY |
SERIAL, BIGSERIAL |
| Timestamps | TIMESTAMPTZ |
TIMESTAMP (loses timezone) |
| Text | TEXT |
VARCHAR(n) unless constraint needed |
| Money | NUMERIC(precision, scale) |
MONEY, FLOAT |
| Boolean | BOOLEAN with NOT NULL DEFAULT |
nullable booleans |
| JSON | JSONB |
JSON (no indexing), text JSON |
| UUID | gen_random_uuid() (PG13+) |
uuid-ossp extension |
| IP addresses | INET / CIDR |
text |
| Ranges | TSTZRANGE, INT4RANGE, etc. |
pair of columns |
| Raw bytes (verbatim payload) | BYTEA |
JSONB, TEXT -- both re-encode |
A spec that says "log the raw response" is asking for byte fidelity, and no text type provides it. JSONB reparses: it drops insignificant whitespace, sorts object keys, keeps only the last of duplicate keys, and rewrites numbers out of exponent notation (1e0 -> 1; trailing zeros in 1.00 do survive, so "all numeric forms collapse" overstates it). A non-JSON body cannot be stored at all and usually lands as NULL. TEXT rejects a NUL byte and any sequence invalid in the database encoding, so a binary or mis-encoded body errors instead of storing. Persist the bytes in BYTEA with the content type beside them, and add a parsed JSONB column separately when queries need one -- reading the column type as proof the body is kept is the review error.
Schema Rules
- Every FK column gets an index (PG does NOT auto-create these)
NOT NULLon every column unless NULL has business meaningCHECKconstraints for domain rules at DB levelEXCLUDEconstraints for range overlaps:EXCLUDE USING gist (room WITH =, during WITH &&)- Default
created_at TIMESTAMPTZ NOT NULL DEFAULT now() - Separate
updated_atwith trigger, never trust app layer alone. Gate it withWHEN (OLD.* IS DISTINCT FROM NEW.*)so a no-op write neither fires the function nor bumps the timestamp -- onBEFORE UPDATEthe row image is built before the trigger runs, so the comparison sees the caller's row, not the one the trigger is about to stamp. - Use
BIGINTPKs -- cheaper JOINs than UUID, better index locality - Safe migrations:
CREATE INDEX CONCURRENTLY, add columns with a non-volatileDEFAULT(instant add). NeverALTER TYPEon large tables in-place. - A
DEFAULTwhose expression isVOLATILErewrites the entire table underACCESS EXCLUSIVE; onlyIMMUTABLE/STABLEdefaults get the metadata-only fast path. Check before shipping the migration:SELECT provolatile FROM pg_proc WHERE proname = 'gen_random_uuid';--vis volatile,s/iare not. SoDEFAULT 7andDEFAULT now()are instant,DEFAULT gen_random_uuid()is a full rewrite; add the column nullable, backfill in batches, then set the default. NULLS NOT DISTINCTon unique indexes (PG15+) -- treats NULLs as equal for uniqueness- A
UNIQUEconstraint proves at most one row per key, never exactly one. The lower bound has to come from elsewhere -- aNOT NULLFK from the covered side, aCHECK, or a seeding invariant -- so any docblock, MR description, or review conclusion of the form "the index is unique, therefore every X has exactly one Y" is unsound until that other source is named. The tell is the word exactly, or a downstream promise phrased as a universal. One query settles it: enumerate the domain and count the members with zero rows. - Under
NULLS NOT DISTINCT, a pre-flight duplicate check written with SQL=misses NULL/NULL collisions -- the index rejects the second row, butNULL = NULLevaluates to NULL (not true), so a self-join orWHERE a.col = b.colprobe silently skips exactly the pairs the index will reject. Write the probe withIS NOT DISTINCT FROMso NULL/NULL compares as equal. ORDER BY col DESCputs NULLs FIRST (ASC puts them last), so a "keep the newest row" dedup writtenORDER BY updated_at DESCpicks the row whose timestamp is NULL. ORMtimestamps()helpers typically createcreated_at/updated_atas nullable, so the exposure is routine rather than exotic. Pin the order (ORDER BY updated_at DESC NULLS LAST, id DESC) or make the columnNOT NULL. MySQL's DESC default is the opposite (NULLS LAST), so a query ported between the two silently changes which row survives.- Revoke default public schema access:
REVOKE ALL ON SCHEMA public FROM public - Derive every attribute at its own grain. A property of the parent -- a session, a day, an order -- computed from one child row lands on every child and is legitimately partial for most of them, so the aggregate disagrees with itself depending on which child is read. Put parent-scoped facts in a table keyed at the parent grain, populate them from the child the parent designates, and prefer a boundary observation (the last event's timestamp) over a count threshold.
What ships with it
5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- today First seen · 267 lines · 49 tokens per session scan A 598a833bebfc
ia-postgresql is a skill published in the GitHub repository iliaal/whetstone (33 stars, last pushed yesterday), licensed MIT. It adds 49 tokens to every session and 5,945 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-07.
Other skills, from other repositories
ecto-patterns
Ecto patterns — schemas, changesets, queries, migrations, Multi, associations, preloads, upserts. Use when editing Repo calls, Ecto.Query, or schema fields. Skip for Ash.
cloudflare-hyperdrive
Cloudflare Hyperdrive for Workers-to-database connections with pooling and caching. Use for PostgreSQL/MySQL, Drizzle/Prisma, or encountering pool errors, TLS issues, connection refused.
ecto-constraint-debug
Debug Ecto constraint violations - trace triggers, check migrations, find duplicate data. Use when seeing uniqueconstraint, foreignkeyconstraint, or checkconstraint errors.
database-expert
Advanced database design and administration for PostgreSQL, MongoDB, and Redis. Use when designing schemas, optimizing queries, managing database performance, or implementing data patterns.
multitenant
Architecture multitenant avec approche tiered (Shared/Dedicated Schema/DB), RBAC/ABAC, field-level encryption. Use when working with multitenant applications, tenant isolation, data segregation.
postgresql
PostgreSQL schema design, query optimization, indexing, and administration. Use when working with PostgreSQL, JSONB, partitioning, RLS, CTEs, window functions, or EXPLAIN ANALYZE.