query-writing

Generate and execute SQL queries from user intent with schema inspection.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/coinvest518/deepagents-LANGCLAW --skill query-writing-coinvest518
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: query-writing
Source: https://github.com/coinvest518/deepagents-LANGCLAW/tree/main/examples/text-to-sql-agent/skills/query-writing
Command: npx skills add https://github.com/coinvest518/deepagents-LANGCLAW --skill query-writing-coinvest518

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writes and executes SQL queries from simple SELECTs to complex multi-table JOINs, aggregations, and subqueries. Use when the user asks to query a database, write SQL, run a SELECT statement, retrieve data, filter records, or generate reports from database tables.

Core Features & Use Cases

  • Generate SQL queries for single or multiple tables with appropriate JOINs and WHERE clauses.
  • Validate schemas (via introspection) and support aggregations, sorting, and subqueries.
  • Use Case: Retrieve revenue by country or customer across joined tables to generate reports.

Quick Start

Instruct the AI to generate and run a SQL query to retrieve the latest 5 orders from the Orders table.

Frequently Asked Questions about query-writing

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

FAQPage Schema
How do I write SQL queries for multi-table joins and aggregations?

Write SQL queries for multi-table joins by generating statements with appropriate JOINs, WHERE clauses, and aggregations from user intent. The skill constructs deterministic queries across schemas to retrieve data and generate reports.

Can I generate SQL from natural language to retrieve data from a database?

Generate SQL from natural language by translating user intent into SELECT statements. The skill writes and executes queries from simple single-table lookups to complex subqueries to retrieve database records.

Does this query generator validate database schemas before running?

The query generator validates database schemas via introspection before running. This ensures deterministic query construction by inspecting the schema to confirm table structures and column names before executing the SQL statement.

What is the best way to retrieve revenue by country across joined database tables?

Retrieve revenue by country across joined tables by generating SQL queries with multi-table JOINs and aggregations. The skill supports generating reports by filtering records and sorting data across different database schemas.

How to run a SELECT statement to filter records and generate reports?

Run a SELECT statement to filter records by instructing the skill to generate and execute the query. It applies to simple lookups or complex aggregations, ensuring clear result presentation for your database reports.