sql-pro
An agent skill by Jeffallan, from Jeffallan/claude-skills. Tags: analytics, database, debugging, migration, performance.
What it does
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 database dialects (PostgreSQL, MySQL, SQL Server, Oracle).
Install
With the skills CLI, which installs into Claude Code, Codex, Cursor and other agents:
npx skills add Jeffallan/claude-skills --skill sql-pro
Or copy the skill folder into Claude Code's skills directory by hand (~/.claude/skills for every project, or .claude/skills inside one):
git clone --depth 1 https://github.com/Jeffallan/claude-skills
cp -r claude-skills/skills/sql-pro ~/.claude/skills/sql-pro
Safety box score
Grade A, minimal risk: 9 of 100 risk points, rated 2026-09-22. The grade rates what the skill and its scripts can reach on the machine of whoever installs it, across eight categories from shell execution to secrets access. How the score works.
This skill is a documentation-only SQL helper: it generates query rewrites, index advice, EXPLAIN/ANALYZE guidance, and schema/maintenance SQL for PostgreSQL, MySQL, SQL Server, and Oracle. The main risk is not code execution on the host, but that it can produce operational SQL that changes production databases and can read live query text from database monitoring views.
| Category | Level | Why |
|---|---|---|
| Code & shell execution | 0 (none) | No shell scripts, binaries, or code-eval machinery are shipped; the files are Markdown with SQL examples only. |
| Network access | 0 (none) | There are no curl/fetch/API calls or remote downloads; the only external reference is a documentation URL. |
| Filesystem reach | 0 (none) | The skill does not read, write, or delete local files; all examples act on database objects, not the host filesystem. |
| Secrets & credentials | 1 (low) | It includes monitoring queries that read live query text and usernames from `pg_stat_activity`/`pg_stat_statements`, which can surface sensitive literals from workloads. |
| Privilege & persistence | 0 (none) | No sudo, service installation, shell startup edits, or OS-level configuration changes are present. |
| Instruction hijack surface | 0 (none) | There is no prompt-injection content, hidden text, or instruction to ignore policies or follow remote instructions. |
| Irreversible actions | 1 (low) | The skill’s purpose includes operational SQL such as `CREATE INDEX`, `REINDEX INDEX CONCURRENTLY`, `CREATE TRIGGER`, and `REFRESH MATERIALIZED VIEW CONCURRENTLY`, which can change databases if applied. |
| Transparency | 0 (none) | All shipped content is readable Markdown/SQL; there are no binaries, minified blobs, or unpinned installers. |
Before installing
- Read `references/optimization.md` and `references/database-design.md` to see the DDL/maintenance SQL it may generate.
- If your database contains sensitive literals in queries, restrict access to `pg_stat_activity` / `pg_stat_statements` before using it.
- Test any generated DDL on a staging copy first, especially `CREATE INDEX`, `REINDEX`, triggers, and materialized-view refreshes.
Rated 2026-09-22 by an automated review of 6 files from the skill's repository.
Source
- Repository
- Jeffallan/claude-skills (all skills from this repository)
- Path
- skills/sql-pro/SKILL.md
- Branch
- main
- Updated
- 2026-09-19
Related skills
- database-optimizer — Optimizes database queries and improves performance across PostgreSQL and MySQL systems.
- postgres-pro — Use when optimizing PostgreSQL queries, configuring replication, or implementing advanced database features.
- eas-observe — EAS service (paid). Use for anything related to EAS Observe - adding `expo-observe` to an Expo project (AppMetricsRoot/ObserveRoot HOC.
- redshift-guide — Amazon Redshift is NOT PostgreSQL — corrects PostgreSQL-derived LLM mistakes; covers Redshift-specific SQL, DDL, COPY/UNLOAD, system views, metadata discovery.
- monitoring-expert — Configures monitoring systems, implements structured logging pipelines, creates Prometheus/Grafana dashboards, defines alerting rules.
- amazon-dynamodb — Designs, reviews, and debugs DynamoDB data layers from design axioms — enumerates access patterns, chooses partition/sort keys and GSIs.