nl-to-sql-agent

Convert natural language questions into executable SQL queries for Excel and PostgreSQL.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/yjzaaa/Nl_tosql_agent --skill nl-to-sql-agent
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nl-to-sql-agent
Source: https://github.com/yjzaaa/Nl_tosql_agent/tree/main
Command: npx skills add https://github.com/yjzaaa/Nl_tosql_agent --skill nl-to-sql-agent

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill turns natural language questions into executable SQL queries, enabling users to query Excel and PostgreSQL data sources without writing SQL themselves.

Core Features & Use Cases

  • Natural language to SQL conversion across multiple data sources
  • LangGraph-based DAG workflow: Intent Analysis, Load Context, SQL Generation, Validation, Execution, Result Review, and Visualization guidance
  • Local LLM support and extensible Skill system for domain knowledge
  • Use cases include ad-hoc data exploration, KPI reporting, and multi-source data analysis

Quick Start

Invoke the NL-to-SQL Agent to translate a natural language question into SQL and run it against your configured data sources.

Frequently Asked Questions about nl-to-sql-agent

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert natural language into SQL queries for PostgreSQL?

To convert natural language into SQL queries for PostgreSQL, you use an agent that orchestrates intent analysis, SQL generation, validation, and execution to translate your questions into executable queries.

Can I generate SQL from natural language for Excel workbooks?

Yes, you can generate SQL from natural language for Excel workbooks. The agent supports Excel data sources by loading context and executing generated queries to retrieve data directly from your spreadsheets.

What is the process for natural language to SQL generation using LLMs?

Natural language to SQL generation using LLMs involves a LangGraph-based DAG workflow that sequentially processes intent analysis, context loading, SQL generation, validation, execution, and result refinement to ensure accurate query outputs.

Does the NL-to-SQL workflow support local LLMs?

Yes, the natural language to SQL workflow supports local LLMs. It uses a pluggable system to load domain knowledge and a LangGraph DAG to orchestrate the query generation and execution pipeline locally.

How do you validate SQL queries generated from natural language?

To validate SQL queries generated from natural language, the workflow enforces safety rules via a dedicated SQL validation step that occurs after generation and before execution to prevent invalid or unsafe database commands.

What are the limitations of using natural language for SQL generation?

Limitations of natural language SQL generation include potential misinterpretation of complex intents and the need for specific domain knowledge. The agent mitigates this by loading context and enforcing validation rules before query execution.