Skills
sqlGen
Natural language → SQL with dialect awareness + safety rails.
import { sqlGen } from '@agentskit/skills'
import { postgres } from '@agentskit/tools'
const runtime = createRuntime({
adapter,
skills: [sqlGen],
tools: [...postgres({ run, readonly: true, maxRows: 100 })],
})
await runtime.run('How many users signed up last 7 days vs the previous 7 days?')When to reach for it
- Data Q&A agent over a SQL DB.
- Dashboard copilots.
- Schema-aware natural-language querying.
Behavior
- Asks for schema if none provided; remembers in session.
- Emits parameterized queries with explicit
LIMIT. - Flags risky statements (
DROP,UPDATEwithout WHERE) and refuses by default. - Dialect-aware: SQLite / Postgres / MySQL / DuckDB.
Tools it expects
postgresQueryorsqliteQueryTool(issue #433).readonly: trueby default. See postgres integration.
Safety
- Always run readonly first. Opt-in to writes via a separate, gated tool.
- Cap results with
maxRows. LLMs loveSELECT *— protect from OOM.
Related
- Skills overview
- Issue #449 — sqlAnalystSkill (sibling).