query-writing
Writes and executes SQL queries from simple SELECTs to complex multi-table JOINs, aggregations, and subqueries.
Skill by langchain-aiOfficial
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/langchain-ai-query-writing
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, data, writing, agent-building, database-access
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/query-writing
What's inside
- Skill name
query-writing- Description
- Writes and executes SQL queries from simple SELECTs to complex multi-table JOINs, aggregations, and subqueries. Use when the user asks to query a database, write SQL, run a SELECT statement, retrieve data, filter records, or generate reports from database tables.
- License
- MIT
- Instructions
- 65 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Query Writing Skill
## Workflow for Simple Queries
For straightforward questions about a single table:
1. **Identify the table** - Which table has the data?
2. **Get the schema** - Use `sql_db_schema` to see columns
3. **Write the query** - SELECT relevant columns with WHERE/LIMIT/ORDER BY
4. **Execute** - Run with `sql_db_query`
5. **Format answer** - Present results clearly
## Workflow for Complex Queries
For questions requiring multiple tables:
### 1. Plan Your Approach
**Use `write_todos` to break down the task:**
- Identify all tables needed
- Map relationships (foreign keys)
- Plan JOIN structure
- Determine aggregations
### 2. Examine Schemas
Use `sql_db_schema` for EACH table to find join columns and needed fields.
### 3. Construct Query
- SELECT - Columns and aggregates
- FROM/JOIN - Connect tables on FK = PK
- WHERE - Filters before aggregation
- GROUP BY - All non-aggregate columns
- ORDER BY - Sort meaningfully
- LIMIT - Default 5 rows
### 4. Validate and Execute
Check all JOINs have conditions, GROUP BY is correct, then run query.
## Example: Revenue by Country
```sql
SELECT
c.Country,
ROUND(SUM(i.Total), 2) as TotalRevenue
FROM Invoice i
INNER JOIN Customer c ON i.CustomerId = c.CustomerId
GROUP BY c.Country
ORDER BY TotalRevenue DESC
LIMIT 5;
```
## Error Recovery
If a query fails or returns unexpected results:
1. **Empty results** — Verify column names and WHERE conditions against the schema; check for case sensitivity or NULL values
2. **Syntax error** — Re-examine JOINs, GROUP BY completeness, and alias references
3. **Timeout** — Add stricter WHERE filters or LIMIT to reduce result set, then refine
## Quality Guidelines
- Query only relevant columns (not SELECT *)
- Always apply LIMIT (5 default)
- Use table aliases for clarity
- For complex queries: use write_todos to plan
- Never use DML statements (INSERT, UPDATE, DELETE, DROP)From langchain-ai/deepagents, MIT.
More from langchain-ai/deepagents
- 0.875score
deepagents-thread-inspector
langchain-aiOfficial
Inspect and explain conversations in the local Deep Agents Code SQLite session store.
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.872score
configuration-hardening
langchain-aiOfficial
Review Talon tool placement and defensive prompts when requested or when adding or changing tools or subagents; apply confirmed changes and verify active…
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.870score
skill-creator
langchain-aiOfficial
Guide for creating effective skills that extend agent capabilities with specialized knowledge, workflows, or tool integrations.
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.869score
schema-exploration
langchain-aiOfficial
Lists tables, describes columns and data types, identifies foreign key relationships, and maps entity relationships in a database.
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.869score
remember
langchain-aiOfficial
Review the current conversation and capture valuable knowledge — best practices, coding conventions, architecture decisions, workflows, and user feedback —…
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.869score
gpu-document-processing
langchain-aiOfficial
Use when processing large PDFs, document collections, or bulk text extraction tasks that benefit from GPU-accelerated processing.
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.869score
web-research
langchain-aiOfficial
Searches multiple web sources, synthesizes findings, and produces cited research reports using delegated subagents.
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.869score
social-media
langchain-aiOfficial
Drafts engaging social media posts, writes hooks, suggests hashtags, creates thread structures, and generates companion images.
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.869score
langgraph-docs
langchain-aiOfficial
Fetches and references LangGraph Python documentation to build stateful agents, create multi-agent workflows, and implement human-in-the-loop patterns.
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.869score
arxiv-search
langchain-aiOfficial
Searches arXiv for preprints and academic papers, retrieves abstracts, and filters by topic.
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.869score
data-visualization
langchain-aiOfficial
Use for creating publication-quality charts and multi-panel analysis summaries.
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.869score
cuml-machine-learning
langchain-aiOfficial
Use for GPU-accelerated machine learning on tabular data using NVIDIA cuML.
SkillAFreshness: A★ 30.6KClaude Code +9
Compare and alternatives
Featured in
Signals
- Stars
- 30,550
- Forks
- 4,302
- Open issues
- 163
- Last commit (this folder)
- Mar 17, 2026 (7 months ago)
- Last release
- Oct 23, 2026 (3 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/langchain-ai/deepagents
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from langchain-ai
- 0.875score
deepagents-thread-inspector
langchain-aiOfficial
Inspect and explain conversations in the local Deep Agents Code SQLite session store.
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.872score
configuration-hardening
langchain-aiOfficial
Review Talon tool placement and defensive prompts when requested or when adding or changing tools or subagents; apply confirmed changes and verify active…
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.870score
skill-creator
langchain-aiOfficial
Guide for creating effective skills that extend agent capabilities with specialized knowledge, workflows, or tool integrations.
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.869score
social-media
langchain-aiOfficial
Drafts engaging social media posts, writes hooks, suggests hashtags, creates thread structures, and generates companion images.
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.869score
schema-exploration
langchain-aiOfficial
Lists tables, describes columns and data types, identifies foreign key relationships, and maps entity relationships in a database.
SkillAFreshness: A★ 30.6KClaude Code +9 - 0.869score
web-research
langchain-aiOfficial
Searches multiple web sources, synthesizes findings, and produces cited research reports using delegated subagents.
SkillAFreshness: A★ 30.6KClaude Code +9
Cite this page
query-writing skill. Agent Mart. https://agentmart.dev/skills/langchain-ai-query-writing (last updated 2026-10-24)