Postgres Query Expert

A comprehensive guide for interacting with PostgreSQL 16 databases. Use this skill for constructing standard and advanced SQL queries, optimizing performance, debugging errors, managing schema objects, and introspecting database structure.

59 stars 10 forksDatabases

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add ratacat/claude-skills --skill postgres-query-expert
Manual install
git clone --depth 1 https://github.com/ratacat/claude-skills.git /tmp/claude-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-skills/skills/postgres-query-expert ~/.claude/skills/postgres-query-expert

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# PostgreSQL Query Expert

This skill is a definitive reference for PostgreSQL 16, covering query construction, optimization, schema management, and system introspection.

## Instructions

### 1. General Query Standards

- **Syntax**: Adhere to ANSI SQL standards, but prefer PostgreSQL extensions (e.g., `DISTINCT ON`, `RETURNING`, `LATERAL`, `FILTER` clauses) when they provide cleaner logic or better performance.
- **Identifiers**: Use `snake_case` for all identifiers. Only quote identifiers (`"MyTable"`) if absolutely necessary; prefer lowercase unquoted names.
- **Safety**:
  - **Parameterization**: Always use parameters (`$1`, `$2`, …) for literal values. Never inject user input directly.
  - **Timeouts**: For exploratory queries on large databases, prepend `SET LOCAL statement_timeout = '30s';`.
  - **Transactions**: Use explicit `BEGIN` and `COMMIT` blocks for multi-step operations.

### 2. Performance & Optimization

- **Explain plans**: Use `EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS)` to diagnose bottlenecks.
- **Red flags**: `Seq Scan` on large tables, high `Buffers: shared hit` (RAM usage), or `Disk: read` (I/O).
- **Indexing**: Recommend specific index types based on usage:
  - **B-tree**: Standard equality/range (`=`, `<`, `>`) queries.
  - **GIN**: For composite types like `JSONB` (`@>`) or arrays (`&&`), and full-text search.
  - **GiST**: For geometric data and ranges.
Read the full skill on GitHub

Details

Skill name
postgres-query-expert
Path
skills/postgres-query-expert/SKILL.md
Repo updated
11 February 2026

FAQ

What does the Postgres Query Expert skill do?

A comprehensive guide for interacting with PostgreSQL 16 databases. Use this skill for constructing standard and advanced SQL queries, optimizing performance, debugging errors, managing schema objects, and introspecting database structure.

How do I install the Postgres Query Expert skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add ratacat/claude-skills --skill postgres-query-expert. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Postgres Query Expert popular?

It lives in ratacat/claude-skills, which has 59 GitHub stars and 10 forks.

Related skills

Skill Creator

59

ratacat/claude-skills

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Codex's capabilities with specialized knowledge, workflows, or tool integrations.

Skill & Plugin Authoring10

Skill Installer

59

ratacat/claude-skills

Install Codex skills into $CODEX_HOME/skills from a curated list or a GitHub repo path. Use when a user asks to list installable skills, install a curated skill, or install a skill from another repo (including private repos).

Software Development10

Agent Browser

59

ratacat/claude-skills

Browser automation using Vercel's agent-browser CLI. Use when you need to interact with web pages, fill forms, take screenshots, or scrape data. Alternative to Playwright MCP - uses Bash commands with ref-based element selection. Triggers on "browse website", "fill form", "click button", "take screenshot", "scrape page", "web automation".

AI, LLMs & Agents10

Receipt Tracker Setup

46

zocomputer/skills

Automatically scans receipts you drop in a folder, extracts the details, and saves them to a searchable database

Databases56

Postgres Patterns

32

joneqian/claude-skills-suite

PostgreSQL database patterns for query optimization, schema design, indexing, and security. Based on Supabase best practices.

Databases

Database Design Expert

48

martinholovsky/claude-skills-generator

Expert in database schema design with focus on normalization, indexing strategies, FTS optimization, and performance-oriented architecture for desktop applications

Databases

Browse the most popular Claude skills, all databases skills, or write your own with the skills generator.