SQL Database Query Generator skill for Claude and Codex
One correct SQL statement from a table, columns, conditions, and row limit, in your database's syntax, ready to paste into a console for a quick check or…
Install it once and Claude or Codex runs it for you. When your request matches, your AI loads the skill, asks for anything it is missing, and works through the template itself. Prefer to fill it in by hand? See the full prompt template.
Download the skill (.zip) · View SKILL.md
When it is used
Use when a quick single-table SELECT, INSERT, UPDATE, or DELETE is needed in the right dialect syntax to paste into a database console. Do not use for multi-table analytics, query tuning, or statements that must be designed against a full schema. Related topics: coding, sql.
What it will ask you for
- Database (choose one: MySQL, PostgreSQL, SQLite, SQL Server, Oracle)
- Operation (choose one: SELECT, INSERT, UPDATE, DELETE)
- Table name (free text, e.g. "users")
- Columns (longer free text)
- Conditions (longer free text)
- Row limit (number from 1 to 1000)
- Order by (optional) (free text, e.g. "created_at descending")
How it works
- Write one statement in the chosen database's syntax for identifier quoting, string quoting, and row limiting.
- For SELECT, list the columns explicitly and add ORDER BY when given so the limit is deterministic.
- For INSERT, pair every column with a placeholder value of the right type.
- For UPDATE and DELETE, attach the conditions as WHERE; when none are given, add an incomplete WHERE and a note instead of an unconditioned write.
- Confirm the result is a single statement ending in a semicolon with one clause per line.
What you get
The single SQL statement as plain text, one clause per line, ending with a semicolon, plus a one-line safety note only when a write has no condition.
What it watches out for
- Using LIMIT for SQL Server, which rejects it; the syntax is TOP or OFFSET FETCH.
- Generating a DELETE without a WHERE clause because the conditions field was empty.
- Applying a row limit without an ORDER BY, which returns a different set of rows each time.
How to install
Claude.ai and the Claude desktop app
- Download the skill .zip.
- Open Settings, then Capabilities, and find Skills.
- Choose Upload skill and select the .zip.
- Ask Claude for help with the task. It loads the skill when your request matches.
Claude Code
- Download the skill .zip.
- Unzip it into ~/.claude/skills/ (or .claude/skills/ inside a project).
- Start a new session. Claude Code loads the skill when your request matches.
Codex
- Download the skill .zip.
- Unzip it into ~/.agents/skills/ (or .agents/skills/ inside a project).
- Codex picks it up on its own. Type $ and the skill name to use it, or just ask for the task.
Cursor
- Download the Cursor rule (.mdc).
- Save it in .cursor/rules/ inside your project.
- Cursor's agent applies the rule when your request matches its description.
AGENTS.md (Codex, Cursor, and other coding agents)
- Copy the AGENTS.md section.
- Paste it into AGENTS.md at the root of your repository, creating the file if needed.
- Coding agents that read AGENTS.md follow it when your request fits.