Deep Agents is an extensible agent harness that provides an out-of-the-box agent for long, multi-step tasks, with features such as planning, sub-agents, filesystem access, context management, memory, and human approval of tool calls. It is used by developers building agents with different language models, and its catalogue entries extend the harness with reusable skills, MCP servers, and instructions.
Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add langchain-ai/deepagents --skill query-writinggit clone --depth 1 https://github.com/langchain-ai/deepagentsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/langchain-ai/deepagents/query-writing)<a href="https://agentmods.dev/skills/langchain-ai/deepagents/query-writing"><img src="https://agentmods.dev/badge/skills/langchain-ai/deepagents/query-writing/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/langchain-ai/deepagents/query-writing"><img src="https://agentmods.dev/badge/skills/langchain-ai/deepagents/query-writing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- Socket pass
- Snyk pass
- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00057 | $0.00521 |
| Opus 5.5 | $0.00023 | $0.00208 |
| Sonnet 5.5 | $0.00011 | $0.00104 |
| Haiku 4.5 | $0.00006 | $0.00052 |
Grade A, and why
query-writing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
Query Writing Skill
Workflow for Simple Queries
For straightforward questions about a single table:
- Identify the table - Which table has the data?
- Get the schema - Use
sql_db_schemato see columns - Write the query - SELECT relevant columns with WHERE/LIMIT/ORDER BY
- Execute - Run with
sql_db_query - 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
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:
- Empty results — Verify column names and WHERE conditions against the schema; check for case sensitivity or NULL values
- Syntax error — Re-examine JOINs, GROUP BY completeness, and alias references
- 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)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 69 lines · 57 tokens per session scan A b88865cfc75c
query-writing is a skill published in the GitHub repository langchain-ai/deepagents (31,796 stars, last pushed today), licensed MIT. It adds 57 tokens to every session and 521 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
query-writing compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| query-writinglangchain-ai/deepagents | Skill | 32k | today | MIT | A | 57 | Claude Code, Codex |
| qdrant-clients-sdktruera/trulens | Skill | 3.7k | today | MIT | A | 28 | Claude Code, Codex |
| adding-warehouse-person-propertiesPostHog/posthog | Skill | 41k | today | none | A | 139 | Claude Code, Codex |
| setting-up-data-catalogPostHog/posthog | Skill | 41k | today | none | A | 135 | Claude Code, Codex |
| adding-warehouse-person-propertiesPostHog/posthog | Skill | 41k | today | none | A | 139 | Claude Code, Codex |
| setting-up-warehouse-propertiesPostHog/posthog | Skill | 41k | today | none | A | 126 | Claude Code, Codex |
| modeling-warehouse-foundationsPostHog/posthog | Skill | 41k | today | none | A | 227 | Claude Code, Codex |