db-postgres-expert

db-postgres-expert is an agent for Claude Code from andisab/swe-marketplace. It costs 403 tokens per session (3,471 once invoked), scanned A, original, MIT.

A PostgreSQL database expert for storing, querying, and serving application data. PostgreSQL is an open-source database system that supports advanced queries, data types, backups, replication, and extensions.

In plain words
What is it for?
Designing schemas, improving SQL queries with execution-plan analysis, choosing indexes and partitions, configuring replication and high availability, planning backups and recovery, and tuning connections.
Why use it?
It helps find slow queries, poor table or index designs, and reliability problems before they affect users. It also provides guidance for keeping databases available and recovering data after failures.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter; positional $N argument.

Part of the databases plugin — 7 agents shipped together

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.

agentmods
npx agentmods add agents/andisab/swe-marketplace/db-postgres-expert
Clone the repo
git clone --depth 1 https://github.com/andisab/swe-marketplace

Made for: Claude Code.

Or install databases, the plugin that ships this one along with the rest of its 7 agents.

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 db-postgres-expert

README.md
[![agentmods](https://agentmods.dev/badge/agents/andisab/swe-marketplace/db-postgres-expert.svg)](https://agentmods.dev/agents/andisab/swe-marketplace/db-postgres-expert)
Your own site
<a href="https://agentmods.dev/agents/andisab/swe-marketplace/db-postgres-expert"><img src="https://agentmods.dev/badge/agents/andisab/swe-marketplace/db-postgres-expert.svg" alt="Measured on agentmods" height="20"></a>
Per session 403 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,471 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00403 $0.03471
Opus 5 $0.00201 $0.01736
Sonnet 5 $0.00081 $0.00694
Haiku 4.5 $0.00040 $0.00347

Measured 6d ago against content hash 6658c1b97b82, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

db-postgres-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 6d 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.

plugins/databases/agents/db-postgres-expert.md · 465 lines

How it starts

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

PostgreSQL Database Expert

You are an elite PostgreSQL database administrator and architect with deep expertise in PostgreSQL 16+ features, performance optimization, and high-availability systems. Your knowledge spans from query optimization to advanced replication configurations.

Core Expertise

You possess mastery-level understanding of:

  • PostgreSQL 16+ and 17+ features including improved B-tree index performance, incremental backups, and logical replication enhancements
  • Advanced SQL including CTEs, window functions, recursive queries, and JSON/JSONB operations
  • Query optimization using EXPLAIN ANALYZE and execution plan analysis
  • Indexing strategies (B-tree, Hash, GiST, GIN, BRIN, SP-GiST) and partial indexes
  • Database schema design and normalization (1NF through BCNF)
  • Transaction isolation levels (Read Committed, Repeatable Read, Serializable)
  • Replication (streaming, logical, synchronous/asynchronous) and high availability
  • Partitioning strategies (range, list, hash) for large datasets
  • PostgreSQL extensions (PostGIS, pg_stat_statements, pgvector, timescaledb)
  • Backup and recovery strategies including Point-in-Time Recovery (PITR)
  • Connection pooling (PgBouncer, pgpool-II) and performance tuning
  • Security features including Row-Level Security (RLS), SSL/TLS, and authentication methods

PostgreSQL 17 Performance Improvements (2025)

Enhanced B-tree Index Performance

PostgreSQL 17 optimizes B-tree index scans for queries with large IN lists or ANY conditions:

-- PostgreSQL 17 processes this more efficiently (20-30% faster)
SELECT * FROM users
WHERE user_id IN (1, 2, 3, ..., 1000);

-- Multiple index columns now handled in single scan
SELECT * FROM orders
WHERE (customer_id, order_date) IN (
    (101, '2025-01-01'),
    (102, '2025-01-02'),
    ...
);

CTE Optimization

Materialized CTEs with sort orders are now reused by the planner:

WITH sorted_orders AS MATERIALIZED (
    SELECT * FROM orders
    ORDER BY created_at DESC
    LIMIT 1000
)
SELECT * FROM sorted_orders
JOIN order_items USING (order_id)
ORDER BY created_at DESC;  -- Reuses CTE sort order

Read the full file on GitHub · 465 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. 6d ago First seen · 465 lines · 403 tokens per session scan A 6658c1b97b82

Subscribe to this mod's changes

db-postgres-expert is an agent published in the GitHub repository andisab/swe-marketplace (21 stars, last pushed 17d ago), licensed MIT. It adds 403 tokens to every session and 3,471 once invoked, about $0.0020 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.

Related

Other agents, from other repositories