postgres-idioms

postgres-idioms is a skill for Claude Code, Codex from irahardianto/awesome-agv. It costs 46 tokens per session (4,189 once invoked), scanned A, original, MIT.

A guide to PostgreSQL database practices, covering schemas, queries, indexes, connections, security, concurrency, and migrations.

In plain words
What is it for?
Use it when designing PostgreSQL tables, writing SQL, tuning queries, configuring connections, or applying row-level security.
Why use it?
It helps prevent slow queries, unsafe database access, and migration or concurrency problems.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument; installed under .agents/ (shared by several agents).

Good fit Use it when designing PostgreSQL tables, writing SQL, tuning queries, configuring connections, or applying row-level security.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/irahardianto/awesome-agv/postgres-idioms
Install

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.

Any agent
npx skills add irahardianto/awesome-agv --skill postgres-idioms
Clone the repo
git clone --depth 1 https://github.com/irahardianto/awesome-agv

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for postgres-idioms

README.md
[![agentmods](https://agentmods.dev/badge/skills/irahardianto/awesome-agv/postgres-idioms/github.svg)](https://agentmods.dev/skills/irahardianto/awesome-agv/postgres-idioms)
Your own site
<a href="https://agentmods.dev/skills/irahardianto/awesome-agv/postgres-idioms"><img src="https://agentmods.dev/badge/skills/irahardianto/awesome-agv/postgres-idioms/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for postgres-idioms

Your own site · 80×15
<a href="https://agentmods.dev/skills/irahardianto/awesome-agv/postgres-idioms"><img src="https://agentmods.dev/badge/skills/irahardianto/awesome-agv/postgres-idioms.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,189 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00046 $0.04189
Opus 5.5 $0.00018 $0.01676
Sonnet 5.5 $0.00009 $0.00838
Haiku 4.5 $0.00005 $0.00419

Measured 1mo ago against content hash a383377b8427, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

postgres-idioms 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 1mo ago.

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.

.agents/skills/postgres-idioms/SKILL.md · 549 lines

How it starts

The opening of the file, as written. The whole thing — 549 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PostgreSQL Idioms and Best Practices

PostgreSQL rewards set-based thinking, explicit joins, and query plan awareness. Idiomatic PostgreSQL = readable, performant, migration-safe, secure.

Scope: PostgreSQL-specific patterns. For database design principles (normalization, naming, migration strategy), see @.agents/rules/database-design-principles.md. For deep-dive references on individual topics, see references/ in this skill directory.

Priority Guide

Priority Category Impact
1 Query Performance & Indexing CRITICAL
2 Connection Management CRITICAL
3 Security & RLS CRITICAL
4 Schema Design HIGH
5 Concurrency & Locking MEDIUM-HIGH
6 Data Access Patterns MEDIUM
7 Monitoring & Diagnostics LOW-MEDIUM
8 Advanced Features LOW

1. Query Performance & Indexing (CRITICAL)

Always EXPLAIN Before Optimizing

EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) SELECT ...;

Red flags in query plans:

  • Seq Scan on large table → missing index
  • Rows Removed by Filter → poor selectivity or wrong index
  • read >> hit in Buffers → data not cached, cold query
  • Sort Method: external merge → work_mem too low
  • Nested Loop with high row count → consider Hash Join

Index Strategy

Choose the right index type:

Type Use When Operators
B-tree (default) General sorted data =, <, >, BETWEEN, IN, IS NULL
GIN JSONB, arrays, full-text search @>, ?, ?&, @@
GiST Geometric, range, nearest-neighbor &&, @>, <-> (KNN)
BRIN Large time-series, naturally ordered Range queries on ordered columns
Hash Equality-only (marginal B-tree improvement) =

Composite indexes — column order matters (leftmost prefix rule):

-- ✅ Equality columns first, range columns last
CREATE INDEX idx_orders_status_date ON orders (status, created_at);
-- Works: WHERE status = 'pending'
-- Works: WHERE status = 'pending' AND created_at > '2024-01-01'
-- FAILS: WHERE created_at > '2024-01-01' (alone — no leftmost match)

Read the full file on GitHub · 549 lines

Changes

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.

  1. 1mo ago First seen · 549 lines · 46 tokens per session scan A a383377b8427

Subscribe to this mod's changes

postgres-idioms is a skill published in the GitHub repository irahardianto/awesome-agv (156 stars, last pushed 13d ago), licensed MIT. It adds 46 tokens to every session and 4,189 once invoked, about $0.0002 per session on Opus 5.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.

Related

Other skills, from other repositories

database-postgresql

Apply PostgreSQL standards for migrations, indexing, transactions, and ORM boundaries. Use when editing entities, Prisma schema, migrations, RLS, or query-performance work for PostgreSQL.

HoangNguyen0403/agent-skills-standard · 40 tokens

postgres-database-migration

Use this skill for planning, testing, and safely executing PostgreSQL schema migrations — especially when working with production data or shared databases. Trigger when user asks to: Test a schema migration before applying it to production Add, remove, or rename columns safely on a live table Change a column's data…

timescale/pg-aiguide · 220 tokens

design-postgis-tables

Comprehensive PostGIS spatial table design reference covering geometry types, coordinate systems, spatial indexing, and performance patterns for location-based applications.

timescale/pg-aiguide · 31 tokens

setup-timescaledb-hypertables

Use this skill when creating database schemas or tables for Timescale, TimescaleDB, TigerData, or Tiger Cloud, especially for time-series, IoT, metrics, events, or log data. Use this to improve the performance of any insert-heavy table. Trigger when user asks to: Create or design SQL schemas/tables AND…

timescale/pg-aiguide · 219 tokens

timescaledb-hyperfunctions

Use this skill when writing analytical SQL over time-series data with the TimescaleDB Toolkit (timescaledbtoolkit extension) hyperfunctions: approximate percentiles, statistical summaries, time-weighted averages, counter/gauge rates, uptime/heartbeat tracking, state durations, OHLC candlesticks, approximate distinct…

timescale/pg-aiguide · 298 tokens

migrate-postgres-tables-to-hypertables

Use this skill to migrate identified PostgreSQL tables to Timescale/TimescaleDB hypertables with optimal configuration and validation. Trigger when user asks to: Migrate or convert PostgreSQL tables to hypertables Execute hypertable migration with minimal downtime Plan blue-green migration for large tables Validate…

timescale/pg-aiguide · 181 tokens