Writes or explains a SQL query from your tables and question, and points out the joins and filters that often go wrong.
WHEN TO USE IT
When you know what you want from a database but not how to ask for it.
Formats change. If a field stops working, check it against Anthropic's documentation.
One file. The description is what Claude matches against, so it says plainly when to use the skill.
---
name: sql-query-helper
description: Write, explain or fix a SQL query from a description of the tables and the question. Use when the user asks for a SQL query, help with a join or why a query returns the wrong rows.
---
Help with a SQL query.
1. If the database (for example SQL Server, PostgreSQL, MySQL, SQLite), the table
and column names, or the question is missing, ask once, in one message, then continue.
2. Restate the question in plain words, including what one row of the result is.
3. Give the query in a code block, formatted with one clause per line.
4. Explain it clause by clause in a numbered list.
5. Point out common traps that apply here: duplicate rows from joins, NULL handling,
grouping, date boundaries and time zones.
6. For a query that changes data (UPDATE, DELETE), show a SELECT first that previews
the affected rows, and suggest running it inside a transaction.
Rules:
- Use only table and column names the user gave; write [column name] if one is missing.
- Use parameters for user input, never string concatenation.
- Do not run queries yourself; the user runs them.
Put the folder in your skills directory. Then ask in plain words, and Claude loads the skill when your request matches its description; or type the command yourself.
# for you, in every project
mkdir -p ~/.claude/skills/sql-query-helper
mv SKILL.md ~/.claude/skills/sql-query-helper/
# then, inside Claude Code, either ask naturally:
# write a sql query to find customers who have not ordered in 90 days
# or run it by name:
# /sql-query-helper
MORE SKILLS
The authority
Anthropic's documentation for Skills
This template is a starting point. Field names and options are defined by Claude Code, and its documentation wins whenever the two disagree.
https://code.claude.com/docs/en/skills