postgresql-expert

postgresql-expert is a skill for Claude Code from iwritec0de/app-dev. It costs 119 tokens per session (1,292 once invoked), scanned A, original, MIT.

A guide for writing PostgreSQL database queries and configuration, including PostgreSQL’s specialised data types and performance tools. PostgreSQL is a database system used to store and query application data.

In plain words
What is it for?
Use it when writing queries, working with JSONB, arrays, common table expressions, window functions, extensions, or PostgreSQL configuration. It also covers query tuning and database maintenance after large data changes.
Why use it?
It helps avoid PostgreSQL-specific mistakes and choose suitable types, query patterns, and maintenance steps. It also gives guidance for investigating and improving slow queries.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the app-dev plugin — 17 skills, 11 commands, 4 agents, 3 hooks shipped together

Good fit Use it when writing queries, working with JSONB, arrays, common table expressions, window functions, extensions, or PostgreSQL configuration. It also covers query tuning and database maintenance after large data changes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/iwritec0de/app-dev/postgresql-expert
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 iwritec0de/app-dev --skill postgresql-expert
Clone the repo
git clone --depth 1 https://github.com/iwritec0de/app-dev

Made for: Claude Code.

Or install app-dev, the plugin that ships this one along with the rest of its 17 skills, 11 commands, 4 agents, 3 hooks.

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 postgresql-expert

README.md
[![agentmods](https://agentmods.dev/badge/skills/iwritec0de/app-dev/postgresql-expert/github.svg)](https://agentmods.dev/skills/iwritec0de/app-dev/postgresql-expert)
Your own site
<a href="https://agentmods.dev/skills/iwritec0de/app-dev/postgresql-expert"><img src="https://agentmods.dev/badge/skills/iwritec0de/app-dev/postgresql-expert/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 postgresql-expert

Your own site · 80×15
<a href="https://agentmods.dev/skills/iwritec0de/app-dev/postgresql-expert"><img src="https://agentmods.dev/badge/skills/iwritec0de/app-dev/postgresql-expert.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 119 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,292 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.
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.00119 $0.01292
Opus 5.5 $0.00048 $0.00517
Sonnet 5.5 $0.00024 $0.00258
Haiku 4.5 $0.00012 $0.00129

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

Security

Grade A, and why

postgresql-expert 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.

skills/postgresql-expert/SKILL.md · 115 lines

How it starts

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

PostgreSQL Expert Skill

You are a PostgreSQL expert specializing in PG-specific features, types, and tuning.

Critical Rules

  • Use JSONB not JSON — JSONB is binary, indexable, and queryable; JSON is just text storage
  • Use arrays for simple lists — prefer TEXT[] over junction tables for tags-like data
  • VACUUM ANALYZE after bulk ops — keep statistics and dead tuple counts current
  • Use pg_stat_statements — the single most important extension for query analysis
  • Prefer gen_random_uuid() — built-in since PG 13, no extension needed
  • CTEs are optimization fences in PG < 12 — use WITH ... AS MATERIALIZED/NOT MATERIALIZED in 12+
  • Use RETURNING — avoid separate SELECT after INSERT/UPDATE/DELETE

PG-Specific Types

Type Use Case Example
UUID Distributed-safe primary keys gen_random_uuid()
JSONB Flexible/schemaless data data->'key', data @> '{"a":1}'
TEXT[] Simple lists, tags ARRAY['a','b'], ANY(tags)
ENUM Fixed small sets CREATE TYPE status AS ENUM (...)
TSTZRANGE Time ranges [2024-01-01, 2024-12-31)
TSVECTOR Full-text search to_tsvector('english', body)
INET/CIDR IP addresses '192.168.1.0/24'::cidr

Advanced SQL

-- Recursive CTE: tree traversal
WITH RECURSIVE tree AS (
  SELECT id, name, parent_id, 0 AS depth FROM categories WHERE parent_id IS NULL
  UNION ALL
  SELECT c.id, c.name, c.parent_id, t.depth + 1 FROM categories c JOIN tree t ON c.parent_id = t.id
) SELECT * FROM tree;

-- Window function: running total
SELECT id, amount, SUM(amount) OVER (ORDER BY created_at) AS running_total FROM payments;

-- UPSERT with conflict handling
INSERT INTO settings (key, value) VALUES ('theme', 'dark')
ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, updated_at = NOW();

-- LATERAL join: top-N per group
SELECT u.*, recent.* FROM users u
CROSS JOIN LATERAL (
  SELECT * FROM orders WHERE user_id = u.id ORDER BY created_at DESC LIMIT 3
) recent;

Read the full file on GitHub · 115 lines

Files

What ships with it

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

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 · 115 lines · 119 tokens per session scan A 0238a7763e35

Subscribe to this mod's changes

postgresql-expert is a skill published in the GitHub repository iwritec0de/app-dev (3 stars, last pushed 6mo ago), licensed MIT. It adds 119 tokens to every session and 1,292 once invoked, about $0.0005 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-08-31.