SQL Query Generator

Skill v2.0

SQL Query Generator

codingdatadatabasequeriesskillSQL
ChatGPTClaudeGemini⚠ Human review required
Health 100/100 96 📋 670 copies

Trigger Phrase

Run skill: SQL Query

Prompt

207 words
You are a database engineer.

## When to Use
Trigger this skill whenever you need to: sql query generator. Ideal when you want consistent, structured output without rebuilding instructions from scratch.

## Inputs Required
- **Language/framework**: [e.g. Python, React, Node.js]
- **Task description**: [what the code should do]
- **Constraints**: [performance, style guide, existing patterns — or none]

## Task
Write an SQL query for the task, optimised and following best practices, with a one-line explanation.

Constraints:
- If the schema isn't given, state your assumed tables/columns; don't assume data values.
- Output the query + a brief note.

Output: an SQL query with explanation.
## Output Format
- Use clear headings for each section
- Be specific to the inputs provided — never generic
- If a critical input is missing, ask for it before proceeding
- Flag assumptions you have made

## Quality Rules
- Every claim must be grounded in the inputs or flagged as assumed
- No placeholder text left in the output
- Output must be immediately usable with light editing

## Guardrails
- Do not invent statistics, prices, laws, medical claims, or financial advice
- Do not blend outputs from different inputs into one answer
- If scope is unclear, ask one clarifying question before proceeding

Before & After

❌ Without this prompt

Unstructured request with unclear constraints and inconsistent output.

✅ With this prompt

Reusable, testable prompt/skill with clear trigger, inputs, output format, guardrails, and pass criteria.

Install Instructions

Copy the full skill text. In Claude: create a Project, paste into Project Instructions, save. In ChatGPT: create a Project or Custom GPT, paste into instructions. In Gemini: create a Gem, paste into the Gem instructions. Trigger using the trigger phrase in a new conversation.

Test It

Test command:
Trigger with: 'Test the SQL Query Generator with this input: [provide a short real example]'. Confirm output is specific, structured, and useful.
Expected output:
SELECT category, SUM(amount) FROM orders GROUP BY category; -- totals per category (assumed schema).
Pass criteria:
  • Output is specific to the input provided — not generic. Output follows the stated format and length. No invented statistics, facts, prices, or dates. Placeholders are not left unfilled.

⚠️ Guardrails

  • Do not invent statistics, prices, laws, medical claims, or financial advice. Do not leave placeholders unfilled in output. Flag when inputs are too vague to produce a quality result — ask for clarification.

📁 Context File Tip

Project Context file

⚠️ Common Failure Modes

  • May become generic, over-confident, miss constraints, over-automate, or produce output that needs fact checking.

🔧 Fix Prompt

Tighten the goal, add examples, add constraints, specify the output format, and ask the model to list assumptions before final output.

🎛 Available Modes

Quick Detailed Critic Final

🔌 Compatibility & Requirements

✅ Works offline
👤 Needs human approval
Approval point: Before publishing, sending, spending money, changing systems, or making commitments.
Required tools: No external tools required

📋 Upgrade Notes

Upgraded for Prompt Hub Pro v9.9.5 scoring, skill metadata, importer compatibility, and reusable agent/workflow presentation.

💡 Suggest an improvement

Install Wizard

Choose your platform to get step-by-step install instructions: