| name | mx-scaffold-microflow |
| description | GATED WRITE. Scaffold a new Mendix microflow from a structured spec by wrapping mxcli's create microflow command with the 8 safety pillars from rules/mendix-safety.md. Pre-tag the project, verify clean tree + Studio Pro closed + Mendix version, run mx check pre/post, auto-restore on failure. Refuses to proceed unless every pillar passes. Invocable as /mx-scaffold-microflow <spec-or-description>. |
mx-scaffold-microflow
Write-tier skill -- the first one in the Mendix suite that touches the .mpr. Wraps mxcli create microflow (alpha) with the safety harness defined in ~/.claude/rules/mendix-safety.md. The harness is the only reason this is allowed to ship.
North star
Write only what survives both pre-check and post-check.
mxcli is alpha-quality. The safety pillars exist because the upstream tool is not yet trustworthy on its own.
When to invoke
Auto-invoke when:
- A
/mx-feature-spec exists and the next step is implementing one of its proposed microflows.
- Neo explicitly asks for a microflow scaffold and provides the signature.
Do not invoke for:
- Modifying an existing microflow (use Studio Pro or a future
/mx-microflow-edit skill -- not yet built).
- Trivial microflows where Studio Pro UI is faster.
- Any work where Studio Pro is currently open on the project (pillar 3 will refuse anyway).
What it does
The skill is the safety harness. The mxcli call is one line in the middle.
Phase 1 -- Route the write through the shadow-write engine. Do not implement the pillars inline; call ~/.claude/lib/Invoke-MendixShadowWrite.ps1. The engine enforces all 7 pillars (rules/mendix-safety.md). Hard rule: NO git on the Mendix project.
The engine runs in this order:
- Pillar 1: Studio Pro lock check. Refuse if open on this project; suggest
/close-studio-pro.
- Pillar 2: Byte-level snapshot of the .mpr to
~/.claude/backups/<project>/<timestamp>/. Replaces the old git-tag step.
- Pillar 3: Mendix version >= 11.6.0 (refuses otherwise).
- Pillar 4: Pre-write
mx check clean. Captures baseline error/warning counts. Refuses if errors > 0.
- Pillar 5: Diff preview via
mxcli diff (where supported) OR by generating the proposed mxcli command + the structured spec for Neo to confirm before the engine proceeds. Get explicit confirmation before applying.
Phase 2 -- Apply the write (engine runs against the SHADOW .mpr):
- Engine invokes:
Invoke-MendixShadowWrite -ProjectRoot $proj -OperationName 'create-microflow' -Script {
param($ShadowMpr)
& mxcli create microflow <Module.MicroflowName> <signature> -p $ShadowMpr [other flags]
}
- Pillar 6: Post-write
mx check against the shadow. Compare error/warning counts. If error count grows, engine discards the shadow (live remained untouched).
- Pillar 7: Atomic swap if shadow validates; otherwise discard. Live
.mpr mathematically untouched until validation passes.
- Verify the microflow exists post-swap:
mxcli describe <Module.MicroflowName> must return the new microflow.
Phase 3 -- On post-check failure (handled by the engine):
- Engine discards the shadow. Live .mpr is mathematically untouched. No restore needed.
- Catastrophic-only fallback: restore live .mpr from the Pillar 2 snapshot at
~/.claude/backups/....
- Engine logs to
~/.claude/logs/mendix-shadow-write.log and emits the standard failure block.
- Never run any git command to recover.
Phase 4 -- On success:
- Report (engine emits this):
## /mx-scaffold-microflow: SUCCESS
**Microflow:** <Module.MicroflowName>
**Signature:** <params -> return>
**Pillar 2 snapshot (external):** ~/.claude/backups/<project>/<ts>/
**Backup of previous mpr (in-project, sibling file):** <path>.bak.<ts>
**mx check:** baseline <E/W> -> post <E/W> (no regression)
**Next step:** open Studio Pro to wire up the body, or invoke /mx-impact to see what now references it.
Hard rules (in addition to the 7 pillars)
- Never bypass any pillar. No
--force, no "skip checks", no "I know what I'm doing." If a pillar fails, the right answer is fix the underlying state, not bypass.
- Never run git on the Mendix project. Recovery is via shadow-write + Pillar 2 byte-level snapshot. Snapshots are permanent until Neo deletes them.
- Never run two writes back-to-back without re-checking pillars. State drifts; a clean state five minutes ago doesn't guarantee it now.
- Refuse to scaffold without a captured spec. This skill operates from a
/mx-feature-spec output or an explicit Neo-provided structured signature. Never from an inferred signature.
- Mendix version < 11.6 is a hard refusal. Suggest Neo run
mx convert (with full safety pillars) first, in a separate, deliberate step.
Cross-reference
- Safety pillars:
~/.claude/rules/mendix-safety.md.
- Spec primitive:
~/.claude/skills/mx-feature-spec/SKILL.md.
- Version triage:
~/.claude/skills/mx-version/SKILL.md.
- Doctor (the
mx check wrapper): ~/.claude/skills/mx-doctor/SKILL.md.
- mxcli installer:
~/.claude/lib/Setup-Mxcli.ps1.