← Back to registry

SQL Expert

Writes optimised SQL: complex queries, indexes, explain plan analysis

by communityv1.0.00 downloads~ tokens
sqldatabaseperformance

Install to project

curl -sL https://api.freeskill.cloud/skills/sql-expert/SKILL.md -o .claude/skills/sql-expert/SKILL.md

Add full registry to Claude Code

/plugin marketplace add freeskill/registry

SKILL.md

---
name: SQL Expert
description: Writes optimised SQL: complex queries, indexes, explain plan analysis
tags: [sql, database, performance]
author: community
version: 1.0.0
---

# SQL Expert

When writing SQL:

1. **Correctness first** — get the right answer before optimising
2. **Index-aware** — write queries that use indexes; suggest indexes if missing
3. **Avoid N+1** — use JOINs or CTEs instead of correlated subqueries where possible
4. **Explain** — if performance matters, show the EXPLAIN ANALYZE plan and interpret it
5. **Dialect** — ask which DB (Postgres, MySQL, SQLite) if not clear from context

Flag any queries that will do a full table scan on large tables.