一键导入
patterns-crud
Standard CRUD microflow patterns for Mendix: Save, Validate, Delete, Cancel, New, Edit, and DataSource microflows with naming conventions
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Standard CRUD microflow patterns for Mendix: Save, Validate, Delete, Cancel, New, Edit, and DataSource microflows with naming conventions
用 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 | patterns-crud |
| description | Standard CRUD microflow patterns for Mendix: Save, Validate, Delete, Cancel, New, Edit, and DataSource microflows with naming conventions |
| compatibility | opencode |
<naming_conventions>
| Prefix | Purpose | Example |
|---|---|---|
ACT_ | Action microflow (page button) | ACT_Customer_Save |
VAL_ | Validation microflow | VAL_Customer_Save |
DS_ | Data source microflow | DS_Customer_GetAll |
SUB_ | Sub-microflow (internal) | SUB_Customer_SendEmail |
| </naming_conventions> |
<save_pattern>
/**
* Save action for Customer NewEdit page
* Validates, commits, and closes the page
*
* @param $Customer The customer to save
* @returns true if saved successfully
*/
create microflow Module.ACT_Customer_Save (
$Customer: Module.Customer
)
returns boolean
begin
-- Validate first
declare $IsValid boolean = true;
$IsValid = call microflow Module.VAL_Customer_Save($Customer = $Customer);
if $IsValid then
commit $Customer with events;
close page;
end if;
return $IsValid;
end;
/
</save_pattern>
<validation_pattern>
/**
* Validate Customer before save
*
* @param $Customer The customer to validate
* @returns true if valid
*/
create microflow Module.VAL_Customer_Save (
$Customer: Module.Customer
)
returns boolean
begin
declare $IsValid boolean = true;
-- Required field validation
if $Customer/Name = empty then
validation feedback $Customer/Name message 'Name is required';
set $IsValid = false;
end if;
if $Customer/Email = empty then
validation feedback $Customer/Email message 'Email is required';
set $IsValid = false;
end if;
-- Business rule validation
if $Customer/CreditLimit < 0 then
validation feedback $Customer/CreditLimit message 'Credit limit cannot be negative';
set $IsValid = false;
end if;
return $IsValid;
end;
/
</validation_pattern>
<delete_pattern>
/**
* Delete a customer
* Called after user confirms deletion
*
* @param $Customer The customer to delete
* @returns true if deleted
*/
create microflow Module.ACT_Customer_Delete (
$Customer: Module.Customer
)
returns boolean
begin
delete $Customer;
close page;
return true;
end;
/
</delete_pattern>
<cancel_pattern>
/**
* Cancel editing and close page
* Discards uncommitted changes
*
* @param $Customer The customer being edited
* @returns true
*/
create microflow Module.ACT_Customer_Cancel (
$Customer: Module.Customer
)
returns boolean
begin
rollback $Customer;
close page;
return true;
end;
/
</cancel_pattern>
<create_new_pattern>
/**
* Create new customer and open edit page
*
* @returns true
*/
create microflow Module.ACT_Customer_New ()
returns boolean
begin
declare $NewCustomer as Module.Customer;
$NewCustomer = create Module.Customer (
IsActive = true,
CreatedDate = [%CurrentDateTime%]
);
show page Module.Customer_NewEdit ($Customer = $NewCustomer);
return true;
end;
/
</create_new_pattern>
<data_source_pattern>
/**
* Get all active customers
* Used as data source for Customer overview
*
* @returns List of active customers
*/
create microflow Module.DS_Customer_GetActive ()
returns list of Module.Customer
begin
declare $Customers list of Module.Customer = empty;
retrieve $Customers from Module.Customer
where IsActive = true;
return $Customers;
end;
/
</data_source_pattern>
<edit_pattern>
/**
* Open customer for editing
*
* @param $Customer The customer to edit
* @returns true
*/
create microflow Module.ACT_Customer_Edit (
$Customer: Module.Customer
)
returns boolean
begin
show page Module.Customer_NewEdit ($Customer = $Customer);
return true;
end;
/
</edit_pattern>
<complete_crud_set> For a typical entity, create these microflows:
| Microflow | Purpose | Parameters |
|---|---|---|
ACT_Entity_New | Create new | None |
ACT_Entity_Edit | Open for edit | $entity |
ACT_Entity_Save | Save changes | $entity |
VAL_Entity_Save | Validate | $entity |
ACT_Entity_Delete | Delete | $entity |
ACT_Entity_Cancel | Cancel edit | $entity |
DS_Entity_GetAll | List all | None |
| </complete_crud_set> |
<best_practices>
commit $entity with events triggers event handlersclose page after successful save/deleterollback $entity to discard changes<output_rules>Output MDL code only in code blocks. Keep explanations concise.</output_rules>