postgresql-review

postgresql-review is a skill for Claude Code, Codex from navikt/copilot. It costs 21 tokens per session (1,668 once invoked), scanned A, original, MIT.

A review guide for PostgreSQL, a relational database. It helps examine SQL queries, table designs, indexes, JSON data, and common performance problems.

In plain words
What is it for?
Use it to analyse query plans with EXPLAIN, identify missing indexes, improve joins and sorting, update database statistics, and review JSONB usage. An index is a database structure that can make lookups faster.
Why use it?
It helps explain slow queries and avoid database designs that become difficult to maintain or costly as data grows.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it to analyse query plans with EXPLAIN, identify missing indexes, improve joins and sorting, update database statistics, and review JSONB usage. An index is a database structure that can make lookups faster.

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

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/navikt/copilot/postgresql-review.svg)](https://agentmods.dev/skills/navikt/copilot/postgresql-review)
Your own site
<a href="https://agentmods.dev/skills/navikt/copilot/postgresql-review"><img src="https://agentmods.dev/badge/skills/navikt/copilot/postgresql-review.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,668 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.00021 $0.01668
Opus 5 $0.00010 $0.00834
Sonnet 5 $0.00004 $0.00334
Haiku 4.5 $0.00002 $0.00167

Measured 7d ago against content hash fcd00261cd89, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

postgresql-review 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 7d 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-review/SKILL.md · 217 lines

How it starts

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

PostgreSQL Review Skill

Review and optimize PostgreSQL queries, schemas, and patterns for Nav applications. Covers EXPLAIN analysis, index strategies, JSONB patterns, and common anti-patterns.

Query Analysis

Run EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) to analyze queries:

EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
SELECT * FROM vedtak
WHERE bruker_id = '12345678901'
  AND status = 'aktiv'
ORDER BY opprettet_dato DESC
LIMIT 10;

Red Flags in EXPLAIN Output

Sign Problem Solution
Seq Scan on large table Missing index CREATE INDEX
Sort with external merge Not enough work_mem Increase work_mem or add index with correct sort order
Nested Loop with high rows Cartesian product / missing join index Add index on join column
Hash Join with Batches > 1 work_mem too low Increase work_mem for the session
Large difference between estimated and actual rows Outdated statistics ANALYZE tablename;

Index Strategies

-- Simple index for lookups
CREATE INDEX idx_vedtak_bruker_id ON vedtak(bruker_id);

-- Composite index — columns in order of selectivity
CREATE INDEX idx_vedtak_bruker_status ON vedtak(bruker_id, status);

-- Partial index — only relevant rows
CREATE INDEX idx_vedtak_aktive ON vedtak(bruker_id)
WHERE status = 'aktiv';

-- Covering index — avoids table lookup
CREATE INDEX idx_vedtak_covering ON vedtak(bruker_id, status)
INCLUDE (opprettet_dato, belop);

-- Concurrent — no table locking (requires outside transaction)
CREATE INDEX CONCURRENTLY idx_vedtak_dato ON vedtak(opprettet_dato);

When to Use What?

Scenario Index Type
WHERE a = x B-tree on a
WHERE a = x AND b = y Composite (a, b)
WHERE a = x AND status = 'aktiv' Partial index WHERE status = 'aktiv'
WHERE a LIKE 'prefix%' B-tree (prefix only)
WHERE a @> '{"key": "val"}' GIN on JSONB
Full-text search GIN with to_tsvector
Geography GiST

Read the full file on GitHub · 217 lines

Files

What ships with it

1 file 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. 7d ago First seen · 217 lines · 21 tokens per session scan A fcd00261cd89

Subscribe to this mod's changes

postgresql-review is a skill published in the GitHub repository navikt/copilot (54 stars, last pushed today), licensed MIT. It adds 21 tokens to every session and 1,668 once invoked, about $0.0001 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.