将自然语言数据需求转成高质量 SQL,并按方言优化复杂查询性能。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "write-query" 技能: 1. 下载 https://raw.githubusercontent.com/anthropics/knowledge-work-plugins/main/data/skills/write-query/SKILL.md 2. 保存为 ~/.claude/skills/write-query/SKILL.md 3. 装好后重载技能,告诉我可以用了
请用 BigQuery SQL 编写查询:统计过去 90 天每个渠道的订单数、总收入和平均客单价,只包含已支付订单,按收入降序排序,并使用清晰的 CTE 结构。
一条结构清晰的 BigQuery SQL,包含时间过滤、分组聚合、排序及最佳实践写法。
下面这条 Snowflake SQL 查询运行很慢,请重写并说明优化点:涉及 3 张大表 join,按月汇总活跃用户,尽量减少扫描数据量,并考虑分区裁剪和过滤下推。
优化后的 Snowflake SQL,以及针对扫描量、过滤顺序、CTE 与聚合策略的说明。
把这段 Postgres SQL 改写成适用于 Snowflake 的版本,保留原有逻辑,并处理日期函数、字符串拼接和空值处理的方言差异。
一条可在 Snowflake 使用的等价 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.
/write-query <description of what data you need>
Parse the user's description to identify:
If the user's SQL dialect is not already known, ask which they use:
Remember the dialect for future queries in the same session.
If a data warehouse MCP server is connected:
Follow these best practices:
Structure:
daily_signups, active_users, revenue_by_product)Performance:
SELECT * in production queries -- specify only needed columnsEXISTS over IN for subqueries with large result setsReadability:
a, b, c)Dialect-specific optimizations:
sql-queries skill for details)Provide:
If a data warehouse is connected, offer to run the query and analyze the results. If the user wants to run it themselves, the query is ready to copy-paste.
Simple aggregation:
/write-query Count of orders by status for the last 30 days
Complex analysis:
/write-query Cohort retention analysis -- group users by their signup month, then show what percentage are still active (had at least one event) at 1, 3, 6, and 12 months after signup
Performance-critical:
…
围绕客户问题进行多来源调研与溯源,快速整理背景并支持准确回复。
用 SQL 统一查询、编排并运维云与 SaaS 资源及其 API。