psql

Execute interactive SQL and inspect PostgreSQL backend processes locally.

Updated Jun 1, 2026
One-click install
npx skills add https://github.com/matejformanek/postgres-claude --skill psql-matejformanek
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: psql
Source: https://github.com/matejformanek/postgres-claude/tree/main/.claude/skills/psql
Command: npx skills add https://github.com/matejformanek/postgres-claude --skill psql-matejformanek

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill removes the friction of interacting with a local PostgreSQL development build, providing a structured way to perform backend introspection, query debugging, and performance analysis without the risk of affecting production environments.

Core Features & Use Cases

  • Interactive Introspection: Execute meta-commands like \d+, \df+, and \errverbose to inspect catalog structures, function sources, and backend error details.
  • Performance & Debugging: Use session-scoped GUCs and EXPLAIN (ANALYZE, BUFFERS) to force plan shapes and analyze memory context growth or lock contention.
  • Use Case: When investigating a suspected memory leak in a backend process, use this skill to monitor pg_backend_memory_contexts across iterations and capture PIDs for attachment to a debugger.

Quick Start

Use the psql skill to connect to the local development cluster and run an EXPLAIN ANALYZE query on the target table to inspect buffer usage.

Frequently Asked Questions about psql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug PostgreSQL backend memory leaks in a local development cluster?

Debug PostgreSQL backend memory leaks by querying pg_backend_memory_contexts across iterations within a local development cluster. This monitors memory context growth and captures PIDs for attachment to a debugger.

What's the best way to analyze PostgreSQL query performance using EXPLAIN ANALYZE?

Analyze PostgreSQL query performance using EXPLAIN (ANALYZE, BUFFERS) to inspect buffer usage and execution statistics. Session-scoped GUCs can force specific plan shapes for deeper tuning.

Can I inspect PostgreSQL catalog structures and function sources locally without affecting production?

Inspect PostgreSQL catalog structures and function sources locally using meta-commands like \d+ and \df+. This interactive introspection queries a local development cluster, keeping production environments unaffected.

Do I need trust authentication and Unix socket access to interact with a local PostgreSQL postmaster?

Yes, interactive SQL execution and backend introspection against a local PostgreSQL postmaster require a configured environment with Unix socket access and trust authentication enabled for direct connection.

Why does PostgreSQL backend introspection require a locally built development cluster?

Backend introspection requires a locally built development cluster to provide structured access to internal processes like memory context analysis and lock contention debugging without risking production stability.

How do I capture PostgreSQL backend error details after a failed query execution?

Capture PostgreSQL backend error details after failed query execution using the \errverbose meta-command. This retrieves verbose error information directly from the local interactive session.