Skip to content

Reconcile interactive-element docs with the engine; add a build verifier#12

Open
kurtvalcorza wants to merge 1 commit into
zarazhangrui:mainfrom
kurtvalcorza:fix/reconcile-docs-and-harden
Open

Reconcile interactive-element docs with the engine; add a build verifier#12
kurtvalcorza wants to merge 1 commit into
zarazhangrui:mainfrom
kurtvalcorza:fix/reconcile-docs-and-harden

Conversation

@kurtvalcorza

Copy link
Copy Markdown

While building a batch of courses with this skill I hit a few places where references/ had drifted from the actual main.js engine — enough to produce broken or confusing output. This PR corrects the docs, hardens the most error-prone authoring patterns, and adds an optional build verifier. No engine or design changes.

Doc ↔ engine fixes (references/interactive-elements.md)

  • Added an "engine contract" callout at the top capturing the verified wiring.
  • Architecture diagram: removed onclick="showArchDesc(this)" from the example — that function does not exist in main.js (clicks are auto-bound and read data-desc), so following the example threw at runtime.
  • Layer toggle: showLayer('html') -> showLayer('layer-html', this) — the engine needs the button to locate the enclosing .layer-demo.
  • Drag-and-drop: checkDnD()/resetDnD() -> checkDnD('<id>')/resetDnD('<id>'), and gave the container an id.
  • Noted that checkQuiz auto-prepends "Exactly!"/"Not quite." (so explanations should not repeat them), and that flow data-steps is single-quoted JSON (a literal apostrophe breaks JSON.parse).

Hardening & docs

  • gotchas.md: documented the real failure modes — malformed quiz blocks (a stray > truncating the tag), apostrophes in flow data-steps, fonts requiring a network, and shipping without verifying.
  • SKILL.md: added a Phase 4 verification step, environment notes (output is a folder not a single file; Windows/PowerShell; headless screenshots can hang on the Fonts CDN), and noted a filesystem copy of the boilerplate is fine.
  • README.md: corrected the "single self-contained HTML file ... works offline" line (the output is a 3-file folder and pulls fonts from the Google Fonts CDN) and refreshed the structure tree.

New (additive)

  • scripts/verify_courses.py: HTML-parses each built index.html and checks structure + interactive wiring (modules == nav-dots, at least one chat + one flow, one quiz per module with all three data-* attributes intact, every flow data-steps parses, no leftover placeholders).

Happy to split this up or drop the verifier if you would prefer a smaller PR.

… add verifier

The reference docs had drifted from main.js in ways that produce broken or
confusing courses. This corrects them and adds guardrails:

- interactive-elements.md: add an "engine contract" up top and fix the examples
  that disagree with main.js — the architecture diagram no longer uses a
  non-existent showArchDesc() onclick (it threw); layer-toggle now passes the
  button (showLayer(id, this)); drag-and-drop passes a container id
  (checkDnD/resetDnD). Plus notes that quiz feedback is auto-prefixed and that
  flow data-steps is single-quoted JSON (a stray apostrophe breaks it).
- gotchas.md: document the real failure modes — malformed quiz blocks (stray
  ">"), apostrophes in flow data-steps, fonts requiring a network, and shipping
  without verifying.
- SKILL.md: add a Phase 4 verification step, environment notes (output is a
  folder not one file; Windows/PowerShell; headless screenshots hang on fonts),
  and note a filesystem copy of the boilerplate is fine.
- README.md: correct the "single self-contained HTML file / offline" claim
  (output is a 3-file folder + Google Fonts CDN) and refresh the structure tree.
- scripts/verify_courses.py: new build verifier that HTML-parses each index.html
  and checks structure + interactive wiring.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant