anfra-aml
Write and edit AML — the declarative modeling language for models, fields, relationships, and datasets in an AMQL repo. Use whenever you need to create or change a model, dataset, relationship, or field definition.
How do I install this agent skill?
npx skills add https://github.com/holistics/anfra-skills --skill anfra-amlIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill defines a declarative modeling language and utilizes a CLI tool for database schema inspection. It identifies a potential surface for indirect prompt injection via metadata fields designed to provide context to AI agents.
- Socketpass
No alerts
- Snykfail
Risk: CRITICAL · 1 issue
What does this agent skill do?
AML modeling
AML is a declarative language for defining semantic models: the models, fields, relationships, and datasets that AQL queries run against.
Files use type-suffixed names: *.model.aml (a model), *.dataset.aml (a
dataset), and plain *.aml for shared definitions. Edit these files directly in
the repo.
References (progressive disclosure)
Load only what the task needs. Never assume AML syntax or properties — check the type definition.
references/type_definitions/*.aml— the schema for each AML block (its properties, types, defaults). Open the one you're working with:data_model.aml— models (TableModel,QueryModel) and their fields (dimension,measure,param), field types, and how to reference fields withr(...)/ref(...).dataset.aml— datasets: which models + relationships they bundle, plus dataset-leveldimensionandmetricfields.relationship.aml— relationships between models andrel_config: equality (many_to_one,one_to_one, with extraonkeys for a composite key),range(a fact row matches the row whose window contains it, such as price bands or SCD Type 2),many_to_many, andwherefilters on either side. Therelationship(a.x > b.id, true)shorthand makes a single-key equality one. Write the others in full, asRelationshipConfig { rel: RangeRelationship { ... } active: true }.persistence.aml— materializing a query model as a table (full / incremental / external).pre_aggregate.aml— pre-aggregated tables for performance.format.aml— theFormattype used by a field'sformatproperty.
references/examples/*.aml— complete worked files to pattern-match against:ecommerce_orders.model.aml(a model) anddemo_ecommerce.dataset.aml(a dataset).- The AML docs, for what these references don't cover, such as modeling patterns and how joins are generated: look it up with .
Core concepts
- Models define data. A
TableModel(type: 'table') maps to a table; aQueryModel(type: 'query') maps to a SQL query. Each hasdimensions (attributes),measures (aggregations), and optionalparams. - Reference fields with
r(...)— e.g.r(users.country)(model field),r(ecommerce.revenue)(dataset metric).r(...)is compile-time typechecked; prefer it over the legacyref('users','country'). - Relationships connect models (
froma many-side fieldtoa one-side field). AQL uses them to join automatically — you never write joins in queries. - A relationship's second argument is whether it is active:
relationship(a.x > b.id, true). An inactive one (false) is not optional, it is off: no query joins through it unless an expression enables it withwith_relationships. Mark one inactive only when it is a second route between models that already have one (a role-playing date). A metric that can only reach a dimension through an inactive relationship is not split by it: it repeats one value on every row, with no error. See and . - Datasets bundle models + relationships and expose dataset-level
metrics anddimensions. A dataset is what AQL queries target. data_source_nameon a model/dataset names a source configured in the repo's.anfra/data_sources.yml— data sources aren't defined in AML here.
Studying the data source
anfra query --lang sql runs raw SQL against a data source:
anfra query --lang sql --data-source <name> '<sql>' # -s <name> for short; SQL read from stdin when omitted
<name> is a source in .anfra/data_sources.yml. Use it only to study the source schema (tables, columns,
types) and a high-level data profile (row counts, cardinality, null rates, value
ranges, key uniqueness) so you can model the data in AML more accurately and
effectively — e.g. pick the right primary key, field types, and relationship
direction. Never use it to answer data questions; those go through AQL against a
dataset ().
Best practices
- Always define a model's primary key — mark the identifying
dimensionwithprimary_key: true. Relationships and correct aggregation rely on it. - Prefer AQL definitions; only fall back to raw SQL when referencing #SOURCE columns.
- Define relationships between the models you query so AQL can join them automatically — never hand-write joins.
Workflow
- Model first. Create/extend the
*.model.aml: settype,data_source_name,table_name(orquery), and define itsdimensions andmeasures. Checkdata_model.amland the model example for exact syntax. - Relationships. Define relationships between the models you'll join.
- Dataset. Create/extend the
*.dataset.aml: list themodelsandrelationships, and add any cross-model dataset-levelmetrics. - Validate with — run
anfra validate(whole repo, or specific files) and fix any diagnostics. - Query the dataset with .
Related skills
- — AQL knowledge (field/metric definitions are AQL).
- — write and run queries against a dataset.
- — validate AML/AQL before relying on it.
anfra skills 0.22.0
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/holistics/anfra-skills/anfra-aml">View anfra-aml on skillZs</a>