Scorm
Skill studiolxd/skills/scorm-skills/plugins/scorm-skills/skills/scorm
Use when integrating SCORM 1.2/2004 in a web app with @studiolxd/scorm — initializing a session, reading/writing CMI data (score, completion, suspend data, interactions, objectives), handling Result errors, or wiring lifecycle/auto-commit across React, Vue, Angular, Svelte, Web Components, or vanilla JS.From its SKILL.md
npx -y skills add studiolxd/skills --skill scormAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.3 KB, 871 tokens by cl100k_base, as published. Nobody here has run it
Using @studiolxd/scorm
@studiolxd/scorm is a headless SCORM 1.2/2004 runtime. A framework-agnostic core
(createScormSession) plus thin adapters. Built-in mock mode runs without an LMS.
Pick the entry point
- Vanilla / any framework:
import { createScormSession } from '@studiolxd/scorm' - React:
import { ScormProvider, useScorm, useScormSession } from '@studiolxd/scorm/react' - Vue:
import { useScorm } from '@studiolxd/scorm/vue' - Angular (>=17):
import { provideScorm, SCORM } from '@studiolxd/scorm/angular' - Svelte:
import { createScormStore } from '@studiolxd/scorm/svelte' - Web Component:
import '@studiolxd/scorm/wc'then<scorm-session> - CDN
<script>: globalwindow.Scorm
The golden rules
- Always check
.okbefore.value. Every API method returnsResult<T, ScormError>. Session lifecycle methods returnundefinedwhen no SCORM API was found (noLmsBehavior: 'error'). - Lifecycle order:
initialize()→ interact →commit()→terminate(). Never call data methods beforeinitialize(). - Use mock mode for dev/tests:
createScormSession('2004', { noLmsBehavior: 'mock' }). - A terminated session cannot be re-initialized (SCORM rule). Create a new session
(or remount the React provider with a changed
key) to start over. version: 'auto'detects the host LMS (SCORM 2004 first, then 1.2).
Canonical vanilla example
import { createScormSession } from '@studiolxd/scorm';
const session = createScormSession('auto', { noLmsBehavior: 'mock' });
session.initialize();
const name = session.api?.getLearnerName();
if (name?.ok) console.log(name.value);
session.api?.setScore({ raw: 80, min: 0, max: 100 }); // 1.2: raw/min/max must be 0–100
session.api?.setComplete();
session.commit();
session.terminate();
Lifecycle helpers (don't hand-roll unload handling)
import { autoTerminate, autoCommit } from '@studiolxd/scorm';
const stopTerm = autoTerminate(session); // init now; commit+terminate on unload/dispose
const stopCommit = autoCommit(session, 30_000); // flush every 30s
// later: stopTerm(); stopCommit();
React: useScormAutoTerminate() and useScormAutoCommit(ms) do this for you.
Common gotchas (these cause real bugs)
- SCORM 1.2 interactions are write-only:
getInteraction()errors (code 404) in 1.2; only SCORM 2004 can read them back. - SCORM 1.2 score
raw/min/maxmust be 0–100 (error 405 otherwise). 2004scaledmust be -1..1 (error 407). setProgressMeasureis a no-op in SCORM 1.2.setSessionTime(ms)takes milliseconds; it formats per version internally.recordInteraction(index, record)— index is the FIRST argument.addLearnerComment(comment, location?, timestamp?)— location before timestamp.- SSR (Next.js/Remix): the core is SSR-safe; import
/wcon the client only.
ScormError fields
code, errorString, operation, path, diagnostic, version, apiFound, initialized.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.