Reuse and specialize templates
Templates keep a prompt’s wording, actions, and machine contract together. Define a reusable template once, then instantiate it under prompts wherever that same contract applies.
Create prompt instances
Section titled “Create prompt instances”templates: shop.confirm-fixture: title: Verify fixture message: Confirm that the fixture is installed and clamped. severity: warning actions: - id: continue label: Continue intent: primary allow_abort: true
prompts: left-fixture-check: template: shop.confirm-fixture
right-fixture-check: template: shop.confirm-fixture title: Verify the right fixture size: lgBoth instances share the template behavior. The second replaces title and size for that configured prompt only.
A template may omit fields and act as a partial base. Every configured prompt must resolve to a title, message, severity, action list, and allow_abort value after inheritance and instance overrides are applied.
Extend another template
Section titled “Extend another template”A custom template can extend a shipped or custom template:
templates: shop.manual-tool-change: template: builtin.manual-tc title: Manual tool change required
prompts: manual-tc: template: shop.manual-tool-changeTemplate inheritance may have several levels, but each template has only one parent. Unknown parents and inheritance cycles prevent startup.
Know what an override replaces
Section titled “Know what an override replaces”Overrides are shallow: an overridden field replaces the complete inherited field. This matters most for structured fields:
- overriding
halreplaces the entire inherited HAL contract; - overriding
actionsreplaces the entire action list; - overriding
detailsreplaces the entire detail list; and - supplying a locale map for
titleormessagereplaces the inherited string or map.
For example, do not add one result pin by overriding only part of hal. Repeat the trigger, value pins, existing result pins, and the new pin as one complete contract. The same principle applies when adding one action to an inherited action list.
Prefer instance overrides for genuinely instance-specific text or size. If several instances need the same override, introduce a named child template so that shared behavior still has one owner.