SQL Query Writer
Draft one read-only SQL query grounded in a supplied schema and dialect.
Get SQL, bound parameters, assumptions and a safe validation plan.
Free · 2 KB · SKILL.md, instructions and example files. Provide the database dialect and schema. Database execution requires your existing authorization.
A worked example
A small example to try before using your own data.
Input
{
"dialect": "PostgreSQL",
"schema": "orders(id int primary key, customer_id int, total_cents int, status text)",
"request": "Paid revenue per customer, highest first"
}Expected result
{
"sql": "SELECT customer_id, SUM(total_cents) AS revenue_cents FROM orders WHERE status = $1 GROUP BY customer_id ORDER BY revenue_cents DESC, customer_id;",
"parameters": [
"paid"
],
"execution": "Not run against a database"
}What to check: Use only supplied identifiers; preserve cents as integers; parameterize status; include deterministic tie ordering.
Limits: A plausible query is not a verified report. Permission checks, performance and tenant filters must be confirmed against the actual database.
Worked example included. Model-specific performance and vendor compatibility have not been benchmarked.
🧠 Why it works
Use only supplied identifiers; preserve cents as integers; parameterize status; include deterministic tie ordering.
⚙️ How it works
- Read table definitions, keys, nullability and the intended reporting grain. Ask for a missing join key rather than inventing it.
- Map each requested metric to its source and aggregation. Check join cardinality before summing money or counts.
- Write a single SELECT or read-only CTE using bound parameters. Keep identifiers fixed from the schema.
- Check syntax with the available dialect parser or EXPLAIN in an authorized read-only session. Report when no database check ran.
- Show a tiny input/output example and call out null handling, timezone and duplicate-row risks.
Description
Get SQL, bound parameters, assumptions and a safe validation plan.
Provide the database dialect and schema. Database execution requires your existing authorization.
Limits: A plausible query is not a verified report. Permission checks, performance and tenant filters must be confirmed against the actual database.
Recommended Use
Sign in to suggestTools and workflow packs this skill pairs well with. Forge picks are auto-generated from category + capability signals; Community picks are added by people who've used the pairing.
Forge Auto-recommended matches
Tools
-
Lovable transform 30%
Why: caps 0/0 · domain code · io-match
-
Cody (Sourcegraph) transform 30%
Why: caps 0/0 · domain code · io-match
-
Windsurf transform 30%
Why: caps 0/0 · domain code · io-match
-
Replit AI transform 30%
Why: caps 0/0 · domain code · io-match
-
GitHub Copilot transform 30%
Why: caps 0/0 · domain code · io-match
-
Cursor transform 30%
Why: caps 0/0 · domain code · io-match
-
Tabnine transform 30%
Why: caps 0/0 · domain code · io-match
Report compatibility
Tell the community which tool you used this skill with, and whether it worked.
Suggest a pairing
Recommend a tool or workflow pack that this skill works well with. Up to 5 recommendations per day.