3.1 · Pull the authoritative grammar
The deployment ships the same instruction sets the product’s agent uses. Discover and fetch them — don’t guess trigger names:Prompt
You’ll see: the complete .tql language reference — file layout, the params grammar, fragment functions, and a “rejected forms” table of the mistakes everyone makes. Keep it open while authoring.
3.2 · The guardrails that save you an hour
| You’ll try | The language wants |
|---|---|
metrics: Set<"a"|"b"> = ["a"] | Set defaults may only be [] — handle the empty case in the body with isEmpty |
concatSep(", ", frags) | Application syntax, no parens/commas: concatSep ", " frags |
matchSet as a function | It’s syntax: matchSet metrics { "label" -> sql"...", } (arrow arms; trailing comma allowed here only) |
'${param}' in SQL | Unquoted ${param} — the renderer handles quoting; IN ${list} adds parens |
'' inside a sql''…'' body | No adjacent single quotes there — put quoted SQL literals in sql"…" fragments |
3.3 · The authoring loop
- Write the file (params block →
letbindings → onesql''…''body ending in an explicitLIMIT). - Execute it against a live connector with real parameters. Not “it parses” — it returns correct rows.
- Reconcile one number against a raw-SQL computation of the same thing before you call it done.
✅ Checkpoint
- You fetched writing-tql from your own deployment and used its rejected-forms table
- Your .tql executed against a live connector with parameters
- One output number reconciled against an independent raw-SQL computation