postgresql-psql

Execute PostgreSQL psql commands for connections, queries, and administration.

3|1|Updated Oct 29, 2025
One-click install
npx skills add https://github.com/huydepzai121/skill --skill postgresql-psql-huydepzai121
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgresql-psql
Source: https://github.com/huydepzai121/skill/tree/main/.claude/skills/postgresql-psql
Command: npx skills add https://github.com/huydepzai121/skill --skill postgresql-psql-huydepzai121

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a comprehensive reference for PostgreSQL's psql command-line client, eliminating the need to sift through extensive documentation. It streamlines database administration, development, and troubleshooting by offering instant access to commands, best practices, and real-world examples.

Core Features & Use Cases

  • Comprehensive psql Reference: Access 70+ meta-commands, 25+ command-line options, and advanced SQL features.
  • Automated Database Tasks: Leverage scripting examples for health checks, maintenance, and data import/export.
  • Performance & Security: Get guidance on query analysis, optimization, user management, and SSL/TLS connections.
  • Use Case: Quickly find the command to export a table to CSV, troubleshoot a slow query, or set up a secure database connection without leaving your terminal.

Quick Start

Using the postgresql-psql skill, show me how to connect to a PostgreSQL database named 'production_db' as user 'admin' with a password prompt.

Frequently Asked Questions about postgresql-psql

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

FAQPage Schema
How do I connect to a PostgreSQL database using psql with SSL/SSH security?

psql supports SSL/TLS connections via command-line options like --ssl-mode and --cert. For SSH tunneling, establish the tunnel first, then connect psql to localhost on the forwarded port. The Skill covers both secure connection patterns for production environments.

How do I export PostgreSQL tables to CSV or other formats?

psql's \copy meta-command exports query results to CSV, JSON, or other formats. Use \copy (table_name) to (file.csv) with csv option, or pipe query output to external tools. The Skill provides scripting examples for automated import/export workflows.

What are the essential psql meta-commands for database administration?

psql includes 70+ meta-commands for listing databases, schemas, users, and permissions (\l, \dn, \du); managing roles and grants; and inspecting query plans. The Skill delivers a comprehensive reference covering commands for backups, health checks, and schema management.

How do I troubleshoot slow PostgreSQL queries with psql?

Use EXPLAIN and EXPLAIN ANALYZE to inspect query plans and identify bottlenecks. psql's timing options (\timing) measure execution, and the Skill includes performance analysis guidance for query optimization without external tools.

Can I automate PostgreSQL maintenance tasks like backups with psql scripts?

Yes. psql executes SQL scripts and shell commands via -f flag and \! meta-command. The Skill covers scripting patterns for health checks, scheduled maintenance, and transactional control in automation pipelines.

Does psql work for both development and production database administration?

psql serves development, staging, and production environments. The Skill addresses security (SSL connections, user permissions), transactional control, and robust troubleshooting applicable across all deployment contexts.