
Description
query-writing is an agent skill from the langchain-ai deepagents project, listed on skills.sh. It writes and runs SQL queries, from simple SELECT statements to complex multi-table joins, aggregations and subqueries. The page gives two workflows. For a straightforward question about one table, the agent identifies the table, reads its schema with the sql_db_schema tool, writes a SELECT with the right columns and any WHERE, LIMIT or ORDER BY clauses, runs it with sql_db_query, and presents the results clearly. For a question that needs several tables, it follows a longer workflow in the same spirit, working out the joins from the schema before writing the query. The skill is for analysts and developers who ask questions of a database in plain language and want the agent to produce and run a correct query, checking the schema first rather than guessing column names. The listing shows Gen Agent Trust Hub, Socket and Snyk all as Pass.…
Highlights
- Simple SELECT and complex joins
- Reads the schema before writing
- Runs queries with the SQL tools
- Presents results clearly
Ratings & Reviews
No ratings yet
Be the first to rate query-writing.
People also visit

postgres-patterns
PostgreSQL database patterns for query optimization, schema design, indexing

database-migrations
Safe, reversible database migration patterns: forward-only production changes

jpa-patterns
JPA/Hibernate patterns for entity design, relationships, query optimization
query-writing FAQ
What does the query-writing skill do?
It writes and runs SQL queries for a database, from simple selects to multi-table joins and aggregations.
How do I install it?
Run: npx skills add https://github.com/langchain-ai/deepagents --skill query-writing
Does it check the schema first?
Yes. For simple queries it reads the table's schema with sql_db_schema before writing the query.
Which tools does it use?
The sql_db_schema tool to read the schema and sql_db_query to run the query.
Has it been checked for security?
skills.sh lists three audits: Gen Agent Trust Hub Pass, Socket Pass and Snyk Pass.
What are the best query-writing alternatives?
Popular alternatives to query-writing include clickhouse-io, mysql-patterns and postgres-patterns. See all query-writing alternatives







