query-writing

Construct and execute SQL queries with schema examination and task planning.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires sqlalchemy, psycopg2, and includes scripts (resource) and references (resource) components.

What problem does it solve?

The Skill addresses the problem of manually crafting SQL queries, offering an efficient and structured approach to querying databases for various tasks.

Core Features & Use Cases

  • Single and Multi-Table Queries: Handles queries involving single and complex multi-table JOINs.
  • Complex SQL Tasks: Manages complex aggregations, ordering, and limiting results.
  • Task Planning and Schema Examination: Utilizes write_todos for breaking down complex tasks and examines schemas with sql_db_schema.
  • Execution and Formatting: Executes SQL commands and formats responses to ensure clarity.
  • Use Case: A research team needs to retrieve specific data from multiple databases, and with this skill, they can easily plan the tasks, execute queries, and get organized responses.

Quick Start

Execute a query to find all orders made in the year 2020.

Frequently Asked Questions about query-writing

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

FAQPage Schema
How do I automate multi-table SQL queries for database interaction?

Automating multi-table SQL queries involves using structured instructions to break down tasks and examine schemas. You can construct and execute complex JOINs by planning with task lists and retrieving data across different database tables.

What is the best way to handle complex SQL aggregations and ordering?

Handling complex SQL aggregations requires automating query construction to manage aggregations, ordering, and limiting results. By examining schemas and planning tasks, you can execute commands and format responses to ensure clarity.

Do I need SQLAlchemy and psycopg2 to execute SQL queries?

Yes, you need SQLAlchemy and psycopg2 dependencies to execute SQL queries with this skill. These libraries provide the underlying database interaction and automation framework required for constructing and running commands.

Can I use query automation for administrative database workflows?

Query automation is designed for administrative workflows dealing with database interactions and data retrieval. It helps teams plan tasks, execute queries, and get organized responses across multiple databases.

How does schema examination work for complex database queries?

Schema examination for complex database queries works by utilizing schema tools to understand table structures. This allows the query automation process to accurately construct multi-table JOINs and retrieve specific data.

What are the limitations of automating SQL query construction?

Automating SQL query construction depends on clear schema understanding and task breakdown. Complex aggregations and multi-table JOINs require structured planning to ensure accurate database interaction and execution.