query-writing

Executes read-only SQL queries with automatic joins, aggregations, and sensible limits for data exploration and analysis.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps users quickly compose, validate, and run SQL queries to answer data questions without writing unsafe or inefficient SQL, reducing time spent exploring schemas and debugging joins.

Core Features & Use Cases

  • Schema-aware query composition: Inspect table schemas to select only the necessary columns and identify join keys.
  • Support for simple and complex queries: Handle single-table lookups, multi-table JOINs, aggregates, GROUP BY and ORDER BY logic.
  • Safe execution guidelines: Prefer read-only SELECT queries, always apply sensible LIMITs (default 5), and avoid destructive DML statements.
  • Use case: Calculate top revenue-generating countries by joining invoices and customer tables and aggregating totals.

Quick Start

Write and run a read-only SQL query that joins the Invoice and Customer tables to compute total revenue by country and return the top five results.

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 to join multiple tables and aggregate data?

To write SQL queries for multi-table joins and aggregations, inspect table schemas to identify join keys, then construct SELECT statements with JOINs, GROUP BY, and ORDER BY clauses to aggregate relational data accurately.

What is the safest way to execute SQL queries for data analysis?

The safest way to execute SQL queries for data analysis is using read-only SELECT statements with sensible LIMIT clauses, avoiding destructive DML operations to prevent accidental data modification during schema validation and reporting.

How do I inspect database schemas before writing a complex SQL query?

Inspecting database schemas before writing complex SQL queries involves examining available tables and columns to select necessary fields and identify correct join conditions, ensuring accurate data retrieval and aggregation for analysis.

Can I calculate aggregated totals like revenue by country using SQL joins?

Yes, you can calculate aggregated totals like revenue by country by joining customer and invoice tables on their shared keys, then applying GROUP BY and aggregation functions to summarize relational data for reporting.

What are the limitations of using SQL for single-table lookups and reporting?

Limitations of using SQL for single-table lookups and reporting include the strict requirement for clear join conditions in multi-table scenarios and the necessity of read-only execution capabilities to safeguard against destructive DML operations.