postgres
Skill429 starsChanged 5 months agoApache-2.0View on GitHub
Execute read-only SQL queries against multiple PostgreSQL databases. Use when: (1) querying PostgreSQL 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.
- Installs packages
15 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- fworks-tech/agenthoodtheir own version, first seen Sep 28, 2026
- nahid-sparktales/agent-dispatchertheir own version, first seen Sep 21, 2026
- timescale/pg-aiguidetheir own version, first seen Sep 2, 2026
- chenwei791129/agent-skillsedited, first seen Aug 29, 2026
- LDKTC/Agent-P-FullStacktheir own version, first seen Jul 31, 2026
- magnus919/agent-skillstheir own version, first seen Jul 21, 2026
Used with
Projects with it also use sentry and linear.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
OpenAISkillsentry
Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry CLI; perform read-only queries using the `sentry` command.
Also in 3 projects that use this
OpenAISkilllinear
Manage issues, projects & team workflows in Linear. Use when the user wants to read, create or updates tickets in Linear.
Also in 3 projects that use this
Other versions15 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- chenwei791129/agent-skills★ 099% same
Wrote their own version · 14
- timescale/pg-aiguide★ 1.9ksame name
- planetscale/database-skills★ 692same name
- magnus919/agent-skills★ 109same name
- damusix/skills★ 62same name
- nahid-sparktales/agent-dispatcher★ 59same name
- digitalocean-labs/do-app-platform-skills★ 36same name
- nimadorostkar/Claude-Skills-collection★ 28same name
- mamamou/ai-coding-skills★ 16same name
- qhkm/zeptoclaw-skills★ 4same name
- fworks-tech/agenthood★ 3same name
4 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- apple-containerSkill
- atlassianSkill
- azure-devopsSkill
- deep-researchSkill
- elevenlabsSkill
- gmailSkill
- google-calendarSkill
- google-chatSkill
- google-docsSkill
- google-driveSkill
- google-sheetsSkill
- google-slidesSkill
- google-ttsSkill
- grok-buildSkill
- imagenSkill
- julesSkill
- manusSkill
- mssqlSkill
- mysqlSkill
- notebooklmSkill
- outlineSkill
- telegramSkill
- whatsappSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 1 is distinctive, and 4 are very specific to this project.
0
Common
Most of the 10 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 21
Create connections.json in the skill directory or ~/.config/claude/postgres-connections.json.
- Very specific: line 96
If unclear, run --list and ask user which database.
- Distinctive: line 101
Query validation: Only SELECT, SHOW, EXPLAIN, WITH queries allowed
- Very specific: line 126
Run --list to show available databases
- Very specific: line 128
Run --tables or --schema to explore structure
“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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:
chmod 600 connections.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
python3 scripts/query.py --listQuery a database
python3 scripts/query.py --db production --query "SELECT * FROM users LIMIT 10"List tables
python3 scripts/query.py --db production --tablesShow schema
python3 scripts/query.py --db production --schemaLimit results
python3 scripts/query.py --db production --query "SELECT * FROM orders" --limit 100Database Selection
Match user intent to database description:
| User asks about | Look for description containing |
| users, accounts | users, accounts, customers |
| orders, sales | orders, transactions, sales |
| analytics, metrics | analytics, metrics, reports |
| logs, events | logs, events, audit |
If unclear, run --list and ask user which database.
Safety Features
- Read-only session: Connection uses PostgreSQL
readonly=Truemode (primary protection) - Query validation: Only SELECT, SHOW, EXPLAIN, WITH queries allowed
- Single statement: Multiple statements per query rejected
- SSL support: Configurable SSL mode for encrypted connections
- Query timeout: 30-second statement timeout enforced
- Memory protection: Max 10,000 rows per query to prevent OOM
- Column width cap: 100 char max per column for readable output
- Credential sanitization: Error messages don't leak passwords
Troubleshooting
| Error | Solution |
| Config not found | Create connections.json in skill directory |
| Authentication failed | Check username/password in config |
| Connection timeout | Verify host/port, check firewall/VPN |
| SSL error | Try "sslmode": "disable" for local databases |
| Permission warning | Run chmod 600 connections.json |
Exit Codes
- 0: Success
- 1: Error (config missing, auth failed, invalid query, database error)
Workflow
- Run
--listto show available databases - Match user intent to database description
- Run
--tablesor--schemato explore structure - Execute query with appropriate LIMIT
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

