query-writing

Convert natural-language questions into executable SQL SELECT statements.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you turn a question about your database into a correct, readable SQL query and the resulting answer.

Core Features & Use Cases

  • Guided SQL query authoring: Translates requirements into SELECT queries with clear structure, appropriate JOINs, and sensible constraints.
  • Schema-first execution workflow: Uses the database schema to choose columns, filters, and join keys before running the query.
  • Safety and quality guardrails: Encourages selecting only relevant columns, using a LIMIT by default, and avoiding DML statements like INSERT/UPDATE/DELETE/DROP.
  • Simple-to-complex coverage: Supports both single-table queries and multi-table JOIN + aggregation tasks (including GROUP BY/ORDER BY).

Quick Start

Ask the agent to write a SQL query that answers your question using the available schema and to execute it, returning a clearly formatted result with a small default row limit.

Frequently Asked Questions about query-writing

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

FAQPage Schema
How do I write a SQL query from a natural language question?

To write a SQL query from natural language, the system inspects your database schema to validate columns and join keys, then constructs a SELECT statement with filtering, grouping, and limits. It translates your text requirements into executable SQL and returns the formatted result.

Can I use natural language to write multi-table SQL JOINs and aggregations?

Yes, natural language can generate multi-table SQL JOINs and aggregations. The schema-first workflow validates join keys and applies GROUP BY logic to translate complex requirements into executable SELECT statements for practical result sets.

Does this SQL query writer support INSERT, UPDATE, or DELETE statements?

No, this SQL query writer does not support INSERT, UPDATE, or DELETE statements. It enforces strict safety guardrails that disallow all DML operations, focusing exclusively on generating safe SELECT queries with a default row limit to retrieve data.

What is the best way to ensure SQL query safety and avoid retrieving too many rows?

The best way to ensure SQL query safety is to enforce guardrails that disallow DML operations and select only relevant columns. The schema-first execution workflow applies a default LIMIT to your SELECT statements, preventing excessive row retrieval.

How does schema inspection work before constructing a SQL query?

Schema inspection works by analyzing the existing database structure to identify valid columns, data types, and relationships before constructing a SQL query. This schema-first approach ensures accurate JOIN key validation and correct GROUP BY logic in the final SELECT statement.

Do I need an existing database schema to generate and execute SQL queries?

Yes, an existing database schema is required to generate and execute SQL queries. The system relies on schema inspection to choose appropriate columns, filters, and join keys before validating the query logic and running it via SQL execution.