anfra-write-aql
Installation
SKILL.md
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.
Sub-agent or inline?
Prefer writing the AQL yourself. You can instead hand it to a sub-agent — an aql-writer sub-agent if available, otherwise a generic one told to use the anfra-aql, anfra-write-aql, and anfra-validate-aql skills. It does the lookups, writes and validates, and returns only the final AQL. Decide per task:
- Do it inline (the default) when you've already read the AQL references this session (a sub-agent re-reads them every time it starts), when it's a small edit to an existing query, or when the work needs back-and-forth with the user or depends on surrounding decisions.
- Delegate only when several independent queries can be written in parallel, or when the session is long and keeping the AQL references out of your context matters.
- Always inline when no sub-agent is available (e.g. Codex), or when you are the sub-agent.
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.