Postgres Query

🌐Community
by civitai · vlatest · Repository

Helps with PostgreSQL, querying as part of working with databases and data persistence workflows.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add postgres-query npx -- -y @trustedskills/postgres-query
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "postgres-query": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/postgres-query"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

This skill allows an AI agent to execute ad-hoc PostgreSQL queries for testing, debugging, and performance analysis. It provides a way to interact with PostgreSQL databases, retrieve data, and analyze query execution plans. The tool is designed to be read-only by default, prioritizing safety and preventing accidental modifications to the database.

When to use it

  • Testing SQL queries before integrating them into applications.
  • Debugging issues related to database performance or data retrieval.
  • Analyzing query execution plans to identify potential optimizations (e.g., verifying index usage).
  • Comparing the performance of different SQL query approaches.
  • Running read-only reports against a PostgreSQL database.

Key capabilities

  • Executes PostgreSQL queries using a Node.js script (query.mjs).
  • Supports --explain flag to generate execution plans (EXPLAIN ANALYZE).
  • Offers --writable flag for write operations, requiring explicit user permission.
  • Provides --data-packet flag to use the DataPacket replica (read-only).
  • Allows setting a query timeout with --timeout.
  • Enables reading queries from files using --file.
  • Supports JSON output format with --json.
  • Suppresses verbose output with --quiet.

Example prompts

  • "Run the query 'SELECT id, username FROM "User" LIMIT 5'"
  • "Explain the execution plan for this query: SELECT * FROM "Model" WHERE id = 1"
  • "Execute the SQL query from file 'my-query.sql'"

Tips & gotchas

  • The skill is read-only by default, preventing accidental data modifications. Use --writable with caution and only after obtaining explicit user permission.
  • Be mindful of query timeouts; complex queries might require increasing the timeout using --timeout.
  • Review execution plans (using --explain) to identify potential performance bottlenecks and ensure proper index usage.

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 HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
civitai
Installs
42

🌐 Community

Passed automated security scans.