postgresql-review

postgresql-review is a skill for Claude Code, Codex from navikt/copilot. It costs 21 tokens per session (2,070 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/github.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/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-review

Your own site · 80×15
<a href="https://agentmods.dev/skills/navikt/copilot/postgresql-review"><img src="https://agentmods.dev/badge/skills/navikt/copilot/postgresql-review.svg" alt="Reviewed on agentmods" width="80" 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 2,070 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.00021 $0.02070
Opus 5.5 $0.00008 $0.00828
Sonnet 5.5 $0.00004 $0.00414
Haiku 4.5 $0.00002 $0.00207

Measured 1mo ago against content hash 17bc0df37d14, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-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 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-review/SKILL.md · 242 lines

How it starts

The opening of the file, as written. The whole thing — 242 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 · 242 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. 1mo ago Changed · +25 lines 17bc0df37d14
  2. 1mo 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 (56 stars, last pushed today), licensed MIT. It adds 21 tokens to every session and 2,070 once invoked, about $0.0001 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-30.

Related

Other skills, from other repositories

loom-sql-optimization

Analyzes and optimizes SQL queries for performance.

cosmix/loom · 16 tokens

aws-rds-spring-boot-integration

Provides patterns to configure AWS RDS (Aurora, MySQL, PostgreSQL) with Spring Boot applications. Configures HikariCP connection pools, implements read/write splitting, sets up IAM database authentication, enables SSL connections, and integrates with AWS Secrets Manager. Use when setting up RDS connections in Spring…

giuseppe-trisciuoglio/developer-kit · 83 tokens

postgres

Execute queries on the Postgres database. Use this skill DIRECTLY whenever the user asks anything about database contents, counts, or data — do NOT read compose.yml or SQL migration files first.

CodelyTV/agentic_programming-course · 40 tokens

database-architecture

MANDATORY when designing schemas, writing migrations, creating indexes, or making architectural database decisions - enforces PostgreSQL 18 best practices including AIO, UUIDv7, temporal constraints, and modern indexing strategies.

troykelly/claude-skills · 45 tokens

postgis

MANDATORY when working with geographic data, spatial queries, geometry operations, or location-based features - enforces PostGIS 3.6.1 best practices including STCoverageClean, SFCGAL 3D functions, and bigint topology.

troykelly/claude-skills · 52 tokens

timescaledb

MANDATORY when working with time-series data, hypertables, continuous aggregates, or compression - enforces TimescaleDB 2.24.0 best practices including lightning-fast recompression, UUIDv7 continuous aggregates, and Direct Compress.

troykelly/claude-skills · 50 tokens