Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Optimizes SQL queries, designs database schemas, and troubleshoots performance issues. Use when a user asks why their query is slow, needs help writing complex joins or aggregations, mentions database performance issues, or wants to design or migrate a schema. Invoke for complex queries, window functions, CTEs, indexing strategies, query plan analysis, covering index creation, recursive queries, EXPLAIN/ANALYZE interpretation, before/after query benchmarking, or migrating queries between databas
.claude/skills/jeffallan-sql-pro/SKILL.md| Model | Eval pass | Runs |
|---|---|---|
| gemini-3.6-flash | 97% | 35 |
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-11 | ✗→✓ | ▲ Improved | 50% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 5% | 0% |
| case-15 | ✗→✓ | ▲ Improved | -31% | 0% |
| case-16 | ✗→✓ | ▲ Improved | -31% | 0% |
| case-17 | ✗→✓ | ▲ Improved | -40% | 0% |
EXPLAIN ANALYZE and confirm no sequential scans on large tables; if query does not meet sub-100ms target, iterate on index selection or query rewrite before proceedingLoad detailed guidance based on context:
| Topic | Reference | Load When | |-------|-----------|-----------| | Query Patterns | references/query-patterns.md | JOINs, CTEs, subqueries, recursive queries | | Window Functions | references/window-functions.md | ROW_NUMBER, RANK, LAG/LEAD, analytics | | Optimization | references/optimization.md | EXPLAIN plans, indexes, statistics, tuning | | Database Design | references/database-design.md | Normalization, keys, constraints, schemas | | Dialect Differences | references/dialect-differences.md | PostgreSQL vs MySQL vs SQL Server specifics |
sql-- Isolate expensive subquery logic for reuse and readability WITH ranked_orders AS ( SELECT customer_id, order_id, total_amount, ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY order_date DESC) AS rn FROM orders WHERE status = 'completed' -- filter early, before the join ) SELECT customer_id, order_id, total_amount FROM ranked_orders WHERE rn = 1; -- latest completed order per customer
sql-- Running total and rank within partition — no self-join required SELECT department_id, employee_id, salary, SUM(salary) OVER (PARTITION BY department_id ORDER BY hire_date) AS running_payroll, RANK() OVER (PARTITION BY department_id ORDER BY salary DESC) AS salary_rank FROM employees;
sql-- PostgreSQL: always use ANALYZE to see actual row counts vs. estimates EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) SELECT * FROM orders o JOIN customers c ON c.id = o.customer_id WHERE o.created_at > NOW() - INTERVAL '30 days';
Key things to check in the output:
ANALYZE <table> to refresh statisticsread count signals missing cache / indexsql-- BEFORE: correlated subquery, one execution per row (slow) SELECT order_id, (SELECT SUM(quantity) FROM order_items oi WHERE oi.order_id = o.id) AS item_count FROM orders o; -- AFTER: single aggregation join (fast) SELECT o.order_id, COALESCE(agg.item_count, 0) AS item_count FROM orders o LEFT JOIN ( SELECT order_id, SUM(quantity) AS item_count FROM order_items GROUP BY order_id ) agg ON agg.order_id = o.id; -- Supporting covering index (includes all columns touched by the query) CREATE INDEX idx_order_items_order_qty ON order_items (order_id) INCLUDE (quantity);
When implementing SQL solutions, provide:
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-03 | fail→fail | 9,171 | 10,265 | +12% | 1 | 1 | 0% | 1,826 | 3,085 | +69% | 0 | 0 | — |
case-01 | pass→pass | 7,331 | 6,682 | -9% | 1 | 1 | 0% | 1,426 | 2,325 | +63% | 0 | 0 | — |
case-02 | pass→pass | 10,306 | 11,173 | +8% | 1 | 1 | 0% | 2,067 | 3,091 | +50% | 0 | 0 | — |
case-04 | pass→pass | 9,602 | 8,701 | -9% | 1 | 1 | 0% | 1,834 | 2,944 | +61% | 0 | 0 | — |
case-05 | pass→pass | 14,694 | 11,199 | -24% | 1 | 1 | 0% | 2,634 | 3,113 | +18% | 0 | 0 | — |
case-06 | pass→pass | 11,913 | 9,763 | -18% | 1 | 1 | 0% | 2,261 | 2,893 | +28% | 0 | 0 | — |
case-07 | pass→pass | 10,026 | 9,542 | -5% | 1 | 1 | 0% | 2,134 | 2,902 | +36% | 0 | 0 | — |
case-08 | pass→pass | 10,024 | 11,564 | +15% | 1 | 1 | 0% | 2,055 | 3,429 | +67% | 0 | 0 | — |
case-22 | pass→pass | 9,646 | 10,540 | +9% | 1 | 1 | 0% | 1,973 | 3,328 | +69% | 0 | 0 | — |
case-09 | pass→pass | 11,092 | 10,528 | -5% | 1 | 1 | 0% | 2,204 | 3,119 | +42% | 0 | 0 | — |
case-10 | pass→pass | 10,452 | 11,089 | +6% | 1 | 1 | 0% | 1,919 | 3,142 | +64% | 0 | 0 | — |
case-11 | fail→pass | 9,250 | 8,387 | -9% | 1 | 1 | 0% | 1,791 | 2,684 | +50% | 0 | 0 | — |
case-12 | pass→pass | 5,495 | 8,312 | +51% | 1 | 1 | 0% | 1,099 | 2,649 | +141% | 0 | 0 | — |
case-13 | fail→pass | 12,791 | 7,349 | -43% | 1 | 1 | 0% | 2,181 | 2,298 | +5% | 0 | 0 | — |
case-14 | pass→pass | 6,883 | 10,463 | +52% | 1 | 1 | 0% | 1,163 | 2,824 | +143% | 0 | 0 | — |
case-15 | fail→pass | 16,050 | 5,185 | -68% | 1 | 1 | 0% | 3,079 | 2,111 | -31% | 0 | 0 | — |
case-16 | fail→pass | 14,112 | 3,640 | -74% | 1 | 1 | 0% | 2,373 | 1,632 | -31% | 0 | 0 | — |
case-17 | fail→pass | 16,842 | 4,738 | -72% | 1 | 1 | 0% | 3,187 | 1,904 | -40% | 0 | 0 | — |
case-18 | fail→pass | 12,001 | 4,303 | -64% | 1 | 1 | 0% | 2,172 | 1,862 | -14% | 0 | 0 | — |
case-19 | fail→pass | 9,239 | 3,338 | -64% | 1 | 1 | 0% | 1,648 | 1,663 | +1% | 0 | 0 | — |
case-20 | pass→pass | 12,935 | 14,882 | +15% | 1 | 1 | 0% | 2,529 | 3,591 | +42% | 0 | 0 | — |
case-21 | pass→pass | 9,558 | 9,302 | -3% | 1 | 1 | 0% | 2,005 | 2,970 | +48% | 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. 22 cases were attempted. The headline lift of +32 percentage points is the difference between those two pass rates over the 22 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.