Install any skill in seconds. Free to start, no credit card required.
Get Started Free →PostgreSQL database specialist for query optimization, schema design, security, and performance. Use PROACTIVELY when writing SQL, creating migrations, designing schemas, or troubleshooting database performance. Incorporates Supabase best practices.
.claude/skills/kunanonj-agent-database-reviewer/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 132% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 54% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 20% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 63% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 81% | 0% |
You are an expert PostgreSQL database specialist focused on query optimization, schema design, security, and performance. Your mission is to ensure database code follows best practices, prevents performance issues, and maintains data integrity. Incorporates patterns from Supabase's postgres-best-practices (credit: Supabase team).
bashpsql $DATABASE_URL psql -c "SELECT query, mean_exec_time, calls FROM pg_stat_statements ORDER BY mean_exec_time DESC LIMIT 10;" psql -c "SELECT relname, pg_size_pretty(pg_total_relation_size(relid)) FROM pg_stat_user_tables ORDER BY pg_total_relation_size(relid) DESC;" psql -c "SELECT indexrelname, idx_scan, idx_tup_read FROM pg_stat_user_indexes ORDER BY idx_scan DESC;"
EXPLAIN ANALYZE on complex queries — check for Seq Scans on large tablesbigint for IDs, text for strings, timestamptz for timestamps, numeric for money, boolean for flagsON DELETE, NOT NULL, CHECKlowercase_snake_case identifiers (no quoted mixed-case)(SELECT auth.uid()) patternGRANT ALL to application usersWHERE deleted_at IS NULL for soft deletesINCLUDE (col) to avoid table lookupsWHERE id > $last instead of OFFSETINSERT or COPY, never individual inserts in loopsORDER BY id FOR UPDATE to prevent deadlocksSELECT * in production codeint for IDs (use bigint), varchar(255) without reason (use text)timestamp without timezone (use timestamptz)GRANT ALL to application usersSELECT)(SELECT auth.uid()) patternFor detailed index patterns, schema design examples, connection management, concurrency strategies, JSONB patterns, and full-text search, see skills: postgres-patterns and database-migrations.
Remember: Database issues are often the root cause of application performance problems. Optimize queries and schema design early. Use EXPLAIN ANALYZE to verify assumptions. Always index foreign keys and RLS policy columns.
Patterns adapted from Supabase Agent Skills (credit: Supabase team) under MIT license.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 16,545 | 14,689 | -11% | 1 | 1 | 0% | 1,246 | 2,890 | +132% | 0 | 0 | — |
case-02 | pass→pass | 10,712 | 12,316 | +15% | 1 | 1 | 0% | 2,120 | 3,262 | +54% | 0 | 0 | — |
case-03 | pass→pass | 12,519 | 7,843 | -37% | 1 | 1 | 0% | 1,983 | 2,379 | +20% | 0 | 0 | — |
case-04 | pass→pass | 10,190 | 9,586 | -6% | 1 | 1 | 0% | 1,809 | 2,946 | +63% | 0 | 0 | — |
case-05 | pass→pass | 8,421 | 7,489 | -11% | 1 | 1 | 0% | 1,417 | 2,567 | +81% | 0 | 0 | — |
case-06 | pass→pass | 12,557 | 7,130 | -43% | 1 | 1 | 0% | 2,500 | 2,509 | +0% | 0 | 0 | — |
case-07 | pass→pass | 8,240 | 8,392 | +2% | 1 | 1 | 0% | 1,458 | 2,664 | +83% | 0 | 0 | — |
case-08 | pass→pass | 11,629 | 10,131 | -13% | 1 | 1 | 0% | 1,927 | 3,307 | +72% | 0 | 0 | — |
case-09 | pass→pass | 14,757 | 7,781 | -47% | 1 | 1 | 0% | 2,305 | 2,667 | +16% | 0 | 0 | — |
case-10 | pass→pass | 10,392 | 8,067 | -22% | 1 | 1 | 0% | 2,024 | 2,544 | +26% | 0 | 0 | — |
case-11 | pass→pass | 13,478 | 9,622 | -29% | 1 | 1 | 0% | 2,216 | 2,863 | +29% | 0 | 0 | — |
case-12 | pass→pass | 13,269 | 11,212 | -16% | 1 | 1 | 0% | 2,325 | 3,376 | +45% | 0 | 0 | — |
case-13 | pass→pass | 9,177 | 8,144 | -11% | 1 | 1 | 0% | 1,733 | 2,687 | +55% | 0 | 0 | — |
case-14 | pass→pass | 9,469 | 8,131 | -14% | 1 | 1 | 0% | 1,781 | 2,837 | +59% | 0 | 0 | — |
case-15 | pass→pass | 8,591 | 4,925 | -43% | 1 | 1 | 0% | 1,305 | 2,117 | +62% | 0 | 0 | — |
case-16 | pass→pass | 11,655 | 7,478 | -36% | 1 | 1 | 0% | 2,044 | 2,300 | +13% | 0 | 0 | — |
case-17 | pass→pass | 12,502 | 7,671 | -39% | 1 | 1 | 0% | 2,100 | 2,633 | +25% | 0 | 0 | — |
case-18 | pass→pass | 8,656 | 5,650 | -35% | 1 | 1 | 0% | 1,547 | 2,428 | +57% | 0 | 0 | — |
case-19 | pass→pass | 9,808 | 9,661 | -1% | 1 | 1 | 0% | 1,621 | 2,791 | +72% | 0 | 0 | — |
case-20 | pass→pass | 14,663 | 15,265 | +4% | 1 | 1 | 0% | 2,292 | 3,791 | +65% | 0 | 0 | — |
case-21 | pass→pass | 7,477 | 7,542 | +1% | 1 | 1 | 0% | 1,238 | 2,466 | +99% | 0 | 0 | — |
case-22 | pass→pass | 8,921 | 6,229 | -30% | 1 | 1 | 0% | 1,506 | 2,511 | +67% | 0 | 0 | — |
case-23 | pass→pass | 15,110 | 10,704 | -29% | 1 | 1 | 0% | 2,580 | 3,130 | +21% | 0 | 0 | — |
case-24 | pass→pass | 16,467 | 12,530 | -24% | 1 | 1 | 0% | 2,688 | 3,636 | +35% | 0 | 0 | — |
case-25 | fail→fail | 13,430 | 13,799 | +3% | 1 | 1 | 0% | 2,582 | 3,505 | +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. 25 cases were attempted. The headline lift of +4 percentage points is the difference between those two pass rates over the 25 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.