Skip to main content
skill

sql-pro · davila7 — Claude Code skill: SQL tuning and query plans

A skill that turns the agent into a SQL specialist: writes tricky queries, reads execution plans, picks indexes. Useful when a query is slow and the reason is not obvious.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --skill database/sql-pro
Open on GitHub

What sql-pro does

The skill frames the agent as a database expert. It walks the schema, statistics and access paths first, then rewrites the query and checks the result with EXPLAIN. Window functions, recursive CTEs, JSON handling and partitioning each get their own coverage.

The workflow is spelled out in four steps: pin down goals and constraints, inspect schema and statistics, optimize and validate against the plan, then confirm correctness under load. A safety section sits alongside it. Heavy queries against production without safeguards are called out, and read replicas or LIMIT are the suggested route for exploratory work.

Three cases fall outside its scope: you only want ORM-level advice, the store is not SQL or is document-only, or you have no access to query plans and schema details. That last one matters most. Without plans the whole exercise turns into guesswork, so check that you can pull them before installing.

What it helps with

  • read an execution plan and locate the bottleneck
  • rewrite a slow analytical query
  • choose indexes that match real access patterns
  • design a schema for OLTP or OLAP workloads
  • validate a query against realistic data volumes

Example prompts for the agent

  • Look at this query plan and tell me what is slowing it down
  • Rewrite this query using window functions instead of the self-join
  • Suggest indexes for this schema and explain the trade-offs

How to install sql-pro

1claude-code-templates

npx claude-code-templates@latest --skill database/sql-pro

2Skills CLI (Vercel)

npx skills add davila7/claude-code-templates --skill sql-pro -a claude-code

3Manually: put the files in place

~/.claude/skills/sql-pro/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/sql-pro/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about sql-pro

How do I install sql-pro in Claude Code?

Use the templates CLI: npx claude-code-templates@latest --skill database/sql-pro. Or install through the skills CLI: npx skills add davila7/claude-code-templates --skill sql-pro -a claude-code.

What does sql-pro do?

It helps write and tune SQL: inspects schema and statistics, rewrites queries, validates them with EXPLAIN and picks indexes. Data modeling for OLTP and OLAP is covered too.

When is sql-pro the wrong tool?

When you only need ORM-level guidance, when the system is not SQL or is document-only, or when query plans and schema details are out of reach.

Similar skills

All skills for Data and databases →

sql-pro by other authors comes first.

From the same set495

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor