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/ai-skills --skill postgresqlgit clone --depth 1 https://github.com/iliaal/ai-skillsWrote 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/ai-skills/postgresql)<a href="https://agentmods.dev/skills/iliaal/ai-skills/postgresql"><img src="https://agentmods.dev/badge/skills/iliaal/ai-skills/postgresql.svg" alt="Measured on agentmods" height="20"></a>- NVIDIA SkillSpector pass
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.00048 | $0.04321 |
| Opus 5 | $0.00024 | $0.02160 |
| Sonnet 5 | $0.00010 | $0.00864 |
| Haiku 4.5 | $0.00005 | $0.00432 |
Grade A, and why
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 — 250 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 |
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- 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. - Revoke default public schema access:
REVOKE ALL ON SCHEMA public FROM public
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 Changed · +2 lines c619d44cdec8
- 8d ago First seen · 248 lines · 48 tokens per session scan A 28cc317b68f0
postgresql is a skill published in the GitHub repository iliaal/ai-skills (41 stars, last pushed yesterday), licensed MIT. It adds 48 tokens to every session and 4,321 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-08-30.
Other skills, from other repositories
postgresql-table-design
Design a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features.
alloydb-basics
Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB Model Context Protocol (MCP) tools for automated database operations. Use when creating, configuring, or administering AlloyDB databases. Do NOT use for general PostgreSQL instances (e.g. Cloud SQL) or other GCP databases.
cloud-sql-basics
This file generates or explains Cloud SQL resources. Use this file when the user asks to create a Cloud SQL instance or database for MySQL, PostgreSQL, or SQL Server. Cloud SQL manages third-party MySQL, PostgreSQL, and SQL Server instances as resources in Cloud SQL. For example, when Cloud SQL creates an open-source…
supabase
Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies…
supabase-postgres-best-practices
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the…
sql-optimizer
Analyzes SQL queries for missing indexes, N+1 patterns, suboptimal joins, and full table scans. Interprets EXPLAIN, detects anti-patterns, rewrites queries. Triggers on: "optimize this query", "slow query", "add indexes", "explain plan", "N+1 query", "why is this query slow".