Four-example few-shot prompt for turning natural-language questions into SQL against a provided schema. Uses PostgreSQL syntax; includes an aggregation, a join, and a filter example.
npx mdskills install mdskills/sql-generation-few-shotRelated
Instruction + example input/output pairs
@mdskills? Sign in with GitHub to claim this listing.Given the schema below, translate the natural-language question into a single PostgreSQL query. Do not include commentary.
Schema: {schema}
Example 1: Question: How many orders were placed last month? SQL: SELECT COUNT(*) FROM orders WHERE created_at >= date_trunc('month', now() - interval '1 month') AND created_at = '2026-01-01' AND created_at < '2027-01-01' GROUP BY month ORDER BY month;
Now translate: Question: {question} SQL:
Install via CLI
npx mdskills install mdskills/sql-generation-few-shotNatural Language to SQL (few-shot) is a free, open-source AI agent skill. Four-example few-shot prompt for turning natural-language questions into SQL against a provided schema. Uses PostgreSQL syntax; includes an aggregation, a join, and a filter example.
Install Natural Language to SQL (few-shot) with a single command:
npx mdskills install mdskills/sql-generation-few-shotThis downloads the skill files into your project and your AI agent picks them up automatically.
Natural Language to SQL (few-shot) works with Claude Code, Openai, Gemini. Skills use the open SKILL.md format which is compatible with any AI coding agent that reads markdown instructions.