Skip to content
Back to skills

Explain Query

ASecurity

Explains what a SQL query returns, how the database plans to run it and which parts will be slow, using the real plan if allowed.

  • 3 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added November 15, 2026
ai-agentssqldatabase

Security analysis

A100/100

Scanned November 15, 2026

npx -y skills add workspace-templates/ai-agent-templates --skill explain-query --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Explain Query?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Explain Query
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/workspace-templates-explain-query/badge)](https://www.skillsdirectory.com/skills/workspace-templates-explain-query)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: explain-query
description: Explains what a SQL query returns, how the database plans to run it and which parts will be slow, using the real plan if allowed.
argument-hint: "[SQL text or file:line]"
user-invocable: true
disable-model-invocation: true
---

Explain this query: $ARGUMENTS (SQL text, or a file and line where it lives).

1. Identify the dialect and find the schema and indexes for each table involved. If the query is in application code, extract the SQL and note the bound parameters.
2. Say in two sentences what the query returns and for whom. Then walk through it in logical order: FROM and joins, WHERE, GROUP BY, HAVING, window functions, ORDER BY, LIMIT. One line each.
3. Predict the physical plan: which index each filter could use, join method and order, and where a sort or temp table is needed.
4. Offer to run `EXPLAIN` (never `EXPLAIN ANALYZE` on writes, since it executes them). Run it only when a read-only connection is available and the user agrees.
5. Flag slow spots: functions on indexed columns, leading wildcard LIKE, SELECT *, OR across columns, correlated subqueries, missing join indexes, OFFSET paging.

Report the explanation, a ranked list of the slow spots with evidence, and one rewrite per spot. Do not alter any code or schema.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.