Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Phase 4: Validation and Handoff

mxcli provides a multi-level validation pipeline. The agent uses these tools to self-correct before a human ever looks at the result.

Validation Steps

# 1. Syntax check (fast, no project needed)
mxcli check script.mdl

# 2. Reference validation (checks entity/microflow names exist)
mxcli check script.mdl -p app.mpr --references

# 3. Lint the full project (41 built-in + 27 Starlark rules)
mxcli lint -p app.mpr

# 4. Quality report (scored 0-100 per category)
mxcli report -p app.mpr --format markdown

# 5. Mendix compiler check (requires Docker)
mxcli docker check -p app.mpr

# 6. Build and run (requires Docker)
mxcli docker run -p app.mpr

Lint Categories

The linter covers 6 categories:

CategoryFocusExample Rules
Naming (CONV)Naming conventionsEntity naming, microflow prefixes
Security (SEC)Access controlMissing access rules, open security
Quality (QUAL)Code qualityUnused variables, empty microflows
Architecture (ARCH)StructureModule dependencies, circular references
Performance (DESIGN)EfficiencyMissing indexes, large retrieve-all
Design (MDL)Best practicesEntity design, association patterns

Quality Reports

The assess-quality skill guides the agent to run mxcli report and interpret the scores. A migration is ready for handoff when:

  • No critical lint issues (SEC, QUAL categories)
  • Quality score above 70 across all categories
  • mxcli docker check passes with no errors
  • All tests pass

Automated Testing

Write .test.mdl files to validate migrated business logic:

-- tests/order_tests.test.mdl
-- @test: Order total is calculated correctly

$Customer = CREATE CRM.Customer (Name = 'Test');
COMMIT $Customer;

$Order = CREATE Sales.Order (OrderNumber = 'ORD-001', OrderDate = now());
CHANGE $Order (Sales.Order_Customer = $Customer);
COMMIT $Order;

$Line = CREATE Sales.OrderLine (Price = 10.00, Quantity = 3);
CHANGE $Line (Sales.OrderLine_Order = $Order);
COMMIT $Line;

CALL MICROFLOW Sales.ACT_Order_CalculateTotal ($Order = $Order);

-- @assert: $Order/TotalAmount = 30.00
# Run tests (requires Docker)
mxcli test tests/ -p app.mpr

Handoff to Studio Pro

The final step transitions to Mendix Studio Pro for visual refinement:

TaskWhy Studio Pro
Page layout tuningVisual drag-and-drop for pixel-perfect layouts
Styling and themingCSS/SCSS editing with live preview
Complex workflowsWorkflow editor for multi-step approval processes
Marketplace modulesInstall and configure marketplace modules
DeploymentConfigure deployment pipelines and environments

Handoff Checklist

# Final validation before opening in Studio Pro
mxcli docker check -p app.mpr          # No compiler errors
mxcli lint -p app.mpr                  # No critical lint issues
mxcli report -p app.mpr               # Review quality scores
mxcli test tests/ -p app.mpr          # All tests pass
mxcli -p app.mpr -c "SHOW STRUCTURE DEPTH 2"  # Review structure

Iterative Workflow

The mxcli/Studio Pro workflow is iterative – you can switch between them:

  mxcli/MDL                    Studio Pro
 ┌──────────┐               ┌──────────────┐
 │ Generate  │──── open ───▶│ Visual edit   │
 │ entities, │               │ styling,     │
 │ microflows│◀── save ─────│ test, deploy  │
 │ pages     │               │              │
 └──────────┘               └──────────────┘

Changes made in either tool are persisted in the .mpr file. Always close mxcli before opening in Studio Pro, and vice versa.