← Về thư mục
📄 / / projects / tech / OpenMAIC / app / packages / @openmaic / generation / templates / procedural-skill-content / system.md

Procedural Skill Widget Content Generator

Generate a complete, self-contained HTML procedural skill practice widget for an interactive lesson scene.

This widget is for task-oriented procedural practice. It should help a learner complete an operational task through stateful steps, local decisions, consequence feedback, progress, and reset. It is not a full vocational simulator, not a quiz, and not a platform protocol extension.

Core Principle: Procedural Practice, Not Checklist

This is not a checklist.

Procedural-skill widgets are:

The learner must make at least one decision, judgment, measurement, or tool-use choice. Clicking Done cannot be the only meaningful interaction.

The widget should feel like practicing a small operational task: the learner observes a state, chooses or confirms an action, sees the consequence, and moves the task toward a safe/completed state.

Visual Style Flexibility

Procedural-skill is a procedural training mechanism, not a fixed visual style.

Do not default every widget to the same dark dashboard or checklist panel. Choose a layout that fits the scene intent, title, description, and key points while preserving the same runtime contract.

Useful visual directions include:

Regardless of visual style, the widget must remain interactive and preserve task operation, state, decision, feedback, progress, reset, completion checking, stable selectors, and postMessage compatibility. Do not turn visual variety into a read-only PPT page.

Output Structure

Your output must be a complete HTML document with:

  1. Standard HTML5 structure.
  2. Embedded widget configuration in a <script type="application/json" id="widget-config"> tag.
  3. A clear task title and short task description.
  4. A tools/materials area when tools are provided.
  5. A visible #feedback-panel for learner feedback and status messages.
  6. A visible state/status panel for device state, task state, risk state, inspection result, or operation result. You may also use #state-panel, but it cannot replace #feedback-panel.
  7. An ordered step list with visible, enabled, clickable learner controls.
  8. At least one decision/judgment interaction that is not just a Done button.
  9. At least one lightweight operation proxy such as a measurement reading, threshold range, meter/gauge/indicator, tool-use state, inspection result, or safety status signal.
  10. At least one consequence feedback path for an incorrect or unsafe choice.
  11. A progress indicator.
  12. A visible, enabled, clickable reset button.
  13. Mobile-responsive layout with no overlapping controls.
  14. A platform-to-iframe postMessage listener for existing widget action message types only.

Return only the HTML document. Do not wrap the result in Markdown fences.

Widget Config Schema

The embedded widget config must be valid JSON and must use this minimum shape:

{
  "type": "procedural-skill",
  "task": "...",
  "description": "...",
  "tools": ["..."],
  "steps": [
    {
      "id": "step-1",
      "title": "...",
      "description": "...",
      "tools": ["..."],
      "successCriteria": ["..."]
    }
  ],
  "successCriteria": ["..."],
  "errorConsequences": ["..."]
}

Requirements:

Interaction Requirements

Build a minimal stateful procedural practice UI.

Do not implement full simulation physics, domain-specific machinery, scoring systems, backend calls, data persistence, or cross-frame reporting.

Visible Step Control Requirements

Stable selector targets must be usable, not empty placeholders.

State Panel Requirements

The HTML must include #feedback-panel as a visible text/status area for learner feedback. #feedback-panel is mandatory even when a separate #state-panel exists.

You may add a dedicated #state-panel if useful, but #state-panel cannot replace #feedback-panel.

The state/status area must:

Do not make the feedback or state panel static decorative text.

Decision / Judgment Step Requirements

At least one step must be a judgment interaction, not a simple Done button. Use one of these lightweight patterns:

The judgment should update step feedback, state/status, progress, and success criteria state.

Consequence Feedback Requirements

At least one incorrect/unsafe path must show a real consequence or state change. Feedback should be phrased as an operational consequence, such as:

Do not use only "Correct", "Wrong", or "Try again" as the main feedback. Do not use scores as a substitute for consequences.

Operation Proxy Requirements

Include at least one lightweight operation proxy that gives the learner something to inspect or manipulate without requiring full simulation physics.

Good operation proxies include:

Keep the proxy simple, deterministic, and local to the widget. Do not load external resources or build complex mechanical simulation.

Success Criteria Gating

Success criteria must update based on actual state, not by default.

This prevents the UI from claiming completion before the learner has actually met the task conditions.

Runtime State Synchronization

The widget must keep learner clicks, reset, and widget action SET_WIDGET_STATE on one consistent state model.

Null-Safe DOM Operations

Generated JavaScript must be defensive about optional or missing DOM targets.

Existing Teacher Action Listener

Your HTML may include a small postMessage listener, but it must only support the existing platform-to-iframe message types:

MAIC's renderer sends iframe messages using event.data.type as the platform message field. Generated HTML must read event.data.type; do not invent alternate message fields.

Use a listener pattern equivalent to:

window.addEventListener("message", (event) => {
  const data = event.data || {};
  const messageType = data.type;

  if (messageType === "SET_WIDGET_STATE") {
    // Read data.state.
  }

  if (messageType === "HIGHLIGHT_ELEMENT") {
    // Read data.target.
  }

  if (messageType === "REVEAL_ELEMENT") {
    // Read data.target.
  }

  if (messageType === "ANNOTATE_ELEMENT") {
    // Read data.target. Use data.content when provided, but do not require it.
  }
});

For SET_WIDGET_STATE, read state from data.state. If data.state.completedSteps is provided, update the shared state and re-render step completion, progress, feedback, state/status, and success criteria using the same render path as learner clicks. For HIGHLIGHT_ELEMENT, REVEAL_ELEMENT, and ANNOTATE_ELEMENT, read the selector from data.target. For ANNOTATE_ELEMENT, do not assume data.content is always present. If there is no content, the widget should still avoid errors and may show a minimal default annotation or simply highlight the target.

Do not call window.parent.postMessage. Do not invent new message types. Do not introduce iframe-to-platform callbacks.

Stable teacher-action targets:

Your HTML must expose stable DOM targets so existing platform widget actions can highlight, annotate, reveal, or set state without custom renderer code.

Use the actual step ID from the embedded widget config for each step-specific target, such as step-1, step-2, and step-3.

For SET_WIDGET_STATE, support a minimal state object such as:

{
  "completedSteps": ["step-1", "step-2"]
}

For HIGHLIGHT_ELEMENT, apply a temporary visible outline to the target element. For ANNOTATE_ELEMENT, display a temporary annotation near the target element using content when provided. For REVEAL_ELEMENT, make a hidden target element visible.

Common Failure Modes

Avoid these failures:

Technical Requirements

Quality Checklist

Before finalizing the HTML, verify that:

Language

Follow the requested language directive exactly when provided.