跳到正文
cccskills
免费在 GitHub 公开

query-writing

Write the SQL or MongoDB query that answers a question and keeps answering it: the right grain, no fan out, parameterised window, checked against something known. Use when a number is needed that no report carries, when an existing query returns something that looks wrong, when a query is slow or expensive, or when somebody asks for a one off pull.

中文简介正在准备中。当前显示原文说明。

集成工具MongoDB
查看安装方法

包含的文件(1)

  • SKILL.md2.7 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Query writing

Goal

A query that returns the right rows today and the same rows next month, saved somewhere it can be found instead of rewritten.

Procedure

  1. Get the question before writing anything. What is being counted, over what window, at what grain, with which exclusions. A query written from a one line request answers a question nobody asked.
  2. Check whether it already exists. A saved query in memory/queries/, an existing report, a definition in memory/conventions/metrics.md. Rewriting an existing metric slightly differently is exactly how two reports end up disagreeing.
  3. Establish the grain and the key. Which table or collection is one row per what, and which key is genuinely unique. In MongoDB, check whether the document shape is consistent across the collection, because it usually is not and the exceptions are where the wrong count comes from.
  4. Write it to be re-run. Parameterise the window, name the columns rather than selecting everything, and avoid a wide scan you do not need. Explore with a limit, then remove it, since a limit caps rows returned and not work done.
  5. Check the fan out. If the row count exceeds the distinct entity count, a join or an unwind is multiplying rows and every total after it is inflated. This is the defect that survives review because the output looks plausible.
  6. Sanity check the answer against something known before handing it over: an existing report, a manual count on one slice you can verify by hand, last period's figure.
  7. Save it with the question it answers written next to it, in memory/queries/.

Boundaries

  • Never run a write, an update or a delete against production data to answer a question.
  • Never hand over a number without its window, its filters and its source.
  • Never compute a metric that already has a definition in a different way. Use the definition, or change it deliberately and say so.
  • Estimate the cost of a heavy scan before running it.
  • Never leave a one off query only in a chat message. It will be asked for again.

What to record

Save the query in memory/queries/ with the question it answers and the date. When the query establishes or settles a metric definition, write that to memory/conventions/metrics.md with its numerator, denominator, window and source, so the next person computes it the same way.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Plan or review software architecture through a small expert panel. Use when the user explicitly asks for architecture planning, system design, technical strategy, an architecture assessment, a design review, or a system health review. Do not use for ordinary PR review, debugging, or implementation.

中文简介正在准备中。当前显示原文说明。

nanocoai/nanoclaw-templates202026年9月16日 更新

Thorough, consistently formatted competitor and product research. Produces a structured "About" doc, a "Recent News" log, and a row in a tracking spreadsheet. Use whenever the user researches a company or competitor, builds or updates a competitor doc, compares products, or logs a competitor to the tracker.

中文简介正在准备中。当前显示原文说明。

nanocoai/nanoclaw-templates202026年9月16日 更新

Household assistant for a whole family. Runs a morning brief, plans meals and builds grocery lists (hunting the best prices), looks ahead at the week's logistics, stays on top of the kids' school, watches prices on things the family wants, and helps book appointments and reservations. Use it for anything that keeps the family's day or week running. Trigger even on implicit asks - "what's on today", "what do the kids have this week", "what should we make for dinner", "add milk to the list", "when's the dentist", "did anything come from school", "remind me about the permission slip", "watch this jacket and tell me if it drops", "book us a table Friday".

中文简介正在准备中。当前显示原文说明。

nanocoai/nanoclaw-templates202026年9月16日 更新

Reporting workflow for a working journalist, using web research and Apify's X scraper (social signals). Onboards the journalist, monitors their beat and builds digests, evaluates story pitches, finds and vets sources, and prepares interviews. Use for any newsroom task, such as "what's new on my beat", "is this pitch any good", "who should I talk to about X", "prep me for this interview", or "turn these notes into a draft".

中文简介正在准备中。当前显示原文说明。

nanocoai/nanoclaw-templates202026年9月16日 更新

Check that the scheduled data work behind the reports actually ran and produced something sensible: the daily reshaping scripts, the API pulls, the tables the reports read from. Use each morning before anyone opens a report, when a report looks wrong and nobody knows whether it is the data or the query, after a schema or API change, when a new audience or source is added to the pipeline, or when a scheduled job failed or finished suspiciously fast.

中文简介正在准备中。当前显示原文说明。

nanocoai/nanoclaw-templates202026年9月16日 更新

Stand up reporting for a new audience — an external client, a business unit, a region, an executive team — end to end: what they need to see, whether the data exists, access and scoping, their place in the pipeline, the standard report set, and validation against numbers they can check themselves. Use when a new audience is onboarded, when an existing one adds a site, a region or a business unit, when their reporting is rebuilt after a change on their side, or when they say the numbers do not match their own records.

中文简介正在准备中。当前显示原文说明。

nanocoai/nanoclaw-templates202026年9月16日 更新

查看 nanocoai 的全部技能

报告此技能的问题