Install the "xpath-constraints" agent skill from https://github.com/mendixlabs/mxcli/tree/main/.claude/skills/mendix/xpath-constraints into .claude/skills/xpath-constraints/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "xpath-constraints", then confirm the skill loads.
Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
Type this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
skills CLI
$ npx skills add mendixlabs/mxcli --skill xpath-constraints -a codex
Project install goes to .agents/skills/; add -g for ~/.codex/skills/.
Install the "xpath-constraints" agent skill from https://github.com/mendixlabs/mxcli/tree/main/.claude/skills/mendix/xpath-constraints into .agents/skills/xpath-constraints/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "xpath-constraints", then confirm the skill loads.
Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
skills CLI
$ npx skills add mendixlabs/mxcli --skill xpath-constraints -a cursor
Project install goes to .agents/skills/; add -g for ~/.cursor/skills/.
Install the "xpath-constraints" agent skill from https://github.com/mendixlabs/mxcli/tree/main/.claude/skills/mendix/xpath-constraints into .cursor/skills/xpath-constraints/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "xpath-constraints", then confirm the skill loads.
Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
skills CLI
$ npx skills add mendixlabs/mxcli --skill xpath-constraints -a gemini-cli
Project install goes to .agents/skills/; add -g for ~/.gemini/skills/.
Install the "xpath-constraints" agent skill from https://github.com/mendixlabs/mxcli/tree/main/.claude/skills/mendix/xpath-constraints into .gemini/skills/xpath-constraints/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "xpath-constraints", then confirm the skill loads.
Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
Installs for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
skills CLI
$ npx skills add mendixlabs/mxcli --skill xpath-constraints -a github-copilot
Project install goes to .agents/skills/; add -g for ~/.copilot/skills/.
Install the "xpath-constraints" agent skill from https://github.com/mendixlabs/mxcli/tree/main/.claude/skills/mendix/xpath-constraints into .github/skills/xpath-constraints/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "xpath-constraints", then confirm the skill loads.
GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
skills CLI
$ npx skills add mendixlabs/mxcli --skill xpath-constraints -a opencode
OpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
Install the "xpath-constraints" agent skill from https://github.com/mendixlabs/mxcli/tree/main/.claude/skills/mendix/xpath-constraints into .opencode/skills/xpath-constraints/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "xpath-constraints", then confirm the skill loads.
OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
Facts
Skill name
xpath-constraints
GitHub stars
128
Token cost
~3.9k tokens
SKILL.md length
1,358 words
Files
1
Skills in repo
72
Repo updated
First seen
Licence
Apache-2.0
At a glance
XPath constraint syntax for MDL — retrieve WHERE clauses, page data sources, and row-level entity access, including association paths and functions.
Works in 3 steps: Check the value key (not caption) — the… → Keys are case-sensitive: 'open' ≠ 'Open'. → Confirm the attribute type is actually…
Debugging any XPath in a project
SKILL.md covers When to Use This Skill, XPath vs Mendix Expressions, Syntax Reference and How a Constraint Is Laid Out…, plus 5 more sections
Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
What it does
Xpath Constraints is an agent skill from mendixlabs/mxcli. XPath constraint syntax for MDL — retrieve WHERE clauses, page data sources, and row-level entity access, including association paths and functions. Use when writing or debugging any XPath in a project.
Its SKILL.md is about 3.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Development. The repository describes itself as: Mendix cli tool, a headless way to work with Mendix projects. Enables Mendix projects for use with 3rd party agentic coding tools like Claude Code and Copilot. Includes a… The licence is Apache-2.0.
When your agent uses it
Debugging any XPath in a project
Example prompts
“/xpath-constraints”
Workflow steps
3 steps, taken from the first numbered list in SKILL.md.
1Check the value key (not caption) — the key is what's stored in the DB column. Check with DESCRIBE ENUMERATION Module.EnumName.
2Keys are case-sensitive: 'open' ≠ 'Open'.
3Confirm the attribute type is actually an enumeration and not a string — DESCRIBE ENTITY Module.EntityName.
What it can do on your machine
Read from SKILL.md and the folder at commit 20a6c89. It shows what the files ask for, not the result of running them.
Tool permissions
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Runs code
No scripts in the folder and no shell commands in SKILL.md (its code samples are mdl and bash).
From the folder's file list and the shell code blocks in SKILL.md.
Network
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Credentials
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Context cost
Xpath Constraints loads about 3.9k tokens when it runs. Until then it costs about 55 tokens; SKILL.md has 1,358 words of instructions outside code blocks.
Always· name and description, kept in context so the agent knows when to use it
~55
When it runs· the whole SKILL.md, loaded when a task matches
~3.9k
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
Safety
Auto-check passed
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
Download SKILL.mdSave it as .claude/skills/xpath-constraints/SKILL.md (or your agent's skills folder).
name
xpath-constraints
description
XPath constraint syntax for MDL — retrieve WHERE clauses, page data sources, and row-level entity access, including association paths and functions. Use when writing or debugging any XPath in a project.
XPath Constraints in MDL
This skill provides reference for writing XPath constraint expressions in MDL RETRIEVE statements, page data sources, and security rules.
When to Use This Skill
Writing retrieve ... where [xpath] statements in microflows
Writing database from entity where [xpath] in page data sources
Writing grant ... where 'xpath' for row-level entity access
Debugging XPath parsing or serialization issues
XPath vs Mendix Expressions
Critical distinction: XPath constraints (inside [...]) use different syntax from Mendix expressions (in SET, IF, DECLARE, etc.):
Feature
XPath [...]
Mendix Expression
Path separator
/ (always path traversal)
/ (also division)
Boolean ops
lowercase: and, or, not()
and, or, not
Negation
not(expr) function
not expr
Empty check
= empty, != empty
= empty
Token quoting
'[%CurrentUser%]' (quoted)
[%CurrentUser%] (unquoted)
Nested filter
Assoc/entity[pred]
Not applicable
Arithmetic on value
not supported — pre-compute into a variable
+, -, *, div, mod
XPath constraints cannot compute values.where [Seq = $Game/MoveSeq + 1]
is a parse error (Mendix XPath has no arithmetic on the value side). Compute the
value first, then compare against the variable:
mdl
declare $Next integer = $Game/MoveSeq + 1;
retrieve $M from Mod.Move where [Seq = $Next] first;
mxcli check explains this and shows the workaround when it sees +/*/div/
mod inside a constraint.
A negative literal is fine, though. A leading - on a number is a value,
not arithmetic, and needs no quoting:
mdl
retrieve $L from Mod.T where [Amount > -7];
retrieve $L from Mod.T where [Amount <= -12.5 and Code != 'X'];
Date arithmetic is not available in XPath.addDays(), addMonths() and
friends are Mendix expression functions — using one in a constraint fails the
build with CE0161 regardless of its arguments. For relative dates use the
date tokens ([%CurrentDateTime%], [%BeginOfCurrentDay%], …), or compute the
cut-off in a variable first and compare against that:
mdl
declare $Cutoff datetime = addDays([%CurrentDateTime%], -7);
retrieve $L from Mod.T where [DueDate > $Cutoff];
Syntax Reference
Simple Comparisons
mdl
retrieve $Orders from Module.Order
where [State = 'Completed'];
retrieve $Active from Module.Customer
where [IsActive = true];
retrieve $Recent from Module.Order
where [OrderDate != empty];
retrieve $HighValue from Module.Order
where [TotalAmount >= $MinAmount];
Operators: =, !=, <, >, <=, >=
Inline vs quoted form. The inline bracket form where [State = 'Completed']
is preferred. The quoted form — where '[State = ''Completed'']', with internal
single quotes doubled ('') — is also accepted for retrieve and datasource
where clauses, and now stores the identical constraint (it un-escapes the ''
and strips the outer quotes). Don't double-bracket: write either [...] or
'[...]', not both.
Boolean Logic
mdl
-- AND
where [State = 'Completed' and IsPaid = true]
-- OR
where [State = 'Pending' or State = 'Processing']
-- Grouped
where [State = 'Completed' and ($IgnorePaid or IsPaid = true)]
-- NOT
where [not(IsPaid)]
where [not(contains(Name, 'demo'))]
How a Constraint Is Laid Out on Disk
MDL keeps a constraint on one line; how it is stored is decided by mxcli, not
by the whitespace you type. A constraint is rebuilt from its parse tree on every
write, so there is no original formatting to keep — instead the layout is derived
from the expression:
80 columns or fewer → stored exactly as written, on one line. This is the
common case, and it means adding this changed nothing about existing projects.
Longer → broken at its top-level and/or joints, one clause per line,
the operator leading each continuation line. Where and and or meet, the
and runs get explicit parentheses — Mendix binds and tighter, and a filter
is being broken up precisely because it had stopped being obvious at a glance.
Nothing to break on (one long comparison, one long association path) →
left whole and over width. Cutting it anywhere else would not be valid XPath.
-- authored (one line, 141 characters)
where [Archived = false and Status = 'Open' and Priority = 'High' and Category = 'Electrical' and Severity > 3 and ReportedOn > '[%BeginOfCurrentDay%]']
-- stored, and what Studio Pro's XPath editor shows
[
Archived = false
and Status = 'Open'
and Priority = 'High'
and Category = 'Electrical'
and Severity > 3
and ReportedOn > '[%BeginOfCurrentDay%]'
]
DESCRIBE puts it back on one line, so a description reads the way it always
has and re-executing it re-derives the same stored text — the unit is reported
Unchanged. A constraint mxcli cannot parse is stored exactly as given rather
than reformatted.
This applies to page datasources, retrieve … where in microflows, and entity
access rules alike.
Association Path Traversal
Bare association paths (without $variable prefix) navigate through the domain model:
mdl
-- Single-hop: filter by associated object
where [Module.Order_Customer = $Customer]
-- Multi-hop: traverse through associations
where [Module.Order_Customer/Module.Customer/Name = $CustomerName]
-- Existence check: has an associated object
where [Module.Order_Customer/Module.Customer]
-- Negated existence: has NO associated object
where [not(Module.Order_Customer/Module.Customer)]
Rule: Always use the fully qualified association name (Module.AssociationName).
A bare association name is now caught before the build (MDL-XPATH01).[Order_Customer = $currentUser] used to pass mxcli check --references, get
written by exec, and only fail at the build with "Error(s) in XPath
constraint" (CE0161) — which is the expensive shape, because exec cannot
roll back and stops with the model half-updated. check now names the
association and the qualified spelling to use instead. It fires only when the
bare name is not an attribute of the constrained entity and is a known
association, so attributes stay bare and XPath functions are never touched.
= empty / != empty do not work on associations (CE0161 / MDL047).empty tests attribute nullability only. To test whether an object has no
associated object, use negated existence: [not(Module.Order_Customer/Module.Customer)]
— not[Module.Order_Customer = empty]; to test that it has one, the path
itself: [Module.Order_Customer/Module.Customer] — not!= empty.
mxcli check flags both forms as MDL047 before the build does.
Variable Paths
mdl
-- Compare attribute via variable path
where [Module.Assoc/Module.Entity/Name = $Variable/Name]
-- Variable on right side
where [Name = $currentObject/SearchString]
Nested Predicates
Filter intermediate path steps with inline [predicate]:
mdl
-- Only lines of completed orders
where [Module.OrderLine_Order/Module.Order[State = 'Completed']]
-- Nested predicate with further traversal
where [Module.OrderLine_Order/Module.Order[State = 'Active']/Module.Order_Category/Module.Category/Name = $CategoryName]
-- reversed() path modifier (traverse association in reverse direction)
where [System.grantableRoles[reversed()]/System.UserRole/System.UserRoles = '[%CurrentUser%]']
Functions
mdl
-- String search
where [contains(Name, $SearchStr)]
where [starts-with(Name, $Prefix)]
where [not(contains(Name, 'demo'))]
-- Boolean functions
where [IsActive = true()]
where [Displayed = false()]
The expression functions startsWith() / endsWith() are not XPath: in a
constraint they are CE0161, and check reports them as MDL091. So is an
operator inside a function argument — starts-with(Name, 'MS-' + $Key) is
CE0161 although Name = 'X-' + $Key is fine: compute the value into a variable
first (declare $P String = 'MS-' + $Key;, then starts-with(Name, $P)). A member the
entity does not have is a reference error in check -p, and so is a system
member written the way describe prints the attribute: XPath spells it
createdDate, changedDate, owner, changedBy — [CreatedDate > …] is CE0161.
Show full SKILL.md (513 more words)Show less
Tokens
Mendix tokens provide runtime values. In an XPath constraint a token used as a
value is stored quoted as '[%Token%]' (Studio Pro requires this, or it reports
CE0161). mxcli quotes it for you whether you write the bare or quoted form:
mdl
-- Both store identically as '[%CurrentDateTime%]' and pass mx check
where [OrderDate < [%CurrentDateTime%]]
where [OrderDate < '[%CurrentDateTime%]']
where [System.owner = '[%CurrentUser%]']
Tokens are typed.[%CurrentUser%] is a User reference — compare it only
to an association to System.User (e.g. System.owner), never to a String/other
attribute ([Title = '[%CurrentUser%]'] is a type error → CE0161).
[%CurrentDateTime%] compares to DateTime attributes, etc.
System.owner / System.changedBy must be enabled on the entity before you
can reference them in XPath, or Studio Pro reports CE0161. Enable with
alter entity Module.Entity add attribute owner: autoowner; (mxcli's
check --references flags this). Same for changedBy/changedDate/createdDate.
Common tokens: [%CurrentUser%], [%CurrentDateTime%], [%CurrentObject%], [%UserRole_RoleName%], [%DayLength%]
ID Pseudo-Attribute
The id pseudo-attribute compares object identity (GUID):
mdl
where [id = $currentUser]
where [id != $existingObject]
where [id = '[%CurrentUser%]']
Usage Contexts
RETRIEVE in Microflows
mdl
retrieve $Results from Module.Entity
where [IsActive = true and State = 'Ready']
sort by Name asc
limit 100;
The expression inside [...] is parsed as XPath and stored in BSON as the XpathConstraint field.
Page Data Sources
mdl
datagrid dg (
datasource: database from Module.Entity where [State != 'Cancelled'] sort by Name asc
) {
column (attribute: Name, caption: 'Name')
}
Multiple bracket constraints can be chained. Consecutive brackets without an operator are treated as AND (standard Mendix XPath):
mdl
-- Consecutive brackets (implicit AND) — standard Mendix XPath syntax
datasource: database from Module.Entity where [IsActive = true][Stock > 0]
-- Explicit AND: same result
datasource: database from Module.Entity where [IsActive = true] and [Stock > 0]
-- Mix with OR: combines into single bracket
datasource: database from Module.Entity where [IsActive = true] or [Stock > 10]
GRANT Entity Access (Security)
Security rules take the XPath in brackets, like every other XPath, so quotes
inside it are written once:
mdl
mdl 1;
grant read *, write * on entity Module.Entity to Module.Role
where [System.owner = '[%CurrentUser%]'];
Sibling groups (where [a][b]) are kept as one constraint. The old quoted form
grant Module.Role on Module.Entity (...) where '[...]' still parses, warns
MDL-DEPR030, and mxcli fmt --upgrade rewrites it.
Enumeration Attributes
Critical: XPath constraints are translated to database SQL WHERE clauses at runtime. The database stores enum values as plain strings (the value key), not qualified names. This means:
[Status = 'Open'] — always valid: direct string literal match
[Status = Module.OrderStatus.Open] — also valid: mxcli converts to 'Open' in BSON automatically
Both forms are accepted by mxcli in the write direction. DESCRIBE MICROFLOW always shows the qualified name form for readability, even though BSON stores 'Open'.
Do NOT use qualified names in expression context (IF, SET, DECLARE) for comparisons — those contexts use a different form. See write-microflows "Enumeration Comparisons" section.
mdl
-- Preferred (mxcli converts to 'Open' in BSON):
retrieve $OpenOrders from Module.Order
where [Status = Module.OrderStatus.Open];
-- Also accepted (stored as-is):
retrieve $OpenOrders from Module.Order
where [Status = 'Open'];
-- NOT equal
retrieve $Active from Module.Order
where [Status != Module.OrderStatus.Cancelled];
-- OR across multiple enum values
retrieve $InProgress from Module.Order
where [Status = Module.OrderStatus.Open or Status = Module.OrderStatus.Processing];
-- Enum combined with other predicates
retrieve $Results from Module.Order
where [Status = Module.OrderStatus.Completed and TotalAmount >= $MinAmount];
Troubleshooting silent empty results with enums
If a RETRIEVE returns empty unexpectedly when filtering by an enum attribute:
Check the value key (not caption) — the key is what's stored in the DB column. Check with DESCRIBE ENUMERATION Module.EnumName.
Keys are case-sensitive: 'open' ≠ 'Open'.
Confirm the attribute type is actually an enumeration and not a string — DESCRIBE ENTITY Module.EntityName.
Common Patterns
Parameterized Search
mdl
mdl 1;
create microflow Module.Search ($query: string, $ActiveOnly: boolean)
returns boolean
begin
retrieve $Results from Module.Customer
where [($ActiveOnly = false or IsActive = true)
and (contains(Name, $query) or contains(Email, $query))];
return true;
end;
Date Range Filter
mdl
retrieve $Orders from Module.Order
where [OrderDate >= $StartDate and OrderDate <= $EndDate];
Optional Filters (empty = skip)
mdl
retrieve $Orders from Module.Order
where [($Category = empty or Module.Order_Category = $Category)
and ($State = empty or State = $State)];
Owner-Based Security
mdl
-- In microflow
retrieve $MyItems from Module.Item
where [System.owner = '[%CurrentUser%]'];
-- In security rule
grant read * on entity Module.Item to Module.User where [System.owner = '[%CurrentUser%]'];
Xpath Constraints next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.
Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.
Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.
Iteratively improves a PR (GitHub), MR (GitLab), or shelved changelist (Perforce) until Greptile gives it a 5/5 confidence score with zero unresolved comments.
Push OData query options into the SQL of a Mendix resource served by a read microflow, so $filter, $orderby, $top, $skip, $count and the key lookup reach the database instead of being silently…
Chart a Mendix app with Vega-Lite through a pluggable widget that takes the specification and the data as separate properties, so the model emits rows and never assembles a chart payload.
XPath constraint syntax for MDL — retrieve WHERE clauses, page data sources, and row-level entity access, including association paths and functions. Xpath Constraints is an agent skill from mendixlabs/mxcli. XPath constraint syntax for MDL — retrieve WHERE clauses, page data sources, and row-level entity access, including association paths and functions.
When should I use Xpath Constraints?
Xpath Constraints fits situations like: debugging any XPath in a project.
How do I install Xpath Constraints in Claude Code?
Run `npx skills add mendixlabs/mxcli --skill xpath-constraints -a claude-code`. Or copy the skill folder (.claude/skills/mendix/xpath-constraints in mendixlabs/mxcli) into .claude/skills/xpath-constraints in your project. Claude Code loads it when a task matches its description.
How do I install Xpath Constraints in Codex?
Run `npx skills add mendixlabs/mxcli --skill xpath-constraints -a codex`. Or copy the skill folder (.claude/skills/mendix/xpath-constraints in mendixlabs/mxcli) into .agents/skills/xpath-constraints in your project. Codex loads it when a task matches its description.
Can I use Xpath Constraints in Cursor, Gemini CLI or GitHub Copilot?
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mendixlabs/mxcli --skill xpath-constraints -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/xpath-constraints, .gemini/skills/xpath-constraints, .github/skills/xpath-constraints and .opencode/skills/xpath-constraints in your project.
What does Xpath Constraints need to run?
SKILL.md names no scripts, command-line tools or credentials: Xpath Constraints is instructions for the agent only.
Does Xpath Constraints access the network?
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Is Xpath Constraints safe to install?
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
What licence does Xpath Constraints use?
Xpath Constraints is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
How many tokens does Xpath Constraints use?
About 3.9k tokens (SKILL.md is roughly 16k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
What are the alternatives to Xpath Constraints?
Skills that share tags, products or a category with Xpath Constraints: Vercel Composition Patterns (supabase/supabase, 111k stars), Finishing a Development Branch (obra/superpowers, 296k stars), Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars) and PR Babysitter (openinterpreter/openinterpreter, 69k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
Who maintains Xpath Constraints?
mendixlabs (a GitHub organization) maintains it in mendixlabs/mxcli, which has 128 GitHub stars. The repository holds 72 skills in this directory. The repository was last updated on October 7, 2026.
Source: mendixlabs/mxcli on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.