Text to SQL for Openclaw

An AI-powered skill that bridges the gap between natural language and structured database queries by translating plain English into precise, schema-validated SQL.

wangjipeng977
v1.0.0
May 29, 2026
0
281
10

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install text-to-sql-yanyu

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install text-to-sql-yanyu using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Text to SQL?

The Text to SQL skill is a highly specialized developer assistant designed to transform natural language instructions into syntactically correct SQL queries. Built to run inside your AI agent environment as part of the ecosystem of Openclaw Skills, this skill solves the fundamental problem of translating complex data questions into precise database queries. Instead of guessing syntax or manually mapping schema structures, this skill provides a robust bridge from human intent to SQL.

This skill is not an execution environment, a database designer, or an analytical visualization tool. Rather, it focuses strictly on the semantic parsing of user requests alongside an explicit database schema to draft perfectly alias-qualified and optimized SQL statements. It activates dynamically when provided with a natural language description, an active database schema, and a SQL generation request.

Text to SQL Use Cases

  • Developers wanting to draft complex queries containing JOINs, subqueries, or Common Table Expressions (CTEs) rapidly.
  • Non-technical stakeholders who understand the data they need in plain English but cannot write syntactic database queries.
  • Learning environments where users need explanations of SQL clauses alongside generated queries to master SQL semantics.
  • Teams looking to integrate automated natural-language-to-SQL workflows into their proprietary Openclaw Skills setups.

How Text to SQL Works

  1. Confirm Database Schema: The skill analyzes the input for an explicit schema (such as CREATE TABLE statements, DESCRIBE outputs, or explicit column definitions). If missing, it prompts the user to provide it to avoid hallucinated identifiers.
  2. Translate Intent to SQL Clauses: Maps specific conversational keywords (like "top N", "sum of", or "grouped by") directly to their SQL syntactic equivalents (such as LIMIT N, SUM(), or GROUP BY).
  3. Resolve Joins and Relationships: Identifies referenced tables, checks foreign key relationships, and determines the optimal JOIN types (INNER, LEFT, or RIGHT) to form cohesive queries.
  4. Generate and Validate Syntax: Produces structured SQL queries with fully qualified table aliases, ensuring they conform to target dialects (PostgreSQL, MySQL, SQLite) and validating them against the schema mapping.

Text to SQL Setup

To install and configure this skill within your AI agent, add it to your project configuration or install it via the CLI:

openclaw skills install text-to-sql

Alternatively, reference this skill directly in your agent configuration file:

skills:
  - name: text-to-sql
    source: "https://github.com/MiniMax-AI/skills"
    version: "1.0.1"

Ensure that you provide database schemas or table descriptions in your prompt context so the skill can accurately map your natural language requests to SQL structures.

Text to SQL Data Schema & Taxonomy

This skill manages metadata configuration and structures requests according to the following taxonomy:

Field Type Description
name String Must be text-to-sql
version String SemVer version (e.g., 1.0.1)
category String Set to data
license String MIT License

Prompt Configuration Mapping

When executing commands, the skill processes queries based on the following mode structures:

  • /text-to-sql: Default translation mode.
  • /text-to-sql/explain: Generates queries with inline structural explanations.
  • /text-to-sql/alternatives: Offers multiple syntactic query strategies for comparison.

Text to SQL Advanced Features

  • Dialect Specialization: Supports multiple SQL dialects including PostgreSQL, MySQL, and SQLite.
  • Interactive Schema Validation: Halts processing to request accurate schema details rather than hallucinating non-existent database tables and columns.
  • Granular Alias Qualification: Automatically enforces strict table aliasing (e.g., o.order_id) to prevent column ambiguity in multi-table joins.
  • Multiple Execution Modes: Offers comparative options like /explain and /alternatives to educate users and optimize query performance, elevating the quality of Openclaw Skills.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*