Agent skill

Patterns Data Processing

by mendixlabs in mendixlabs/mxcli

Patterns for loops, aggregates, batch processing and list transformation — including which retrieve source is legal where, and why nested loops are the wrong tool.

Apache-2.0Auto-check passedData & Analytics

Install Patterns Data Processing

skills CLI
$ npx skills add mendixlabs/mxcli --skill patterns-data-processing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mendixlabs/mxcli patterns-data-processing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mendixlabs/mxcli.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/mendix/patterns-data-processing .claude/skills/patterns-data-processing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
patterns-data-processing
GitHub stars
128
Token cost
~2.9k tokens
SKILL.md length
587 words
Files
1
Skills in repo
72
Repo updated
First seen
Licence
Apache-2.0

At a glance

Patterns for loops, aggregates, batch processing and list transformation — including which retrieve source is legal where, and why nested loops are the wrong tool.

  • Works in 6 steps: Commit inside loops carefully: Can cause… → Use batch commits: Commit every N… → Log progress: Add logging for… → …
  • A microflow processes a list
  • SKILL.md covers Loop Patterns, Retrieve by Association, Aggregate Patterns and List Operations, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Patterns Data Processing is an agent skill from mendixlabs/mxcli. Patterns for loops, aggregates, batch processing and list transformation — including which retrieve source is legal where, and why nested loops are the wrong tool. Use when a microflow processes a list, merges data, or does anything in bulk.

Its SKILL.md is about 2.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 Data & Analytics, covering Data pipelines and ETL. 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

  • A microflow processes a list
  • Does anything in bulk

Example prompts

  • “Use the patterns-data-processing skill to pattern for loops, aggregates, batch processing and list transformation — including which retrieve source…”
  • “/patterns-data-processing”

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Commit inside loops carefully: Can cause performance issues on large sets
  2. Use batch commits: Commit every N records for large datasets
  3. Log progress: Add logging for long-running operations
  4. Handle errors gracefully: Don't let one bad record stop the whole process
  5. Return counts: Help callers know what was processed
  6. Use meaningful variable names: $ProcessedCount not $c

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 sql).

    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

Patterns Data Processing loads about 2.9k tokens when it runs. Until then it costs about 67 tokens; SKILL.md has 587 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~67
When it runs · the whole SKILL.md, loaded when a task matches
~2.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.

SKILL.md

The full file from mendixlabs/mxcli at commit 20a6c89, republished under its Apache-2.0 licence (© mendixlabs). 587 words, ~2,877 tokens.

Download SKILL.mdSave it as .claude/skills/patterns-data-processing/SKILL.md (or your agent's skills folder).
name
patterns-data-processing
description
Patterns for loops, aggregates, batch processing and list transformation — including which retrieve source is legal where, and why nested loops are the wrong tool. Use when a microflow processes a list, merges data, or does anything in bulk.

Data Processing Patterns

Patterns for loops, aggregates, batch processing, and data transformation.

Loop Patterns

Basic Loop
mdl
mdl 1;
/**
 * Process all items in a list
 */
create microflow Module.ProcessItems (
  $Items: list of Module.Item
)
returns boolean
begin
  declare $ProcessedCount integer = 0;

  loop $item in $Items
  begin
    -- Process each item
    change $item (ProcessedDate = [%CurrentDateTime%]);
    commit $item;
    set $ProcessedCount = $ProcessedCount + 1;
  end loop;

  log info node 'Processing' 'Processed ' + $ProcessedCount + ' items';
  return true;
end;
Loop with Filtering
mdl
mdl 1;
/**
 * Process only active items
 */
create microflow Module.ProcessActiveItems (
  $Items: list of Module.Item
)
returns integer
begin
  declare $count integer = 0;

  loop $item in $Items
  begin
    if $item/IsActive then
      -- Process active item
      change $item (LastProcessed = [%CurrentDateTime%]);
      commit $item;
      set $count = $count + 1;
    end if;
  end loop;

  return $count;
end;
Loop with Accumulator
mdl
mdl 1;
/**
 * Calculate total value of all orders
 */
create microflow Module.CalculateOrderTotal (
  $Orders: list of Module.Order
)
returns decimal
begin
  declare $Total decimal = 0;

  loop $Order in $Orders
  begin
    set $Total = $Total + $Order/Amount;
  end loop;

  return $Total;
end;

Retrieve by Association

Use retrieve $list from $Parent/Module.AssociationName to retrieve related objects via association instead of a database XPath query. This is required for:

  • Non-persistent entities (NPEs) — database XPath queries always return empty for NPEs
  • Uncommitted objects — objects not yet committed to the database
  • JSON mapping results — imported data structures held in memory
Persistent Entity Example
mdl
mdl 1;
/**
 * Get all orders for a customer via association
 */
create microflow Module.GetCustomerOrders (
  $Customer : Module.Customer
)
returns list of Module.Order
begin
  retrieve $Orders from $Customer/Module.Order_Customer;
  return $Orders;
end;
Non-Persistent Entity Example (NPE)
mdl
mdl 1;
/**
 * Process imported rows from an in-memory result object.
 * Database RETRIEVE would return empty for NPEs — use association retrieve.
 */
create microflow Module.ProcessImportRows (
  $ImportResult : Module.ImportResult
)
returns integer
begin
  -- Association retrieve is the ONLY way to get related NPEs
  retrieve $Rows from $ImportResult/Module.ImportResult_ImportRow;

  declare $ValidCount integer = 0;

  loop $row in $Rows
  begin
    if $row/IsValid then
      set $ValidCount = $ValidCount + 1;
    end if;
  end loop;

  return $ValidCount;
end;
When to Use Which Retrieve
ScenarioSyntaxWhy
Query persistent entities by attributeretrieve $list from Module.Entity where ...Database XPath query
Get related persistent objectsretrieve $list from $Parent/Module.AssociationSimpler, no XPath needed
Get related NPEs / uncommitted objectsretrieve $list from $Parent/Module.AssociationOnly option — database has no data
JSON mapping results (import)retrieve $list from $Parent/Module.AssociationMapping creates in-memory NPEs

Important: Association retrieve always returns a list. It does not support WHERE, SORT BY, LIMIT, or OFFSET clauses.

Appending to a Reference Set

change $Obj (Module.Assoc = $X) assigns a reference set — whatever was in it is dropped. In a loop, only the last object stays attached and the others are orphaned, with no error from check, the build, or the runtime log. Append and remove with the Change object activity's Add / Remove members instead:

sql
loop $Row in $Rows begin
  add $Row to $Material/Module.Material_SkuRow;     -- append one
end loop;
add $MoreRows to $Material/Module.Material_SkuRow;  -- or a whole list at once
remove $OldRow from $Material/Module.Material_SkuRow;
commit $Material;

Reference sets only: on a plain Reference (or an attribute) mxbuild rejects Add/Remove with CE0033 and mxcli refuses it — set a Reference with change.

Aggregate Patterns

Each aggregate is one statement: the operation's name, then the list variable (by an attribute, as in Studio Pro's Aggregate list activity). The old call form (count($list), sum($list.Attr)) is deprecated (MDL-DEPR004).

FunctionSyntaxReturns
COUNT$n = count $list;Integer
SUM$n = sum $list by Attr;Decimal
AVERAGE$n = average $list by Attr;Decimal
MINIMUM$n = minimum $list by Attr;Same as attribute
MAXIMUM$n = maximum $list by Attr;Same as attribute

Important: RETRIEVE implicitly declares its variable — do NOT add a separate DECLARE before RETRIEVE, or you'll get CE0111 "Duplicate variable name".

Count Items
mdl
mdl 1;
/**
 * Count active customers
 */
create microflow Module.CountActiveCustomers ()
returns integer
begin
  retrieve $Customers from Module.Customer
    where IsActive = true;

  $count = count $Customers;
  return $count;
end;
Sum Values
mdl
mdl 1;
/**
 * Sum order amounts for a customer
 */
create microflow Module.GetCustomerTotalOrders (
  $Customer: Module.Customer
)
returns decimal
begin
  retrieve $Orders from Module.Order
    where Module.Order_Customer = $Customer;

  $Total = sum $Orders by Amount;
  return $Total;
end;
Average Calculation
mdl
mdl 1;
/**
 * Calculate average order value
 */
create microflow Module.GetAverageOrderValue ()
returns decimal
begin
  retrieve $Orders from Module.Order;

  $average = average $Orders by Amount;
  return $average;
end;
Min/Max
mdl
$MinPrice = minimum $Products by Price;
$MaxPrice = maximum $Products by Price;

List Operations

Show full SKILL.md (244 more words)Show less
One statement per operation — they do not nest

Every list operation and aggregate is a separate activity in Mendix, and an activity stores its list as a variable reference. There is no slot for a nested computation, so this is not a shorter spelling — it is a list argument the model cannot hold:

text
-- WRONG. mxcli check refuses this as MDL-LISTOP02.
$n = count(filter($Requests, $currentObject/Status = Module.ENUM_Status.Approved));

Before the rule existed it parsed, passed check, and execed with Created microflow — then dropped the inner call entirely and wrote an activity with an empty list, which mxbuild rejected with CE0012 (The 'List' property is required.) for an aggregate or CE0096 for a list operation. The sort(filter(…), Attr) shape was worse still: with the list gone the sort attribute has no entity to resolve against, and mxbuild aborts rather than reporting an error.

Give the inner operation its own statement and pass the variable:

mdl
-- RIGHT
$Approved = filter $Requests where $currentObject/Status = Module.ENUM_Status.Approved;
$n        = count $Approved;

The same applies to both operands of union/intersect/subtract, and to any non-variable list argument — count('nonsense') fails the same way.

Add to List
mdl
mdl 1;
/**
 * Collect matching items into a list
 */
create microflow Module.CollectHighValueOrders (
  $Orders: list of Module.Order,
  $Threshold: decimal
)
returns list of Module.Order
begin
  $HighValue = create list of Module.Order;

  loop $Order in $Orders
  begin
    if $Order/Amount > $Threshold then
      add $Order to $HighValue;
    end if;
  end loop;

  return $HighValue;
end;
Remove from List
mdl
mdl 1;
/**
 * Remove inactive items from list
 */
create microflow Module.FilterActiveItems (
  $Items: list of Module.Item
)
returns list of Module.Item
begin
  $ToRemove = create list of Module.Item;

  -- Collect items to remove
  loop $item in $Items
  begin
    if not($item/IsActive) then
      add $item to $ToRemove;
    end if;
  end loop;

  -- Remove collected items
  loop $inactive in $ToRemove
  begin
    remove $inactive from $Items;
  end loop;

  return $Items;
end;

Batch Processing

Process in Batches
mdl
mdl 1;
/**
 * Process large dataset in batches
 * Commits after each batch to avoid memory issues
 */
create microflow Module.BatchProcess (
  $Items: list of Module.Item,
  $BatchSize: integer
)
returns integer
begin
  declare $Processed integer = 0;
  declare $BatchCount integer = 0;

  loop $item in $Items
  begin
    -- Process item
    change $item (status = 'Processed');

    set $BatchCount = $BatchCount + 1;
    set $Processed = $Processed + 1;

    -- Commit batch
    if $BatchCount >= $BatchSize then
      commit $item;
      set $BatchCount = 0;
      log info node 'Batch' 'Processed ' + $Processed + ' items';
    end if;
  end loop;

  -- Final commit for remaining items
  if $BatchCount > 0 then
    log info node 'Batch' 'Final batch: ' + $Processed + ' total';
  end if;

  return $Processed;
end;

Data Transformation

Copy Entity
mdl
mdl 1;
/**
 * Create a copy of an order
 */
create microflow Module.CopyOrder (
  $source: Module.Order
)
returns Module.Order
begin
  $Copy = create Module.Order (
    OrderNumber = 'COPY-' + $source/OrderNumber,
    Amount = $source/Amount,
    status = 'Draft',
    CreatedDate = [%CurrentDateTime%]
  );

  -- Copy association
  set $Copy/Module.Order_Customer = $source/Module.Order_Customer;

  commit $Copy;
  return $Copy;
end;
Transform List
mdl
mdl 1;
/**
 * Create summary records from detail records
 */
create microflow Module.CreateOrderSummaries (
  $Orders: list of Module.Order
)
returns list of Module.OrderSummary
begin
  $Summaries = create list of Module.OrderSummary;

  loop $Order in $Orders
  begin
    $Summary = create Module.OrderSummary (
      OrderNumber = $Order/OrderNumber,
      TotalAmount = $Order/Amount,
      CustomerName = $Order/Module.Order_Customer/Name
    );
    add $Summary to $Summaries;
  end loop;

  return $Summaries;
end;

Error Handling in Loops

Continue on Error
mdl
mdl 1;
/**
 * Process items, log errors but continue
 */
create microflow Module.ProcessWithErrorHandling (
  $Items: list of Module.Item
)
returns integer
begin
  declare $Processed integer = 0;
  declare $Errors integer = 0;

  loop $item in $Items
  begin
    if $item/data = empty then
      log warning node 'Process' 'Skipping item with empty data: ' + $item/Code;
      set $Errors = $Errors + 1;
    else
      change $item (status = 'Processed');
      commit $item;
      set $Processed = $Processed + 1;
    end if;
  end loop;

  log info node 'Process' 'Completed: ' + $Processed + ' processed, ' + $Errors + ' errors';
  return $Processed;
end;

Best Practices

  1. Commit inside loops carefully: Can cause performance issues on large sets
  2. Use batch commits: Commit every N records for large datasets
  3. Log progress: Add logging for long-running operations
  4. Handle errors gracefully: Don't let one bad record stop the whole process
  5. Return counts: Help callers know what was processed
  6. Use meaningful variable names: $ProcessedCount not $c

© mendixlabs, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/mendix/patterns-data-processing of mendixlabs/mxcli.

Open the folder on GitHubat commit 20a6c89

Compare with similar skills

Patterns Data Processing 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.

Patterns Data Processing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Patterns Data Processing this skillmendixlabs/mxcli128—~2.9kAutomated safety check: PassApache-2.0
Crawl4AI Web Scrapingsmallnest/goclaw5981 repos~2.5kAutomated safety check: PassMIT
Glue 09 10 Migrationaws-samples/aws-glue-samples1.5k—~2.4kAutomated safety check: PassMIT-0
Migrate Glue Devendpoint To Interactive Sessionsaws-samples/aws-glue-samples1.5k—~3.6kAutomated safety check: PassMIT-0
Dbt Databricks PR Readydatabricks/dbt-databricks380—~2.8kAutomated safety check: PassApache-2.0
Mz Dbt ReleaseMaterializeInc/materialize6.4k—~1.2kAutomated safety check: PassCustom licence

Similar skills

  • Crawl4AI Web Scraping

    smallnest/goclaw

    Scrapes sites, handles JavaScript-heavy pages and extracts structured data with Crawl4AI, through its crwl CLI or Python SDK, including schema-based extraction without an LLM.

    598 GitHub starsUsed in 1 repo~2.5k tokens
    Data & AnalyticsAuto-check passed
  • Glue 09 10 Migration

    aws-samples/aws-glue-samples

    Official

    Upgrade an AWS Glue ETL job from Glue version 0.9 or 1.0 to Glue 4.0.

    1.5k GitHub stars~2.4k tokensUpdated 1 mo ago
    Data & AnalyticsAuto-check passed
  • Official

    Migrate a legacy AWS Glue development endpoint to a Glue interactive session, following the official AWS migration checklist.

    1.5k GitHub stars~3.6k tokensUpdated 1 mo ago
    Data & AnalyticsAuto-check passed
  • Dbt Databricks PR Ready

    databricks/dbt-databricks

    Official

    A skill your agent uses for an open dbt-databricks pull request, including your own PR or a fork PR, to assess merge readiness and optionally repair selected gaps on the PR head branch.

    380 GitHub stars~2.8k tokensUpdated today
    Data & AnalyticsAuto-check passed
  • Mz Dbt Release

    MaterializeInc/materialize

    Cut a dbt-materialize PyPI release: bump the version in version.py and setup.py, date the Unreleased CHANGELOG entry, and open the release PR with a Ship: <url body.

    6.4k GitHub stars~1.2k tokensUpdated today
    Data & AnalyticsAuto-check passed
  • Erd Studio Setup

    liam-machine/erd-studio

    Friendly, step-by-step setup for ERD Studio in an existing dbt project, for people who may be new to dbt or data modelling.

    165 GitHub stars~8.5k tokensUpdated today
    Data & AnalyticsAuto-check passed

More from mendixlabs/mxcli

All 72 skills in this repo
  • Mendix Odata Pushdown

    mendixlabs/mxcli

    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…

    128 GitHub stars~2.5k tokensUpdated today
    Auto-check passed
  • Mendix Vega Charts

    mendixlabs/mxcli

    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.

    128 GitHub stars~3k tokensUpdated today
    Auto-check passed
  • Agents

    mendixlabs/mxcli

    Author Mendix AI agent documents in MDL — Model, Knowledge Base, Consumed MCP Service and Agent, with variables, tools and multi-line prompts.

    128 GitHub starsUsed in 1 repo~2.2k tokens
    Auto-check passed
  • Mendix Bulk Oql Dml

    mendixlabs/mxcli

    Run set-based INSERT, UPDATE and DELETE against Mendix entities through OQL statements, which the runtime supports and Studio Pro cannot author.

    128 GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • Business Events

    mendixlabs/mxcli

    Define event-driven APIs over Kafka with Mendix business event services — publish and subscribe contracts, CREATE/DROP/DESCRIBE.

    128 GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed
  • Catalog Search

    mendixlabs/mxcli

    Search the Mendix Catalog platform service registry (catalog.mendix.com) from the CLI to find services published across an organisation.

    128 GitHub starsUsed in 1 repo~1.4k tokens
    Auto-check passed

Questions about Patterns Data Processing

What does Patterns Data Processing do?

Patterns for loops, aggregates, batch processing and list transformation — including which retrieve source is legal where, and why nested loops are the wrong tool. Patterns Data Processing is an agent skill from mendixlabs/mxcli. Patterns for loops, aggregates, batch processing and list transformation — including which retrieve source is legal where, and why nested loops are the wrong tool.

When should I use Patterns Data Processing?

Patterns Data Processing fits situations like: A microflow processes a list; does anything in bulk.

How do I install Patterns Data Processing in Claude Code?

Run `npx skills add mendixlabs/mxcli --skill patterns-data-processing -a claude-code`. Or copy the skill folder (.claude/skills/mendix/patterns-data-processing in mendixlabs/mxcli) into .claude/skills/patterns-data-processing in your project. Claude Code loads it when a task matches its description.

How do I install Patterns Data Processing in Codex?

Run `npx skills add mendixlabs/mxcli --skill patterns-data-processing -a codex`. Or copy the skill folder (.claude/skills/mendix/patterns-data-processing in mendixlabs/mxcli) into .agents/skills/patterns-data-processing in your project. Codex loads it when a task matches its description.

Can I use Patterns Data Processing 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 patterns-data-processing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/patterns-data-processing, .gemini/skills/patterns-data-processing, .github/skills/patterns-data-processing and .opencode/skills/patterns-data-processing in your project.

What does Patterns Data Processing need to run?

SKILL.md names no scripts, command-line tools or credentials: Patterns Data Processing is instructions for the agent only.

Does Patterns Data Processing 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 Patterns Data Processing 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 Patterns Data Processing use?

Patterns Data Processing 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 Patterns Data Processing use?

About 2.9k tokens (SKILL.md is roughly 12k 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 Patterns Data Processing?

Skills that share tags, products or a category with Patterns Data Processing: Crawl4AI Web Scraping (smallnest/goclaw, 598 stars), Glue 09 10 Migration (aws-samples/aws-glue-samples, 1.5k stars), Migrate Glue Devendpoint To Interactive Sessions (aws-samples/aws-glue-samples, 1.5k stars) and Dbt Databricks PR Ready (databricks/dbt-databricks, 380 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Patterns Data Processing?

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.