Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

postgres

БесплатноБез исполняемых скриптовНе проверен

PostgreSQL CLI client (psql) for database operations running inside a Docker container

kubiyabotот kubiyabot★ 19 звёзд на GitHub

Об этом скилле

PostgreSQL Skill

Access PostgreSQL databases using the psql CLI client running inside a Docker container. Execute queries, manage databases, run scripts, export/import data, and perform database operations without installing PostgreSQL locally.

Overview

This skill provides the psql command-line client through a containerized runtime. Connect to any PostgreSQL database (local or remote), execute SQL commands, run migration scripts, and manage your databases - all while keeping your host system clean.

When to Use This Skill

Use this skill when you need to:

  • Connect to PostgreSQL databases without local installation
  • Execute SQL queries and commands
  • Run database migration scripts
  • Export and import data (CSV, SQL dumps)
  • List databases, tables, and schemas
  • Inspect table structures and relationships
  • Execute administrative tasks
  • Test database connections
  • Run ad-hoc queries during development

Prerequisites

Docker

The PostgreSQL client runs inside a Docker container:

# macOS (using Homebrew)
brew install --cask docker

# Linux (Ubuntu/Debian)
sudo apt-get update
sudo apt-get install docker.io
sudo systemctl start docker

PostgreSQL Server

You need access to a PostgreSQL server:

  • Local PostgreSQL instance
  • Remote database server
  • Cloud-hosted PostgreSQL (AWS RDS, Google Cloud SQL, Azure, etc.)
  • Docker PostgreSQL container

Configuration

Add to your .skill-engine.toml:

[skills.postgres]
source = "docker:postgres:16-alpine"
runtime = "docker"
description = "PostgreSQL CLI client"

[skills.postgres.docker]
image = "postgres:16-alpine"
entrypoint = "psql"
environment = ["PGPASSWORD=${PGPASSWORD:-}"]
network = "bridge"
memory = "256m"
rm = true

Configuration Explained

  • image: postgres:16-alpine - PostgreSQL 16.x Alpine image (~80MB)
  • entrypoint: psql - PostgreSQL interactive terminal
  • environment: Sets PGPASSWORD from host environment
  • network: bridge - Allows connections to databases (local and remote)
  • memory: 256m - Limits container to 256MB RAM
  • rm: true - Automatically removes container after execution

Usage

PostgreSQL skill uses pass-through syntax - all arguments after -- are passed directly to psql:

skill run postgres -- [psql arguments]

Connection Methods

Using Command-Line Arguments

# Basic connection
skill run postgres -- -h localhost -U postgres -d mydb

# With specific port
skill run postgres -- -h localhost -p 5432 -U myuser -d mydb

# Remote database
skill run postgres -- -h db.example.com -U admin -d production

Using Environment Variables

# Set connection details
export PGHOST=localhost
export PGPORT=5432
export PGUSER=postgres
export PGDATABASE=mydb
export PGPASSWORD=secret

# Connect with defaults
skill run postgres --

Using Connection URI

# PostgreSQL connection string
skill run postgres -- postgresql://user:password@host:5432/database

# With SSL
skill run postgres -- "postgresql://user:password@host:5432/database?sslmode=require"

Common Operations

Running Queries

# Execute single SQL command
skill run postgres -- -h localhost -U postgres -c "SELECT * FROM users;"

# Multiple commands
skill run postgres -- -h localhost -U postgres -c "SELECT count(*) FROM users; SELECT version();"

# Query with output formatting
skill run postgres -- -h localhost -U postgres -c "SELECT * FROM users;" -x  # Expanded display

Database Management

# List all databases
skill run postgres -- -h localhost -U postgres -l

# Create database
skill run postgres -- -h localhost -U postgres -c "CREATE DATABASE newdb;"

# Drop database
skill run postgres -- -h localhost -U postgres -c "DROP DATABASE olddb;"

# Connect to specific database
skill run postgres -- -h localhost -U postgres -d mydb

Table Operations

# List tables in current database
skill run postgres -- -h localhost -U postgres -d mydb -c "\dt"

# List tables with sizes
skill run postgres -- -h localhost -U postgres -d mydb -c "\dt+"

# Describe table structure
skill run postgres -- -h localhost -U postgres -d mydb -c "\d users"

# Show table constraints
skill run postgres -- -h localhost -U postgres -d mydb -c "\d+ users"

Schema Operations

# List schemas
skill run postgres -- -h localhost -U postgres -d mydb -c "\dn"

# List tables in specific schema
skill run postgres -- -h localhost -U postgres -d mydb -c "\dt myschema.*"

# Set search path
skill run postgres -- -h localhost -U postgres -d mydb -c "SET search_path TO myschema,public;"

Executing SQL Files

# Run SQL script
skill run postgres -- -h localhost -U postgres -d mydb -f migration.sql

# Run with error handling
skill run postgres -- -h localhost -U postgres -d mydb -f script.sql -v ON_ERROR_STOP=1

# Run multiple files
for file in migrations/*.sql; do
  skill run postgres -- -h localhost -U postgres -d mydb -f "$
Полный SKILL.md на GitHub

Установить postgres в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

README.mdmanifest.toml

FAQ

Что делает скилл postgres?

PostgreSQL CLI client (psql) for database operations running inside a Docker container

Как установить скилл postgres?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл postgres запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить postgres с