write-aql
Writing AQL to answer a question
Goal: turn the user's analytics request into a correct AQL query, verify it, and run it.
AQL is not SQL. Writing it from SQL habits or memory produces wrong queries and burns validate→fix cycles. Read the references before you write — not after you fail. Looking things up first is faster than guessing and retrying.
Prefer delegating to a sub-agent (to save context). Reading the AQL references consumes context. If an
aql-writersub-agent is available, hand the request to it and let it do the lookups + write/validate/run — it returns only the final AQL and result, keeping your main context lean. Otherwise, if your runtime has a generic task/subagent tool, spawn one and tell it to use theaql,write-aql, andvalidate-aqlskills. (If you are theaql-writersub-agent, ignore this and do the work yourself.)
Prerequisites
- Work inside an AMQL repo. Discover the available datasets/models/fields — that's your
dataset_fields. Use only those models and fields, with their EXACT names. - Have
anfraavailable to validate and run queries.