一键导入
fragments
Mendix Fragments — DEFINE FRAGMENT, USE FRAGMENT with prefix, SHOW/DESCRIBE FRAGMENTS, common patterns, and validation checklist
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Mendix Fragments — DEFINE FRAGMENT, USE FRAGMENT with prefix, SHOW/DESCRIBE FRAGMENTS, common patterns, and validation checklist
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Mendix MDL authoring, project navigation, and Docker app lifecycle — entities, microflows, pages, security, navigation, OQL, REST, testing, linting, and migration. Load when working in any Mendix codebase.
MDL Agent Documents — CREATE MODEL, CREATE KNOWLEDGE BASE, CREATE CONSUMED MCP SERVICE, CREATE AGENT syntax and calling agents from microflows
ALTER PAGE / ALTER SNIPPET — SET, INSERT, DROP, REPLACE widget operations on existing pages and snippets
Migration Assessment — structured investigation of non-Mendix projects for migration planning across technology stack, data model, business logic, UI, integrations, and security
Assess Mendix Project Quality — automated linting, catalog queries, naming conventions, security, maintainability, performance, and architecture review with scored report
Browse Integration Services and Contracts — SHOW/DESCRIBE OData, REST, business event, and database connection services; query MDL CATALOG integration tables; import external entities
| name | fragments |
| description | Mendix Fragments — DEFINE FRAGMENT, USE FRAGMENT with prefix, SHOW/DESCRIBE FRAGMENTS, common patterns, and validation checklist |
| compatibility | opencode |
MDL fragment author — define and reuse widget groups across multiple pages in the same script.
Fragments are script-scoped, transient widget groups:
<syntax_reference>
define fragment SaveCancelFooter as {
footer footer1 {
actionbutton btnSave (caption: 'Save', action: save_changes, buttonstyle: primary)
actionbutton btnCancel (caption: 'Cancel', action: cancel_changes)
}
};
Multiple top-level widgets:
define fragment CustomerFields as {
textbox txtName (label: 'Name', attribute: Name)
textbox txtEmail (label: 'Email', attribute: Email)
textbox txtPhone (label: 'Phone', attribute: Phone)
};
create page Module.CustomerEdit
(
params: { $Customer: Module.Customer },
title: 'Edit Customer',
layout: Atlas_Core.PopupLayout
)
{
dataview dvCustomer (datasource: $Customer) {
use fragment CustomerFields
use fragment SaveCancelFooter
}
};
With prefix (avoids name conflicts):
use fragment SaveCancelFooter as order_
-- Creates: order_footer1, order_btnSave, order_btnCancel
show fragments;
-- Lists all defined fragments with widget counts
describe fragment SaveCancelFooter;
-- Outputs the full MDL definition
</syntax_reference>
<common_patterns>
define fragment CrudFooter as {
footer footer1 {
actionbutton btnSave (caption: 'Save', action: save_changes, buttonstyle: primary)
actionbutton btnCancel (caption: 'Cancel', action: cancel_changes)
}
};
create page Module.Customer_Edit (...) {
dataview dv (datasource: $Customer) {
textbox txtName (label: 'Name', attribute: Name)
use fragment CrudFooter
}
};
create page Module.Order_Edit (...) {
dataview dv (datasource: $Order) {
textbox txtNumber (label: 'Order #', attribute: Number)
use fragment CrudFooter
}
};
define fragment AddressFields as {
textbox txtStreet (label: 'Street', attribute: Street)
textbox txtCity (label: 'City', attribute: City)
textbox txtZip (label: 'Zip Code', attribute: ZipCode)
textbox txtCountry (label: 'Country', attribute: Country)
};
create page Module.Customer_Edit (...) {
dataview dv (datasource: $Customer) {
textbox txtName (label: 'Name', attribute: Name)
use fragment AddressFields
use fragment CrudFooter
}
};
define fragment ActionButtons as {
actionbutton btnApprove (caption: 'Approve', action: save_changes, buttonstyle: success)
actionbutton btnReject (caption: 'Reject', action: cancel_changes, buttonstyle: danger)
};
create page Module.DualPanel (...) {
layoutgrid lg {
row row1 {
column col1 (desktopwidth: 6) {
use fragment ActionButtons as left_
}
column col2 (desktopwidth: 6) {
use fragment ActionButtons as right_
}
}
}
};
</common_patterns>
<common_mistakes>
-- WRONG: Defining the same fragment name twice causes an error
define fragment footer as { ... };
define fragment footer as { ... }; -- Error: fragment "Footer" already defined
-- WRONG: Using a fragment that hasn't been defined
create page Module.MyPage (...) {
use fragment NonExistent -- Error: fragment "NonExistent" not found
};
-- WRONG: Using same fragment twice without prefix creates duplicate widget names
use fragment footer
use fragment footer -- Widget name "footer1" already exists!
-- CORRECT: Use prefix for uniqueness
use fragment footer as first_
use fragment footer as second_
-- WRONG: Using a fragment before defining it
create page Module.MyPage (...) {
use fragment footer -- Error: fragment "Footer" not found
};
define fragment footer as { ... };
-- CORRECT: Define before use
define fragment footer as { ... };
create page Module.MyPage (...) {
use fragment footer -- OK
};
</common_mistakes>
<validation_checklist>
define fragment statements appear before their use fragment references</validation_checklist>
<output_rules>Output MDL code only in code blocks. Keep explanations concise.</output_rules>