Skip to content

feat: h5p-author, a skill that builds and verifies a text-only quiz - #68

Merged
alekswebnet merged 3 commits into
mainfrom
feat/h5p-author-skill
Oct 23, 2026
Merged

alekswebnet merged 3 commits into
mainfrom
feat/h5p-author-skill

Conversation

@alekswebnet

@alekswebnet alekswebnet commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #67.

An agent asked for an H5P quiz could check a package with h5p-verify, but had nothing to build one with. h5p-author is a new skill in skills/, beside the other three. From a brief it:

  1. writes a small quiz source;
  2. builds a self-contained .h5p from the library pack installed in the user's project;
  3. plays it through the verifier;
  4. checks the screenshot.

It covers text-only Multiple Choice and Question Set.

Changes

The skill (skills/h5p-author/)

  • SKILL.md walks through the brief, the source, the build, the verification and the hand-over, and states the limits:

    • no media and no other content types;
    • the libraries' button labels stay English;
    • a verifier pass covers startup only.

    It tells the agent not to substitute a quiz for another kind of activity, and never to make a check pass by removing a question.

  • references/quiz-format.md describes the source format; assets/quiz.json is a two-question starter.

  • assets/phishing-scenarios.json, with references/scenario-quiz.md, is a fuller example: eight scenarios, four with several correct answers, an 80% pass mark, an answer key, and attempts that fail at 75%, pass at 83.3% and retry to 100%.

  • LICENSE is the repository's MIT licence, installed with the skill.

The helper (skills/h5p-author/scripts/build-quiz.mjs)

  • Validation: it checks the source field by field; an unknown field or a wrong type fails with its path.

  • Dependencies: it loads @missing-elements/h5p-libraries and @zip.js/zip.js from the calling project, not from the skill's folder, so an installed or symlinked skill works. It refuses a zip.js older than 2.24 and prints the install command. appendZip has no filter option before 2.20, and without it each part's own h5p.json would be copied too.

  • Libraries: it takes Multiple Choice and Question Set from the pack and walks their preloaded and dynamic dependencies. Each part is checked against the pack index's SHA-256, and its library.json against the index entry. Only those folders are copied:

    Package Libraries Size
    Question Set 10 1.18 MB
    Single question 8 0.94 MB
    Whole pack, for comparison 105 14 MB
  • Content: every field comes from the installed semantics.json defaults, and a required field it cannot fill fails the build. Authored text is escaped into the HTML fields. Each question gets a UUID subContentId. h5p.json is written first and content/content.json last.

  • Output: it builds in a temporary folder next to the output and copies with COPYFILE_EXCL. An existing file is never overwritten, and a failed build leaves nothing behind.

Tests (apps/skills/, a new workspace app)

The demo is not tested, except its installable app, so the skill's tests live in a project of their own. apps/skills is the kind of project the skill runs in: it installs the pack and zip.js, which the helper resolves from it, and the verifier. Nothing in it ships.

  • tests/author.test.ts runs the helper in Node, 29 tests:
    • 21 malformed sources, each refused with its path;
    • both kinds built with the pack's versions, defaults and full dependency set;
    • escaping;
    • no overwrite and no partial output;
    • a damaged part refused by its SHA-256;
    • an older zip.js refused with the install command;
    • the helper run from a copy of the skill outside the checkout, loading its dependencies from the calling project.
  • tests/author-verify.test.ts runs both kinds and the scenarios through the verifier's published API, trusted and untrusted against the installed pack (6 tests). Each passes with no warnings and no errors.
  • tests/author-playback.test.ts plays the eight scenarios in the verifier's preview, the page the skill will hand a person for review, trusted and untrusted (2 tests):
    • every chosen answer's feedback appears;
    • 9 of 12 (75%) fails the 80% mark, 10 of 12 (83.3%) passes, and a retry reaches 12 of 12;
    • Show solution works;
    • finished comes from the Question Set alone, never from a question.

Docs: the README's agent-skills section, docs/verify.md, docs/development.md, CONTRIBUTING.md, and AGENTS.md's layout and test lists.

Testing

  • pnpm typecheck across the workspace passes, the new app included.
  • apps/skills: 37 of 37 in 18 s.
  • The verifier's own tests, main merged in and the author test moved out: 22 of 22.
  • The command line against a stand-in zip.js 2.15: it exits with code 1, prints the install command and "older than 2.24", and writes nothing.
  • The playback test runs in Chromium only. While it lived in the demo, the engines job also ran it in Firefox and WebKit, 2 of 2 in each.

Not verified

  • An agent taking a real brief through the whole skill. The tests build the committed examples.
  • Installing with npx skills add from GitHub, which can only fetch the skill once it is on main. The portable test copies the folder instead.
  • Uploading to an LMS. The pack's versions may be newer than the destination's, as SKILL.md says.
  • Content in other languages: the libraries' button labels stay English, and the helper warns about it.

Later

The review step will name h5p-verify --preview once h5p-verify 1.2.0 is on npm. npx skills add reads the skill from main, so the step cannot land there before the release.

Release

None. Skills are fetched from the repository rather than published, and the tests don't ship. The README paragraph reaches npm with the player's next release, since prepack copies the root README.

🤖 Generated with Claude Code

An agent asked for an H5P quiz could check a package with h5p-verify but
had nothing to build one with, and hand-written packages break in ways
the files do not show.

- skills/h5p-author: the brief, a validated quiz source, the build, the
  verifier trusted and untrusted, and a look at the screenshot. Text-only
  Multiple Choice and Question Set, with the limits stated.
- scripts/build-quiz.mjs, portable: loads the library pack and zip.js
  from the calling project and refuses a zip.js older than 2.24. Copies
  only the selected libraries' runtime dependencies, each part checked
  against the pack index's SHA-256. Fills fields from the installed
  semantics, gives each question a UUID subContentId, and never
  overwrites its output.
- Two examples: a two-question starter, and eight phishing scenarios
  with an answer key and the fail, pass and retry attempts.
- Tests: the helper in Node; the scenarios played through the app,
  trusted and untrusted; every example through the verifier with no
  warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alekswebnet and others added 2 commits October 23, 2026 14:40
…eside the author skill

Two conflicts, both kept whole: AGENTS.md's layout of packages/verify/tests names preview.test.ts
and author.test.mjs, and docs/verify.md has the preview paragraph followed by the author skill's.
The verifier's tests pass on the merged tree, 28 of 28, author.test.mjs and preview.test.ts among
them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t of the demo

The demo is not tested but for its installable app (the owner's rule of 2026-10-17), and #68 had
put two of the skill's tests there because the demo had the pack and zip.js installed. apps/skills
is a project of the kind the skill runs in: it installs the pack and zip.js, which the helper
resolves from it, and the verifier. All three of the skill's tests are in it:

- author.test.ts, the helper in Node, moved as it was;
- author-verify.test.ts, from the verifier's author.test.mjs, now through the verifier's
  published API and typed against its declarations, so the verifier's tests are its own;
- author-playback.test.ts plays the eight scenarios in the verifier's preview instead of the
  demo's installable app: the page the skill will hand a person to review a quiz in. It runs in
  Chromium only, where the demo's engines job ran it in Firefox and WebKit too.

The lockfile gains the app's importer and nothing else. AGENTS.md, docs/development.md and
CONTRIBUTING.md name the app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alekswebnet
alekswebnet merged commit b78e0f5 into main Oct 23, 2026
7 checks passed
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.

An h5p-author skill: build and verify a text-only quiz from a prompt

1 participant