Agent skill
querying-postgresql-database
Connects to PostgreSQL databases to execute SQL queries and explore schema. Use when the user asks to query a database, list tables, describe table structure, or perform any database operations.
Install this agent skill to your Project
npx add-skill https://github.com/binome-dev/humcp/tree/main/src/tools/database
SKILL.md
PostgreSQL Database Tools
Tools for connecting to and querying PostgreSQL databases using SQLAlchemy async.
Setup
Set the DATABASE_URL environment variable:
DATABASE_URL=postgresql://user:password@localhost:5432/mydb
Execute SQL Queries
# SELECT query - returns all matching rows
result = await execute_query("SELECT * FROM users")
# Returns: {"success": True, "data": {"rows": [...], "row_count": N}}
# NOTE: Do NOT add LIMIT unless the user explicitly asks to limit results
# INSERT/UPDATE/DELETE - returns status
result = await execute_query("INSERT INTO users (name) VALUES ('Alice')")
# Returns: {"success": True, "data": {"status": "INSERT 0 1", "message": "..."}}
# Complex queries with CTEs
result = await execute_query("""
WITH active_users AS (
SELECT * FROM users WHERE status = 'active'
)
SELECT * FROM active_users WHERE created_at > '2024-01-01'
""")
List Tables
# List tables in public schema (default)
result = await list_tables()
# Returns: {"success": True, "data": {"schema": "public", "tables": ["users", "orders"], "count": 2}}
# List tables in specific schema
result = await list_tables(schema="analytics")
Describe Table Structure
result = await describe_table("users")
# Returns column definitions:
# {
# "success": True,
# "data": {
# "schema": "public",
# "table": "users",
# "columns": [
# {"name": "id", "type": "integer", "nullable": False, ...},
# {"name": "email", "type": "character varying", "nullable": False, ...}
# ],
# "column_count": 2
# }
# }
# Describe table in specific schema
result = await describe_table("events", schema="analytics")
Error Handling
All tools return {"success": False, "error": "..."} on failure:
- Missing DATABASE_URL environment variable
- Connection failures
- SQL syntax errors
- Permission denied
- Table not found
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
llm
Generate text, call tools, and get structured JSON output using LLM providers (Claude, OpenAI, Gemini, Ollama). Use when the user needs to call an LLM API for text generation, function calling, or structured data extraction.
calendar-tools
Manages calendar bookings and video conferencing. Use when the user needs to check availability, create bookings on Cal.com, or schedule and manage Zoom meetings.
http-api-client
Make HTTP requests to any URL or API endpoint. Use when the user needs to call a REST API, fetch data from a URL, send webhooks, or test HTTP endpoints. Supports GET, POST, PUT, PATCH, DELETE methods with custom headers and JSON body.
processing-data
Processes CSV files and pandas DataFrames. Use when working with CSV files, tabular data, spreadsheets, or when the user asks to query, analyze, or manipulate structured data.
persistent-memory
Store, search, and retrieve persistent memories and conversation history using Mem0 or Zep. Use when the user needs to remember facts, maintain context across sessions, or manage conversational memory.
storage
Use these tools for S3-compatible object storage operations with MinIO
Didn't find tool you were looking for?