aql-authoring — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited aql-authoring (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
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.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")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.
AQL queries operate on archetypes. Before writing a query:
ckm_template_search → ckm_template_get) rather than guessing pathsckm_archetype_search when the archetype id is not yet known) ckm_archetype_get("<archetype-id>")type_specification_get to clarify RM type details when neededSELECT <paths>
FROM EHR e
CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.<name>.v1]
CONTAINS OBSERVATION o[openEHR-EHR-OBSERVATION.<name>.v1]
WHERE <conditions>
ORDER BY <paths>Define the archetype hierarchy using CONTAINS:
FROM EHR e
CONTAINS COMPOSITION c
CONTAINS OBSERVATION o[openEHR-EHR-OBSERVATION.blood_pressure.v2]Navigate archetype structure using at-codes:
o/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitudeFilter by patient:
FROM EHR e[ehr_id/value = $ehr_id]When one archetype node repeats as multiple named runtime siblings, add the name to the node predicate (spec-defined shortcuts):
items[at0001, 'Systolic'] -- name/value shortcut
items[at0001 and name/value='Systolic'] -- explicit form
items[at0001, $nameValue] -- parameterizedFROM EHR e
CONTAINS VERSION v[LATEST_VERSION]
CONTAINS COMPOSITION cAlways state [LATEST_VERSION] or [ALL_VERSIONS] explicitly — the no-predicate default is not defined by the spec (implementations commonly return latest only). Version predicates are grammar-level constructs; consult the aql/syntax guide for semantics, engine caveats, and the common v/… projections.
MATCHES with a {…} value list is spec-normative — prefer it for code-set filters; IN is not in the spec (engine extension). LIKE patterns must match the entire value. Details and edge cases in the aql/syntax guide.
Use $parameter syntax for reusable queries:
WHERE o/data[at0001]/events[at0006]/time/value > $start_dateSELECT c
FROM EHR e[ehr_id/value = $ehr_id]
CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.encounter.v1]
ORDER BY c/context/start_time/value DESC
LIMIT 1SELECT o/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude AS systolic
FROM EHR e[ehr_id/value = $ehr_id]
CONTAINS COMPOSITION c
CONTAINS OBSERVATION o[openEHR-EHR-OBSERVATION.blood_pressure.v2]
WHERE c/context/start_time/value >= $start_date
AND c/context/start_time/value <= $end_dateSELECT
COUNT(o) AS count,
AVG(o/data[at0001]/events[at0006]/data[at0003]/items[at0004]/value/magnitude) AS avg_systolic
FROM EHR e
CONTAINS COMPOSITION c
CONTAINS OBSERVATION o[openEHR-EHR-OBSERVATION.blood_pressure.v2]
GROUP BY e/ehr_id/valueSpec-normative aggregates: COUNT, MIN, MAX, SUM, AVG (COUNT/MIN/MAX are the safest across engines). For the spec's single-row function list — and what counts as an engine extension — consult the aql/syntax guide before relying on a function; engine coverage varies.
CONTAINS OBSERVATION o)SELECT * — select only needed pathsRun through the AQL checklist:
guide_get("openehr://guides/aql/checklist")Verify:
MATCHES {…} used instead of engine-only IN; functions beyond COUNT/MIN/MAX verified against the target engine[LATEST_VERSION] / [ALL_VERSIONS] explicitly~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.