| name | doenetml-authoring |
| description | Write and revise DoenetML activities using docs-nextra patterns, with explicit guardrails for how DoenetML differs from PreTeXt. |
DoenetML Authoring Skill
Use this skill when creating or editing DoenetML content for interactive browser-based activities.
What To Read First
docs/doenetml-authoring-summary.md
docs/tag-reference.md
docs/doenetml-vs-pretext-differences.md
docs/doenetml-do-dont-checklist.md
docs/sources.md
Reference Materials
Core Instructions
- Write with interactive intent: inputs, feedback, dynamic math, and reactive state.
- Use component names (
name="...") whenever values are reused.
- Reference named components via
$name (and properties like $point1.x) for reactivity. (The $foo mechanism is called a reference. Do not call it a "macro" — that older term has been retired.)
- Use
<answer> patterns appropriate to validation goals (symbolic, numeric, logic-based awards).
- Use
<math> for stored/computed expressions and <m>/<md> for rendered math display.
- Keep graphs meaningful and accessible (include labels/short descriptions where relevant).
- Keep examples runnable and minimal; favor clear, testable snippets.
High-Risk Mistakes To Prevent
- Do not mix PreTeXt reference patterns (
xml:id, <xref ref="..."/>) into DoenetML logic. Use DoenetML naming and referencing patterns instead.
- Do not treat
<m>/<md> as computation containers. Use <math> for computation/state and <m>/<md> for presentation.
- Do not forget explicit answer logic. If an item is graded, include clear
<answer> logic and any needed nested awards/conditions.
- Do not leave reused values unnamed. Missing
name attributes are a common source of broken $name references.
- Do not ship inaccessible graph interactions. Include labels/descriptions and avoid color-only distinctions.
- Do not produce non-runnable snippets with dangling references or missing closing tags.
- Do not extend an array/list state variable with a scalar component. If
$x.foo is a list (e.g. $solve.solutions, $collect.results), use the matching list component: <mathList extend="$solve.solutions"/>, not <math extend="$solve.solutions"/>. Same for <textList>, <numberList>, <vectorList>, <booleanList>, <pointList>, etc. The rule is match the extend tag to the type of the state variable.
- Do not write reference chains that cross component boundaries.
$user.value.latex does not work — .value resolves to a fresh <math> component, but the resolver does not then dereference that math's .latex. If you need a cross-boundary chain, name the intermediate (<math name="userMath" extend="$user.value"/>, then $userMath.latex). Chains within a single array state variable's indexAliases do work and are the right way to access coordinates — e.g. $myLine.points[1].x, $myVector.head.x, $myCircle.center.y.
Difference Emphasis (DoenetML vs PreTeXt)
- DoenetML is runtime-interactive and stateful; PreTeXt is semantic-publication XML.
- DoenetML relies on reactive references and validation components; PreTeXt relies on structure, narrative, and cross-reference systems.
- Do not force PreTeXt-specific constructs (like publication backmatter workflows) into core DoenetML activity logic.
- When converting from PreTeXt, preserve pedagogy but redesign around immediate feedback and interaction.
Minimal Document Example
Use this as a minimal DoenetML starting point for a single auto-checked prompt.
<p><m>7x + 3x = </m><answer>10x</answer></p>
Output Requirements
When asked to author DoenetML, provide:
- Valid component markup with properly closed tags.
- Named components for reused values.
- Clear answer validation and feedback logic.
- Concise notes on assumptions (for grading tolerance, simplification mode, or expected interaction behavior).
- A short self-check list in the response confirming: all
$name references resolve, tags are properly closed, and graded prompts include explicit validation logic.
Pre-Delivery Self-Check
- Confirm every
$name reference points to an existing named component.
- Confirm each graded interaction has explicit validation logic.
- Confirm markup is well-formed XML-like syntax (all tags closed, no malformed nesting).
- Confirm math intent is correct:
<math> for computation, <m>/<md> for rendering.