Postgresql Psql
Execute SQL queries directly against PostgreSQL databases using psql, retrieving data and results efficiently.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add postgresql-psql npx -- -y @trustedskills/postgresql-psql
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"postgresql-psql": {
"command": "npx",
"args": [
"-y",
"@trustedskills/postgresql-psql"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
This skill enables AI agents to execute SQL commands directly within a PostgreSQL database using the psql command-line interface. It allows agents to query data, modify schemas, and perform administrative tasks programmatically without manual intervention.
When to use it
- Data Extraction: Retrieve specific records or aggregate statistics for analysis when you need immediate access to live database contents.
- Schema Management: Create new tables, alter existing structures, or drop obsolete columns as part of an automated deployment pipeline.
- Routine Maintenance: Execute cleanup queries, update indexes, or run diagnostic checks to ensure database health and performance.
- Ad-hoc Analysis: Quickly test hypotheses against production data by running complex joins and filters on the fly.
Key capabilities
- Executes standard SQL statements (SELECT, INSERT, UPDATE, DELETE) via
psql. - Connects securely to PostgreSQL instances using provided credentials.
- Returns structured text output from query results for further processing.
- Supports batch command execution for multi-step database operations.
Example prompts
- "Connect to the staging database and show me all users who logged in last week."
- "Run a migration script to add a
last_logincolumn to theuserstable." - "Query the
orderstable to find total revenue by region for Q3."
Tips & gotchas
Ensure your AI agent has valid database credentials and network access before attempting connection. Complex queries with ambiguous joins may return unexpected results; always validate output against known data patterns.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.