Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Run PostgreSQL queries and meta-commands via CLI
.claude/skills/aiskillstore-psql/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | -6% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 55% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 23% | 0% |
| case-08 | ✗→✓ | ▲ Improved | -48% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 30% | 0% |
CLI tool for running SQL queries and psql meta-commands against PostgreSQL databases. Each query is executed directly via the psql CLI - no persistent connection required.
<git-root>/.env or exportedSet these in your .env file or export them:
| Variable | Required | Default | Description | |----------|----------|---------|-------------| | PGHOST | Yes | - | Database host | | PGPORT | No | 5432 | Database port | | PGDATABASE | Yes | - | Database name | | PGUSER | Yes | - | Database user | | PGPASSWORD | Yes | - | Database password | | PGSSLMODE | No | - | SSL mode (disable, require, etc.) |
Example .env:
bashPGHOST=localhost PGPORT=5432 PGDATABASE=myapp PGUSER=myapp PGPASSWORD=secret PGSSLMODE=disable
Run a SQL query, meta-command, or SQL file.
bashbun .opencode/skill/psql/query.js <query> [options] bun .opencode/skill/psql/query.js --file <path> [options]
Arguments:
query - SQL query or meta-command to executeOptions:
--file <path> - Execute SQL file instead of inline query--tuples - Tuples only output (no headers or row count)--timeout <ms> - Query timeout in milliseconds (default: 30000)--json - Wrap output in JSON--help - Show helpExamples:
bash# SQL queries bun .opencode/skill/psql/query.js "SELECT * FROM users LIMIT 5;" bun .opencode/skill/psql/query.js "SELECT COUNT(*) FROM orders WHERE status = 'pending';" # Meta-commands bun .opencode/skill/psql/query.js "\dt" bun .opencode/skill/psql/query.js "\d users" bun .opencode/skill/psql/query.js "\di" bun .opencode/skill/psql/query.js "\l" # Execute SQL file bun .opencode/skill/psql/query.js --file migrations/001_create_users.sql bun .opencode/skill/psql/query.js --file scripts/seed_data.sql # Tuples only (for scripting/parsing) bun .opencode/skill/psql/query.js "SELECT id FROM users;" --tuples # With longer timeout for slow queries bun .opencode/skill/psql/query.js "SELECT * FROM large_table;" --timeout 60000
bash# List all tables bun .opencode/skill/psql/query.js "\dt" # Describe a specific table bun .opencode/skill/psql/query.js "\d users" # Show indexes bun .opencode/skill/psql/query.js "\di" # Show foreign keys for a table bun .opencode/skill/psql/query.js "\d+ orders"
bash# Count records bun .opencode/skill/psql/query.js "SELECT COUNT(*) FROM orders;" # Group by aggregation bun .opencode/skill/psql/query.js "SELECT status, COUNT(*) FROM orders GROUP BY status;" # Recent activity bun .opencode/skill/psql/query.js "SELECT * FROM orders WHERE created_at > NOW() - INTERVAL '1 day' ORDER BY created_at DESC LIMIT 10;"
bash# Check table sizes bun .opencode/skill/psql/query.js "SELECT relname, pg_size_pretty(pg_total_relation_size(relid)) FROM pg_catalog.pg_statio_user_tables ORDER BY pg_total_relation_size(relid) DESC LIMIT 10;" # Check active connections bun .opencode/skill/psql/query.js "SELECT count(*) FROM pg_stat_activity WHERE state = 'active';" # List databases bun .opencode/skill/psql/query.js "\l"
bash# Execute a migration file bun .opencode/skill/psql/query.js --file migrations/001_create_users.sql # Execute seed data bun .opencode/skill/psql/query.js --file scripts/seed.sql
--tuples for clean output without headers (useful for piping to other tools)--json for structured output when parsing programmaticallypsql invocation (no persistent connection)\) work the same as SQL queries--timeout increased from the default 30 seconds--tuples flag is useful when you need to parse output or pipe to other commands| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-24 | pass→pass | 22,240 | 17,718 | -20% | 1 | 1 | 0% | 3,093 | 3,421 | +11% | 0 | 0 | — |
case-01 | fail→fail | 11,420 | 16,766 | +47% | 1 | 1 | 0% | 1,008 | 1,498 | +49% | 0 | 0 | — |
case-02 | fail→pass | 24,832 | 15,336 | -38% | 1 | 1 | 0% | 1,889 | 1,768 | -6% | 0 | 0 | — |
case-03 | fail→pass | 13,814 | 14,671 | +6% | 1 | 1 | 0% | 1,818 | 2,816 | +55% | 0 | 0 | — |
case-04 | fail→fail | 12,311 | 17,333 | +41% | 1 | 1 | 0% | 1,323 | 1,467 | +11% | 0 | 0 | — |
case-05 | fail→fail | 14,698 | 15,266 | +4% | 1 | 1 | 0% | 1,895 | 1,476 | -22% | 0 | 0 | — |
case-06 | fail→fail | 10,971 | 15,775 | +44% | 1 | 1 | 0% | 1,035 | 1,468 | +42% | 0 | 0 | — |
case-07 | fail→pass | 11,701 | 6,617 | -43% | 1 | 1 | 0% | 1,161 | 1,424 | +23% | 0 | 0 | — |
case-08 | fail→pass | 19,183 | 6,589 | -66% | 1 | 1 | 0% | 2,843 | 1,466 | -48% | 0 | 0 | — |
case-09 | fail→fail | 13,902 | 14,480 | +4% | 1 | 1 | 0% | 769 | 1,443 | +88% | 0 | 0 | — |
case-10 | fail→fail | 14,689 | 22,466 | +53% | 1 | 1 | 0% | 1,944 | 1,840 | -5% | 0 | 0 | — |
case-11 | fail→fail | 2,184 | 13,986 | +540% | 1 | 1 | 0% | 274 | 1,438 | +425% | 0 | 0 | — |
case-12 | fail→fail | 11,372 | 15,521 | +36% | 1 | 1 | 0% | 995 | 1,475 | +48% | 0 | 0 | — |
case-13 | fail→fail | 4,674 | 13,040 | +179% | 1 | 1 | 0% | 892 | 1,820 | +104% | 0 | 0 | — |
case-14 | fail→pass | 7,646 | 1,803 | -76% | 1 | 1 | 0% | 1,162 | 1,505 | +30% | 0 | 0 | — |
case-15 | pass→pass | 13,669 | 7,706 | -44% | 1 | 1 | 0% | 2,328 | 1,791 | -23% | 0 | 0 | — |
case-16 | pass→pass | 10,552 | 2,291 | -78% | 1 | 1 | 0% | 1,006 | 1,578 | +57% | 0 | 0 | — |
case-17 | fail→pass | 26,924 | 1,531 | -94% | 1 | 1 | 0% | 1,854 | 1,473 | -21% | 0 | 0 | — |
case-18 | fail→pass | 9,923 | 1,940 | -80% | 1 | 1 | 0% | 832 | 1,539 | +85% | 0 | 0 | — |
case-19 | pass→pass | 13,972 | 2,360 | -83% | 1 | 1 | 0% | 1,715 | 1,697 | -1% | 0 | 0 | — |
case-20 | pass→pass | 6,911 | 7,606 | +10% | 1 | 1 | 0% | 1,177 | 1,660 | +41% | 0 | 0 | — |
case-21 | pass→pass | 11,092 | 1,802 | -84% | 1 | 1 | 0% | 1,739 | 1,516 | -13% | 0 | 0 | — |
case-22 | pass→pass | 8,941 | 6,840 | -23% | 1 | 1 | 0% | 1,598 | 2,530 | +58% | 0 | 0 | — |
case-23 | pass→fail | 22,089 | 29,153 | +32% | 1 | 1 | 0% | 3,618 | 4,927 | +36% | 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. 24 cases were attempted, and 14 counted toward the lift figure. The other 10 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 +25 percentage points is the difference between those two pass rates over the 14 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
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.