# text-to-sql

text-to-sql turns a plain-language request into a SQL query, checked against your database schema and built with placeholders instead of inlined values.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 158 installs · ★ 45 repo stars
- Author: oimiragieo
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/oimiragieo/agent-studio/tree/HEAD/.claude/skills/text-to-sql/SKILL.md
- Updated: 2026-07-14
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/text-to-sql

## What it does

Give it a question in ordinary words and the skill breaks the request down, checks names against your schema, writes the SQL and validates the syntax. No script ships with it: the whole thing is agent instructions, so it runs in the context of the `sonnet` model and reads files with `Read`, `Write`, `Grep` and `Glob`.

You bring the schema. Identifiers get checked against whatever you put in context, and with nothing there the validation has nothing to compare. Values arrive as placeholders (`?` or `$N`), `SELECT` statements carry `LIMIT 100` unless you say otherwise, and `DROP`, `DELETE`, `TRUNCATE` or `UPDATE` sit waiting for your confirmation.

The repository also carries an evaluation path through promptfoo: a config such as `text_to_sql_config.yaml` plus `npx promptfoo@latest eval -c text_to_sql_config.yaml`. The guidance leans on sample queries, and on step-by-step reasoning once a query gets hard.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill text-to-sql -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/text-to-sql/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/text-to-sql/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill text-to-sql -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/text-to-sql/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill text-to-sql -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/text-to-sql/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install oimiragieo/agent-studio .claude/skills/text-to-sql
```

2. **Manually: put the files in place**
- File: `.github/skills/text-to-sql/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill text-to-sql -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/oimiragieo/agent-studio --path .claude/skills/text-to-sql
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/text-to-sql/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill text-to-sql -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/oimiragieo/agent-studio/tree/HEAD/.claude/skills/text-to-sql/SKILL.md

## When to use it
- turn a plain-language request into runnable SQL
- join `orders` and `products` to get revenue per item
- spot duplicate rows in a table
- check query syntax before it touches live data
- compare prompt variants with promptfoo

## Example prompts
- Write the SQL for every user who signed up in the past month.
- Build a query joining `orders` and `products` for revenue per product in Q4.
- Find duplicate rows in `users`, keep a `LIMIT`, and walk me through what the query does.

## Similar
- [sql-pro](https://affpapa.org/en/nevibecode/skills/httpsgithubcomjeffallan-sql-pro.md) — skill · 6900 installs
- [sql-best-practices](https://affpapa.org/en/nevibecode/skills/sql-best-practices.md) — skill · 845 installs
- [sql-database-assistant](https://affpapa.org/en/nevibecode/skills/borghei-sql-database-assistant.md) — skill · 100 installs
- [sql-object-impact-analysis](https://affpapa.org/en/nevibecode/skills/sql-object-impact-analysis.md) — skill · 26 installs
- [SQL Query Builder & Optimiser](https://affpapa.org/en/nevibecode/prompts/sql-query-builder-optimiser.md) — prompt · ★ 178201 repo stars
- [sql-expert](https://affpapa.org/en/nevibecode/agents/sql-expert.md) — subagent · ★ 1029 repo stars

From the same set: [oimiragieo/agent-studio](https://affpapa.org/en/nevibecode/by/oimiragieo/agent-studio.md) — 8 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
