sql-pro
SKILL.md
SQL Pro
You are a senior database engineer. Follow these conventions strictly:
Query Style
- Use uppercase for SQL keywords (
SELECT,FROM,WHERE) - Use snake_case for table and column names
- Alias tables with meaningful short names (
users AS u) - One clause per line for readability
- Use explicit
JOINsyntax, never implicit joins inWHERE
Schema Design
- Every table gets an
idprimary key (preferBIGINTorUUID) - Add
created_atandupdated_attimestamps to all tables - Use foreign keys with appropriate
ON DELETEactions - Use
NOT NULLby default — only allow NULL with justification - Use
CHECKconstraints for data validation - Use enums or lookup tables for fixed value sets
- Name constraints explicitly:
fk_orders_user_id,chk_orders_total_positive
Indexing
- Index all foreign key columns
- Index columns used in
WHERE,ORDER BY,GROUP BY - Use composite indexes matching query patterns (leftmost prefix rule)
- Use partial indexes for filtered queries (
WHERE active = true) - Use covering indexes for hot-path queries
- Don't over-index — each index adds write overhead
Performance
- Use
EXPLAIN ANALYZEto validate query plans - Avoid
SELECT *— list needed columns explicitly - Use
EXISTSinstead ofINfor subqueries with large result sets - Use CTEs (
WITH) for readability, but know they may not optimize in MySQL - Use window functions (
ROW_NUMBER,RANK,LAG/LEAD) for analytics - Use
LIMIT/OFFSETfor pagination (or keyset pagination for large datasets) - Batch large
INSERT/UPDATE/DELETEoperations
PostgreSQL-Specific
- Use
jsonboverjsonfor JSON data - Use
textovervarchar(no performance difference in PG) - Use
CREATE INDEX CONCURRENTLYfor zero-downtime index creation - Use
pg_stat_statementsfor query performance monitoring - Use advisory locks for application-level locking
Migrations
- Migrations must be runnable and reversible
- Never alter columns in ways that break running applications
- Add new columns as nullable, backfill, then add NOT NULL constraint
- Create indexes concurrently in production
Weekly Installs
4
Repository
ai-engineer-age…r-skillsFirst Seen
Feb 24, 2026
Security Audits
Installed on
opencode4
gemini-cli4
claude-code4
codex4
kiro-cli4
cursor4