sql-engineer

Reviews and optimizes SQL queries, indexes, and schemas for correctness and performance.

Updated Jul 12, 2026
One-click install
npx skills add https://github.com/sumitake/agent-collab --skill sql-engineer-sumitake
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sql-engineer
Source: https://github.com/sumitake/agent-collab/tree/main/plugins/agent-collab/skills/sql-engineer
Command: npx skills add https://github.com/sumitake/agent-collab --skill sql-engineer-sumitake

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? SQL queries often pass a casual review while hiding defects: joins that silently fan out rows, window function frames that are off by one, indexes the planner never uses, or migrations that lock large tables. This Skill catches those correctness and performance issues before they reach production. ## Core Features & Use Cases - Query Correctness Review: Verifies joins, filters, aggregations, NULL handling, and window function semantics against the intended business question. - Performance Optimization: Reads execution plans, diagnoses cardinality-estimate mismatches, and designs selective composite or covering indexes. - Schema and Migration Safety: Assesses constraint design, backfill risk, lock implications, and rollback paths for schema changes. - Use Case: When a diff adds a new query against a large table or changes a join, invoke this Skill to confirm the query returns the right rows and that the planner can actually use the proposed indexes. ## Quick Start Ask the agent to review and optimize this SQL query and explain its execution plan using the sql-engineer skill.

Frequently Asked Questions about sql-engineer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize a slow SQL query?▼

Start by reading the execution plan to find table scans, poor join algorithm choices, and cardinality-estimate mismatches indicating stale statistics. Then design selective composite or covering indexes and confirm the planner actually uses them.

How to review a SQL query for correctness before merging?▼

Check join cardinality for silent row fan-out, verify window function frame clauses and ranking semantics, and test NULL handling in comparisons, aggregates, and joins. Confirm the query answers the actual business question, not just a plausible one.

Why does my SQL join return duplicate rows?▼

Duplicate rows usually come from join fan-out, where a one-to-many relationship multiplies rows beyond what the caller expects. Trace the cardinality of each joined table and add distinct aggregation or restructure the join to match the intended semantics.

Can this Skill help with database migration safety?▼

Yes, it assesses whether a schema change can run without locking large tables, whether backfills are safe, and whether a practical rollback path exists. It flags changes needing environment-level validation before running against production data.

When should I use postgres-engineer instead of sql-engineer?▼

Use postgres-engineer for engine-level PostgreSQL administration such as server configuration tuning, vacuum and autovacuum behavior, or replication setup. Use sql-engineer for query design, optimization, indexing, and schema-aware correctness work.