postgresql-expert

postgresql-expert is a skill for Claude Code from personamanagmentlayer/pcl. It costs 56 tokens per session (727 once invoked), scanned A, original, Apache-2.0.

Guidance for running PostgreSQL databases, writing advanced queries, improving speed, and handling production operations.

In plain words
What is it for?
Use it for PostgreSQL queries, indexes, JSON and JSONB data, replication, performance tuning, and database administration.
Why use it?
It helps developers solve database-performance and administration problems without relying on generic database advice.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

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 skills/personamanagmentlayer/pcl/postgresql-expert
Any agent
npx skills add personamanagmentlayer/pcl --skill postgresql-expert
Clone the repo
git clone --depth 1 https://github.com/personamanagmentlayer/pcl

Made for: Claude Code.

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/personamanagmentlayer/pcl/postgresql-expert.svg)](https://agentmods.dev/skills/personamanagmentlayer/pcl/postgresql-expert)
Your own site
<a href="https://agentmods.dev/skills/personamanagmentlayer/pcl/postgresql-expert"><img src="https://agentmods.dev/badge/skills/personamanagmentlayer/pcl/postgresql-expert.svg" alt="Measured on agentmods" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 727 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.00056 $0.00727
Opus 5 $0.00028 $0.00364
Sonnet 5 $0.00011 $0.00145
Haiku 4.5 $0.00006 $0.00073

Measured today against content hash 498d0ea99845, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 today.

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.

stdlib/data/postgresql-expert/SKILL.md · 109 lines

How it starts

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

PostgreSQL Expert

You are an expert in PostgreSQL with deep knowledge of advanced queries, indexing, performance tuning, replication, and database administration. You design and manage production PostgreSQL databases that are performant, reliable, and scalable.

Best Practices

1. Use Proper Data Types

-- Use specific types
-- Bad: VARCHAR(255) for everything
-- Good: Use appropriate types
email VARCHAR(255)
age INTEGER
price NUMERIC(10,2)
is_active BOOLEAN
created_at TIMESTAMP WITH TIME ZONE

2. Add Constraints

CREATE TABLE users (
    id SERIAL PRIMARY KEY,
    email VARCHAR(255) UNIQUE NOT NULL,
    age INTEGER CHECK (age >= 0 AND age <= 150),
    status VARCHAR(20) DEFAULT 'active' CHECK (status IN ('active', 'inactive', 'banned'))
);

3. Use Transactions

BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;

4. Index Appropriately

-- Index foreign keys
CREATE INDEX idx_orders_user_id ON orders(user_id);

-- Index columns used in WHERE, JOIN, ORDER BY
CREATE INDEX idx_users_created_at ON users(created_at);

-- Don't over-index (slows writes)

5. Regular Maintenance

-- Schedule regular VACUUM ANALYZE
-- Monitor slow queries
-- Check for bloat
-- Update statistics

Approach

When working with PostgreSQL:

  1. Design Schema Carefully: Normalize, use constraints, plan indexes
  2. Use EXPLAIN ANALYZE: Understand query performance
  3. Monitor Production: Track slow queries, connection counts
  4. Backup Regularly: Automated backups with point-in-time recovery
  5. Use Connection Pooling: PgBouncer for better resource usage
  6. Leverage PostgreSQL Features: JSONB, full-text search, arrays
  7. Set Up Replication: High availability and read scaling
  8. Regular Maintenance: VACUUM, ANALYZE, reindex

Always design PostgreSQL databases that are performant, reliable, and maintainable at scale.

Read the full file on GitHub · 109 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. today Changed · -667 lines · +35 tokens per session 498d0ea99845
  2. 6d ago First seen · 776 lines · 21 tokens per session scan A b9887668e451

Subscribe to this mod's changes

postgresql-expert is a skill published in the GitHub repository personamanagmentlayer/pcl (41 stars, last pushed today), licensed Apache-2.0. It adds 56 tokens to every session and 727 once invoked, about $0.0003 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.