Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Execute safe read-only SQL queries against PostgreSQL databases with multi-connection support and defense-in-depth write protection.
.claude/skills/sickn33-postgres-readonly-queries/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-04 | ✗→✓ | ▲ Improved | 23% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 7% | 0% |
| case-13 | ✗→✓ | ▲ Improved | -13% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 15% | 0% |
| case-20 | ✗→✓ | ▲ Improved | 36% | 0% |
Execute safe, read-only queries against configured PostgreSQL databases.
pip install -r requirements.txtCreate connections.json in the skill directory or ~/.config/claude/postgres-connections.json.
Security: Set file permissions to 600 since it contains credentials:
bashchmod 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" } ] }
| 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 |
bashpython3 scripts/query.py --list
bashpython3 scripts/query.py --db production --query "SELECT * FROM users LIMIT 10"
bashpython3 scripts/query.py --db production --tables
bashpython3 scripts/query.py --db production --schema
bashpython3 scripts/query.py --db production --query "SELECT * FROM orders" --limit 100
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.
readonly=True mode (primary protection)| 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 |
--list to show available databases--tables or --schema to explore structuretriggers, extensions, or an over-privileged account. Use a database role with read-only permissions as the primary control.
database and avoid exporting or sharing results without explicit authorization.
controls.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-18 | pass→pass | 8,310 | 4,416 | -47% | 1 | 1 | 0% | 1,460 | 1,794 | +23% | 0 | 0 | — |
case-01 | fail→fail | 8,918 | 4,910 | -45% | 1 | 1 | 0% | 1,154 | 1,244 | +8% | 0 | 0 | — |
case-02 | fail→fail | 3,583 | 4,143 | +16% | 1 | 1 | 0% | 676 | 1,327 | +96% | 0 | 0 | — |
case-03 | fail→fail | 6,575 | 4,950 | -25% | 1 | 1 | 0% | 1,334 | 1,258 | -6% | 0 | 0 | — |
case-04 | fail→pass | 6,410 | 1,660 | -74% | 1 | 1 | 0% | 1,093 | 1,344 | +23% | 0 | 0 | — |
case-05 | pass→pass | 5,220 | 2,192 | -58% | 1 | 1 | 0% | 939 | 1,298 | +38% | 0 | 0 | — |
case-06 | pass→pass | 7,450 | 2,196 | -71% | 1 | 1 | 0% | 1,257 | 1,335 | +6% | 0 | 0 | — |
case-07 | pass→pass | 9,519 | 2,789 | -71% | 1 | 1 | 0% | 1,840 | 1,528 | -17% | 0 | 0 | — |
case-08 | pass→pass | 6,838 | 1,780 | -74% | 1 | 1 | 0% | 1,232 | 1,365 | +11% | 0 | 0 | — |
case-09 | pass→pass | 6,163 | 1,779 | -71% | 1 | 1 | 0% | 1,081 | 1,306 | +21% | 0 | 0 | — |
case-10 | fail→pass | 11,334 | 6,234 | -45% | 1 | 1 | 0% | 1,954 | 2,089 | +7% | 0 | 0 | — |
case-11 | fail→fail | 12,409 | 2,492 | -80% | 1 | 1 | 0% | 2,553 | 1,399 | -45% | 0 | 0 | — |
case-12 | pass→pass | 9,224 | 4,540 | -51% | 1 | 1 | 0% | 1,717 | 1,769 | +3% | 0 | 0 | — |
case-13 | fail→pass | 10,138 | 3,137 | -69% | 1 | 1 | 0% | 1,774 | 1,535 | -13% | 0 | 0 | — |
case-14 | pass→pass | 13,518 | 4,433 | -67% | 1 | 1 | 0% | 2,428 | 1,191 | -51% | 0 | 0 | — |
case-15 | pass→pass | 17,592 | 7,903 | -55% | 1 | 1 | 0% | 1,833 | 1,333 | -27% | 0 | 0 | — |
case-16 | fail→pass | 9,156 | 4,572 | -50% | 1 | 1 | 0% | 1,581 | 1,826 | +15% | 0 | 0 | — |
case-17 | pass→pass | 2,864 | 1,897 | -34% | 1 | 1 | 0% | 552 | 1,341 | +143% | 0 | 0 | — |
case-19 | pass→pass | 11,257 | 2,014 | -82% | 1 | 1 | 0% | 1,997 | 1,356 | -32% | 0 | 0 | — |
case-20 | fail→pass | 6,508 | 2,420 | -63% | 1 | 1 | 0% | 1,086 | 1,477 | +36% | 0 | 0 | — |
case-21 | fail→pass | 11,602 | 8,949 | -23% | 1 | 1 | 0% | 2,387 | 2,816 | +18% | 0 | 0 | — |
case-22 | fail→pass | 3,251 | 2,678 | -18% | 1 | 1 | 0% | 572 | 1,438 | +151% | 0 | 0 | — |
case-23 | pass→pass | 4,166 | 4,857 | +17% | 1 | 1 | 0% | 728 | 1,939 | +166% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted, and 21 counted toward the lift figure. The other 2 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +30 percentage points is the difference between those two pass rates over the 21 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.