← ClaudeAtlas

aql-authoringlisted

This skill should be used when the user asks to "write an AQL query", "optimize an AQL query", "review AQL", or "query openEHR data" — the multi-step authoring/optimization workflow for AQL (Archetype Query Language) over openEHR clinical data. For a one-off explanation of an existing query or a single AQL keyword/operator (no authoring), the `/openehr-explain` command suffices.
Cadasto/openehr-assistant-plugin · ★ 4 · AI & Automation · score 78
Install: claude install-skill Cadasto/openehr-assistant-plugin
# AQL Authoring > The inline syntax below is a quick crib. The `aql/syntax` guide loaded in Step 1 is authoritative — if they ever disagree, follow the guide. ## Step 1: Load Guides (MANDATORY) Before writing or reviewing any AQL query, load the authoritative guides: ``` guide_get("openehr://guides/aql/principles") guide_get("openehr://guides/aql/syntax") guide_get("openehr://guides/aql/idioms-cheatsheet") ``` ### Consult worked examples (when applicable) When the user asks for a query to adapt, or when the clinical question matches a common pattern (cohort selection, pagination with total count, time-window filtering, cross-composition joins, terminology value-set matching, "latest per EHR", ISM-state filtering), try `examples_search(kind="aql")` before drafting. The curated AQL examples are under `openehr://examples/aql/{name}` and include pattern metadata and related-spec links — reuse and adapt rather than invent. Skip this step if the question is clearly novel or the user already provided the skeleton. ## Step 2: Understand the Data Model AQL queries operate on archetypes. Before writing a query: 1. State assumptions about deployed templates/archetypes — verify path endpoints and RM types against the deployed template, not display labels; when a deployed template is named, fetch it (`ckm_template_search` → `ckm_template_get`) rather than guessing paths 2. Identify which archetypes contain the required data (`ckm_archetype_search` when the archetype id is not yet