- Home
- Skills
- Data & Databases
- Postgres Database Assistant
Postgres Database Assistant
by moncef
Securely inspect PostgreSQL schemas, run read-only queries, and analyze execution plans via MCP.
Free
Postgres Database Assistant
Example session with this skill installed
List the tables in the public schema and show me the columns for the 'users' table.
- Read your context and instructions
- Compiled the postgres database assistant
I have retrieved the list of tables from the public schema and inspected the structure of the users table.
Database Inspection Results
Public Schema Tables
| Table Name | Estimated Rows | Type |
|---|---|---|
| users | 1250 | table |
| orders | 45000 | table |
| products | 320 | table |
| audit_logs | 890000 | table |
Table Definition: users
| Column | Data Type | Nullable | Default |
|---|---|---|---|
| id | uuid | NO | gen_random_uuid() |
| text | NO | NULL | |
| password_hash | text | NO | NULL |
| created_at | timestamp with time zone | NO | now() |
| is_active | boolean | YES | true |
Constraints & Indexes
- Primary Key:
users_pkey(id) - Foreign Keys: None
- Indexes:
idx_users_email(unique, btree),idx_users_created_at(btree)
Next steps
- Run a
run_queryto fetch specific user data, noting thatpassword_hashwill be automatically redacted. - Use
describe_tableon theorderstable to map the relationship between users and their purchases. - Check the execution plan for email lookups using
explain_query.
Connects securely to your tools. The creator never sees your data.
About this skill
Manually inspecting PostgreSQL schemas and debugging slow queries via CLI or GUI tools slows down the development loop. This skill enables AI agents to interface directly with your database, providing safe, read-only access to discover structures and verify data without manual context-switching.
What it does
- Schema discovery lists all tables and views within a specified schema including estimated row counts.
- Table inspection retrieves detailed column definitions, primary keys, foreign key relationships, and existing indexes.
- Safe query execution runs bounded
SELECTorWITHqueries with automatic redaction of sensitive columns like passwords or tokens. - Performance analysis generates PostgreSQL
EXPLAINandEXPLAIN ANALYZEplans within rolled-back transactions to diagnose bottlenecks. - Result management enforces row limits and payload caps to prevent memory exhaustion and accidental data dumps.
How it works
- Use
list_tablesto map out the available relations in the public or application-specific schemas. - Invoke
describe_tableto understand the exact column types and constraints before drafting a query. - Execute
run_querywith a SQL statement to retrieve data, monitoring thetruncatedflag for large result sets. - Pass problematic queries to
explain_queryto view JSON-formatted execution plans and optimizer costs.
Frameworks & tools
Built with Go using the Model Context Protocol (MCP) SDK and pgx/v5. It connects to any PostgreSQL instance via stdio transport using standard postgres:// connection strings.
Why this beats prompting it yourself
Writing SQL prompts by memory often leads to invalid column names or unoptimized joins. This skill provides the agent with real-time schema metadata, ensuring queries are syntactically correct and security-compliant by stripping mutating keywords and redacting PII automatically.
Use cases
- Generating accurate
JOINqueries by inspecting foreign key relationships in real-time. - Debugging production data issues using read-only, time-bounded queries.
- Optimizing slow application queries by analyzing
EXPLAINplans without leaving the editor. - Scaffolding API models or DTOs based on actual database table definitions.
Known limitations
Supports PostgreSQL only. Exclusively provides read-only access, blocking all DDL, DML, and session mutations. Does not support materialized views in discovery tools.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 7 days ago
- Free with an Agensi account
- Software
- Db MCP
Permissions
Reads DATABASE_URL (and optional DB_QUERY_TIMEOUT, DB_MAX_ROWS, DB_REDACT_COLUMNS, LOG_LEVEL) from environment variables and opens a TCP connection to the target PostgreSQL database via the db-mcp stdio MCP binary. All operations execute inside strict read-only PostgreSQL transactions with automatic rollbacks, SQL lexer validation, and sensitive-column redaction—no files are written or modified.
What's inside
Frequently Asked Questions
New in Data & Databases
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Data & Databases.