agentscope-examples/harness-examples/harness-quickstart/src/main/resources/workspace/skills/query-writing/SKILL.md
Writes and executes SQL queries ranging from simple single-table SELECTs to complex multi-table JOINs, aggregations, window functions, and subqueries. Use when the user asks to query the database, retrieve data, filter records, rank results, or generate reports.
npx skillsauth add agentscope-ai/agentscope-java query-writingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use query-writing when the user:
sql_get_schema to confirm column names.sql_execute_query.SELECT COUNT(*) AS canadian_customers
FROM Customer
WHERE Country = 'Canada';
Break the query into subtasks:
- [ ] Identify all required tables
- [ ] Inspect schemas to find join columns
- [ ] Draft the JOIN structure
- [ ] Add aggregations and grouping
- [ ] Validate and run
Call sql_get_schema for EACH table involved to find the exact foreign key column names.
SELECT
<grouping columns>,
<aggregates>
FROM <primary table>
[INNER | LEFT] JOIN <table2> ON <fk> = <pk>
[JOIN ...]
WHERE <filters>
GROUP BY <non-aggregate columns>
HAVING <post-aggregation filters> -- optional
ORDER BY <sort column> [DESC]
LIMIT 10; -- always limit unless all rows requested
Before executing, verify:
Call sql_execute_query, then show:
SELECT
Artist.Name AS artist,
SUM(InvoiceLine.UnitPrice * InvoiceLine.Quantity) AS total_revenue
FROM Artist
JOIN Album ON Album.ArtistId = Artist.ArtistId
JOIN Track ON Track.AlbumId = Album.AlbumId
JOIN InvoiceLine ON InvoiceLine.TrackId = Track.TrackId
GROUP BY Artist.ArtistId, Artist.Name
ORDER BY total_revenue DESC
LIMIT 10;
SELECT
strftime('%Y-%m', InvoiceDate) AS month,
ROUND(SUM(Total), 2) AS monthly_revenue
FROM Invoice
WHERE strftime('%Y', InvoiceDate) = '2013'
GROUP BY month
ORDER BY month;
SELECT
e.FirstName || ' ' || e.LastName AS employee,
COUNT(c.CustomerId) AS customer_count
FROM Employee e
LEFT JOIN Customer c ON c.SupportRepId = e.EmployeeId
GROUP BY e.EmployeeId
ORDER BY customer_count DESC;
| Symptom | Action | |----------------------|--------| | Empty result | Check WHERE condition values (case-sensitive strings). Verify column exists. | | Syntax error | Re-read schema. Check GROUP BY includes all non-aggregate SELECT columns. | | Wrong row count | Look for duplicate rows caused by missing JOIN conditions. | | Result seems too high | Check for fan-out from multiple JOINs; may need DISTINCT or subquery. |
LIMIT (default 10) unless the user explicitly asks for all rows.e, c, inv) for readability in multi-table queries.SELECT * — name the columns you need.ROUND(SUM(Total), 2).tools
Expert Java developer skill for AgentScope Java framework - a reactive, message-driven multi-agent system built on Project Reactor. Use when working with reactive programming, LLM integration, agent orchestration, multi-agent systems, or when the user mentions AgentScope, ReActAgent, Mono/Flux, Project Reactor, or Java agent development. Specializes in non-blocking code, tool integration, hooks, pipelines, and production-ready agent applications.
documentation
四层技能合成、技能市场、自学习闭环
documentation
Four-layer skill composition, skill marketplaces, the self-learning loop
content-media
Use when the user asks for a summary, TL;DR, or condensed version of any content.