aql-authoring

aql-authoring is a skill for Claude Code from Cadasto/openehr-assistant-plugin. It costs 102 tokens per session (1,785 once invoked), scanned A, original, MIT.

A guide for writing and improving AQL queries. AQL, or Archetype Query Language, is used to search clinical information stored in openEHR electronic health records.

In plain words
What is it for?
Use it to write, optimize, or review an AQL query for tasks such as finding patient groups, filtering records by time, or retrieving the latest data.
Why use it?
It helps turn a clinical question into a query that fits the available data definitions and follows the required syntax. It also helps avoid common errors when filtering, joining, paginating, or finding the latest records.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the openehr-assistant plugin — 8 skills, 3 commands, 3 agents, 2 hooks, 1 MCP server shipped together

Good fit Use it to write, optimize, or review an AQL query for tasks such as finding patient groups, filtering records by time, or retrieving the latest data.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cadasto/openehr-assistant-plugin/aql-authoring
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Cadasto/openehr-assistant-plugin --skill aql-authoring
Clone the repo
git clone --depth 1 https://github.com/Cadasto/openehr-assistant-plugin

Made for: Claude Code.

Or install openehr-assistant, the plugin that ships this one along with the rest of its 8 skills, 3 commands, 3 agents, 2 hooks, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for aql-authoring

README.md
[![agentmods](https://agentmods.dev/badge/skills/cadasto/openehr-assistant-plugin/aql-authoring/github.svg)](https://agentmods.dev/skills/cadasto/openehr-assistant-plugin/aql-authoring)
Your own site
<a href="https://agentmods.dev/skills/cadasto/openehr-assistant-plugin/aql-authoring"><img src="https://agentmods.dev/badge/skills/cadasto/openehr-assistant-plugin/aql-authoring/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for aql-authoring

Your own site · 80×15
<a href="https://agentmods.dev/skills/cadasto/openehr-assistant-plugin/aql-authoring"><img src="https://agentmods.dev/badge/skills/cadasto/openehr-assistant-plugin/aql-authoring.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 102 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,785 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00102 $0.01785
Opus 5 $0.00051 $0.00892
Sonnet 5 $0.00020 $0.00357
Haiku 4.5 $0.00010 $0.00178

Measured 10d ago against content hash 1bbf49f49264, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

aql-authoring scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/aql-authoring/SKILL.md · 171 lines

How it starts

The opening of the file, as written. The whole thing — 171 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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_searchckm_template_get) rather than guessing paths
  2. Identify which archetypes contain the required data (ckm_archetype_search when the archetype id is not yet known)
  3. Load the archetype to understand its path structure:
    ckm_archetype_get("<archetype-id>")
    
  4. Use type_specification_get to clarify RM type details when needed

Step 3: AQL Syntax

Basic Structure

SELECT <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>

Containment

Define the archetype hierarchy using CONTAINS:

FROM EHR e
  CONTAINS COMPOSITION c
    CONTAINS OBSERVATION o[openEHR-EHR-OBSERVATION.blood_pressure.v2]

Read the full file on GitHub · 171 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 171 lines · 102 tokens per session scan A 1bbf49f49264

Subscribe to this mod's changes

aql-authoring is a skill published in the GitHub repository Cadasto/openehr-assistant-plugin (4 stars, last pushed 15d ago), licensed MIT. It adds 102 tokens to every session and 1,785 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.