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 agentmods add skills/ericrisco/rsc-harness/postgresdbnpx skills add ericrisco/rsc-harness --skill postgresdbgit clone --depth 1 https://github.com/ericrisco/rsc-harnessWrote 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/ericrisco/rsc-harness/postgresdb)<a href="https://agentmods.dev/skills/ericrisco/rsc-harness/postgresdb"><img src="https://agentmods.dev/badge/skills/ericrisco/rsc-harness/postgresdb.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 | $0.00091 | $0.04619 |
| Opus 5 | $0.00046 | $0.02309 |
| Sonnet 5 | $0.00018 | $0.00924 |
| Haiku 4.5 | $0.00009 | $0.00462 |
Grade A, and why
postgresdb 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 yesterday.
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 — 355 lines — stays where its author put it; the contents beside it link to each section on GitHub.
PostgreSQL — schema, indexing, queries, ops
Engine-level PostgreSQL 16 guidance: design correct schemas, pick the right index, read EXPLAIN and fix slow SQL, run zero-downtime migrations, and operate/secure the database. Tooling-agnostic; every example is runnable.
New, non-trivial feature with no approved spec + plan under 02-DOCS/wiki/sdd/? Hand off to
specify before writing feature code (method: sdd); build
straight from here only for a genuinely one-line, low-risk change.
Deep dives: schema-and-indexing (types, constraints, every index kind, bloat) · query-optimization (EXPLAIN, joins, concurrency, JSONB/FTS/pgvector) · migrations (zero-downtime DDL, per-ORM) · operations-and-security (roles, RLS, pooling, vacuum, partitioning, backups).
Not this skill. ORM-API ergonomics (Prisma updateMany count trap, SQLAlchemy session lifecycle)
and per-runner migration wiring → that tool's own docs; this skill owns the SQL the ORM emits and
the engine behavior underneath. Other engines → mysql,
sqlite-turso, clickhouse-analytics
(different MVCC, locking, planner). App-layer caching / Redis / Kafka as products are out — only
Postgres-as-queue via SKIP LOCKED is in scope. Cloud-vendor console clicks →
deployment; we give the SQL and params, not the RDS/Cloud SQL UI path.
Decision rules
Fast lookups; runnable DDL lives in the references.
Pick the column type
| Use case | Correct type | Avoid | Why |
|---|---|---|---|
| Surrogate PK (internal) | bigint GENERATED ALWAYS AS IDENTITY |
serial, int |
identity is SQL-standard, no sequence-ownership gotchas; bigint avoids 2.1B overflow |
| Surrogate PK (public/distributed) | uuid v7 |
uuid v4 |
v7 is time-ordered → less B-tree fragmentation than random v4 |
| Natural text id (slug, sku) | text + UNIQUE + CHECK |
varchar(n) |
length via CHECK; no rewrite to widen later |
| Money / exact decimal | numeric(19,4) |
float8, money |
binary floats drift; money has locale issues |
| Timestamp (event) | timestamptz |
timestamp |
stores a UTC instant; naive timestamp loses zone |
| Duration | interval |
int seconds | self-documenting, arithmetic-safe |
| Small closed set, stable | enum |
text w/o CHECK |
type safety; but see lookup-table note |
| Evolving set, joinable | lookup table + FK | enum |
ALTER TYPE ... ADD VALUE is awkward; FK gives joins + soft-retire |
| Flag | boolean |
int, varchar |
three-valued NULL still possible — add NOT NULL DEFAULT |
| Tags (read-mostly) | text[] + GIN |
comma string | array ops + GIN containment |
| Tags (relational) | join table | text[] |
when you need FK integrity / per-tag rows |
| Semi-structured | jsonb |
json, text |
binary, indexable, dedup keys; promote hot keys to columns |
| IP / CIDR | inet / cidr |
text |
validation + operators |
| Time range (booking) | tstzrange + GiST |
two columns | && overlap + exclusion constraint |
What ships with it
7 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.
- yesterday First seen · 355 lines · 91 tokens per session scan A 658617169f2b
postgresdb is a skill published in the GitHub repository ericrisco/rsc-harness (64 stars, last pushed 2d ago), licensed MIT. It adds 91 tokens to every session and 4,619 once invoked, about $0.0005 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-03.
Other skills, from other repositories
moai-platform-database-cloud
Cloud database platform specialist covering Neon (serverless PostgreSQL), Supabase (PostgreSQL 16 with real-time), and Firebase Firestore (NoSQL with offline sync). Use when choosing or setting up cloud databases.
database-patterns
Database design and migration patterns for Alembic migrations, schema design (SQL/NoSQL), and database versioning. Use when creating migrations, designing schemas, normalizing data, managing database versions, or handling schema drift.
postgres-migrations
Apply schema changes to a live PostgreSQL database without taking downtime or locking out writers.
dev-supabase
Backend development with Supabase. Trigger when the user wants to configure auth, the database, or Supabase storage.
ops-database
Database schema design. Trigger when the user wants to create tables, migrations, or optimize queries.
database-migrations
Use this skill when modifying database schemas or running migrations. It defines safe patterns for SQLModel/Alembic.