
Write Query
Turns natural language data questions into production-ready SQL with proper CTEs, dialect-specific optimizations, and performance considerations baked in. It asks which SQL flavor you're using (Snowflake, BigQuery, Postgres, etc.) then structures queries with early filtering, appropriate joins, and partition awareness. The workflow is practical: it parses your request, discovers schema if you have a warehouse connected, writes the query with meaningful CTE names and comments, then explains each section and how to modify it. The best part is it actively avoids the usual mistakes like SELECT *, correlated subqueries where joins would work, and exploding many-to-many joins. Good for both quick aggregations and complex cohort analyses where you need someone who remembers the performance gotchas.
- skills.sh installs
- 3.1K
- GitHub stars
- 35.3K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add anthropics/knowledge-work-plugins --skill write-query --agent claude-codeInstalls into .claude/skills of the current project.
Files
/write-query - Write Optimized SQL
If you see unfamiliar placeholders or need to check which tools are connected, see CONNECTORS.md.
Write a SQL query from a natural language description, optimized for your specific SQL dialect and following best practices.
Usage
/write-query <description of what data you need>
Workflow
1. Understand the Request
Parse the user's description to identify:
- Output columns: What fields should the result include?
- Filters: What conditions limit the data (time ranges, segments, statuses)?
- Aggregations: Are there GROUP BY operations, counts, sums, averages?
- Joins: Does this require combining multiple tables?
- Ordering: How should results be sorted?
- Limits: Is there a top-N or sample requirement?
2. Determine SQL Dialect
If the user's SQL dialect is not already known, ask which they use:
Sponsors
Details
- Repository
- github.com/anthropics/knowledge-work-plugins
- Category
- Databases
- First seen
- Apr 16, 2026
More from anthropics/knowledge-work-plugins
All 198- Ticket Triage3.1K
- Meeting Briefing3.1K
- Compliance Tracking3K
- Guideline Generation3K
- Metrics Review3K
- Stakeholder Update3K
- Draft Content3K
- Email Sequence3K
- Create An Asset3K
- Discover Brand3K
- Recruiting Pipeline3K
- Enrich Lead3K
- Org Planning3K
- Call Summary3K
- Prospect2.9K
- Customer Escalation2.9K
- Change Request2.9K
- Create Cowork Plugin2.9K
- Contact Research2.9K
- Compose Outreach2.9K
- Vendor Review2.9K
- Capacity Plan2.9K
- Comp Analysis2.9K
- Cowork Plugin Customizer2.9K