PostgreSQL Queries
Execute safe, read-only SQL queries against PostgreSQL databases.
Install
npx skills add sanjay3290/ai-skills --skill postgresgit clone --depth 1 https://github.com/sanjay3290/ai-skills.git /tmp/ai-skills
mkdir -p ~/.claude/skills
cp -r /tmp/ai-skills/skills/postgres ~/.claude/skills/postgresPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
What this skill does
Execute safe read-only SQL queries against PostgreSQL databases. Analyze and explore your database with Claude.
Trigger phrases
Claude loads this skill automatically when you say things like:
How it works
- Connect to PostgreSQL
- Execute read-only queries
- Format and present results
When to use it
- When querying databases
- For data exploration
- When analyzing database content
From the SKILL.md
# PostgreSQL Read-Only Query Skill
Execute safe, read-only queries against configured PostgreSQL databases.
## Requirements
- Python 3.8+
- psycopg2-binary: `pip install -r requirements.txt`
## Setup
Create `connections.json` in the skill directory or `~/.config/claude/postgres-connections.json`.
**Security**: Set file permissions to `600` since it contains credentials:
```bash
chmod 600 connections.json
```
```json
{
"databases": [
{
"name": "production",
"description": "Main app database - users, orders, transactions",
"host": "db.example.com",
"port": 5432,
"database": "app_prod",
"user": "readonly_user",
"password": "your-password",
"sslmode": "require"
}
]
}
```
### Config Fields
| Field | Required | Description |
|-------|----------|-------------|
| name | Yes | Identifier for the database (case-insensitive) |
| description | Yes | What data this database contains (used for auto-selection) |
| host | Yes | Database hostname |
| port | No | Port number (default: 5432) |
| database | Yes | Database name |
| user | Yes | Username |
| password | Yes | Password |
| sslmode | No | SSL mode: disable, allow, prefer (default), require, verify-ca, verify-full |
## Usage
### List configured databases
```bash
python3 scripts/query.py --list
```
### Query a database
```bash
python3 scripts/query.py --db production --query "SELECT * FROM users LIMIT 10"
```
### List tablesDetails
- Skill name
postgres- Repository
- sanjay3290/ai-skills
- Path
skills/postgres/SKILL.md
FAQ
What does the PostgreSQL Queries skill do?
Execute safe read-only SQL queries against PostgreSQL databases. Analyze and explore your database with Claude.
How do I install the PostgreSQL Queries skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add sanjay3290/ai-skills --skill postgres. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Related skills
Azure Devops
sanjay3290/ai-skills
Manage Azure DevOps projects, work items, repos, PRs, pipelines, wikis, test plans, security alerts, variable groups, environments/approvals, branch policies, and attachments. Use when user asks to: manage sprints, create/update work items, list repos, create PRs, run pipelines, search code, manage wiki pages, check security alerts, manage variable groups, approve deployments, or configure branch policies. Covers 13 domains with 99 tools via REST API.
Deep Research
sanjay3290/ai-skills
Execute autonomous multi-step research using Google Gemini Deep Research Agent. Use for: market analysis, competitive landscaping, literature reviews, technical research, due diligence. Takes 2-10 minutes but produces detailed, cited reports. Costs $2-5 per task.
Elevenlabs
sanjay3290/ai-skills
Convert documents and text to audio using ElevenLabs text-to-speech. Use this skill when the user wants to create a podcast, narrate a document, read aloud text, generate audio from a file, or convert text to speech.
Netlify Database
netlify/context-and-tools
Zero-config Postgres for Netlify apps via @netlify/database — querying data from Functions/Edge Functions, writing schema migrations, setting up Drizzle ORM, local dev with netlify dev, database branches for deploy previews, and migrating an existing Postgres project onto Netlify. Use when adding a database, building a contact form or CRUD API, writing SQL migrations, wiring up Drizzle, running netlify database commands, testing with a local Postgres, or switching from Neon/Supabase/RDS to Netlify Database.
Mysql
sanjay3290/ai-skills
Execute read-only SQL queries against multiple MySQL databases. Use when: (1) querying MySQL databases, (2) exploring database schemas/tables, (3) running SELECT queries for data analysis, (4) checking database contents. Supports multiple database connections with descriptions for intelligent auto-selection. Blocks all write operations (INSERT, UPDATE, DELETE, DROP, etc.) for safety.
Alloydb Basics
google/skills
Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB Model Context Protocol (MCP) tools for automated database operations. Use when creating, configuring, or administering AlloyDB databases. Do NOT use for general PostgreSQL instances (e.g. Cloud SQL) or other GCP databases.
Browse the most popular Claude skills, all databases skills, or write your own with the skills generator.