AGENT SKILL

scorm-xapi-interoperability

Implement e-learning interoperability standards including SCORM 1.2, SCORM 2004, Experience API (xAPI / Tin Can), and CMI5. Author compliant imsmanifest.xml packages, handle browser-to-LMS SCORM JavaScript API communication (LMSInitialize, LMSSetValue, cmi.core.lesson_status), emit xAPI Actor-Verb-Object statements, and synchronize with Learning Record Stores (LRS). Trigger when building e-learning courses, LMS integrations, or training tracking modules.

License 许可
MIT
最近更新
2026-10-17
Stars
★ 8
Forks
1

01 前言 Front Matter

name
scorm-xapi-interoperability
metadata
{ "category": "EdTech and Learning Management Systems" }
description
Implement e-learning interoperability standards including SCORM 1.2, SCORM 2004, Experience API (xAPI / Tin Can), and CMI5. Author compliant imsmanifest.xml packages, handle browser-to-LMS SCORM JavaScript API communication (LMSInitialize, LMSSetValue, cmi.core.lesson_status), emit xAPI Actor-Verb-Object statements, and synchronize with Learning Record Stores (LRS). Trigger when building e-learning courses, LMS integrations, or training tracking modules.
compatibility
SCORM 1.2 / 2004 4th Ed, xAPI 1.0.3, CMI5 specification

03 SKILL.md 正文

SCORM & xAPI Interoperability Skill Guide

This skill governs standard implementation of interactive e-learning communication protocols, SCORM packaging manifests, and xAPI statement streaming to Learning Record Stores (LRS).


1. E-Learning Standard Architectural Comparison

+-----------------------+---------------------------------------+---------------------------------------+
| Feature               | SCORM (1.2 / 2004)                   | xAPI (Tin Can) / CMI5                 |
+-----------------------+---------------------------------------+---------------------------------------+
| Environment           | Browser iframe inside LMS only        | Anywhere (Web, Mobile, VR, Offline)   |
| Communication         | Window JavaScript object (`API_1484`) | REST API (HTTP JSON Statements)       |
| Data Model            | CMI data elements (pass/fail, score)  | Actor-Verb-Object + Context Extensions|
| Storage Target        | LMS Database                          | Learning Record Store (LRS)           |
+-----------------------+---------------------------------------+---------------------------------------+

2. Production Code Implementations

A. SCORM 1.2 JavaScript Bridge Interface (Client-Side)

class SCORM12Bridge {
  constructor() {
    this.api = this.findLMSAPI(window);
    this.isInitialized = false;
  }

  findLMSAPI(win) {
    let attempts = 0;
    while (!win.API && win.parent && win.parent !== win && attempts < 10) {
      attempts++;
      win = win.parent;
    }
    return win.API || null;
  }

  initialize() {
    if (!this.api) {
      console.warn("[SCORM] No LMS API found. Running in standalone preview mode.");
      return false;
    }
    const result = this.api.LMSInitialize("");
    this.isInitialized = result === "true";
    return this.isInitialized;
  }

  setScore(scoreRaw, min = 0, max = 100) {
    if (!this.isInitialized) return;
    this.api.LMSSetValue("cmi.core.score.raw", String(scoreRaw));
    this.api.LMSSetValue("cmi.core.score.min", String(min));
    this.api.LMSSetValue("cmi.core.score.max", String(max));
  }

  completeCourse(passed = true) {
    if (!this.isInitialized) return;
    const status = passed ? "passed" : "failed";
    this.api.LMSSetValue("cmi.core.lesson_status", status);
    this.api.LMSCommit("");
  }

  terminate() {
    if (!this.isInitialized) return;
    this.api.LMSFinish("");
    this.isInitialized = false;
  }
}

B. xAPI Statement Dispatcher to LRS (TypeScript / Node.js)

import axios from "axios";

export interface XAPIStatement {
  actor: {
    name: string;
    mbox: string; // e.g. "mailto:learner@example.com"
  };
  verb: {
    id: string; // e.g. "http://adlnet.gov/expapi/verbs/completed"
    display: { "en-US": string };
  };
  object: {
    id: string; // Activity IRI
    definition: {
      name: { "en-US": string };
      description: { "en-US": string };
    };
  };
  result?: {
    score?: { scaled: number; raw: number; min: number; max: number };
    success?: boolean;
    completion?: boolean;
    duration?: string; // ISO 8601 duration: e.g. "PT15M30S"
  };
}

export class LRSClient {
  constructor(
    private readonly endpointUrl: string,
    private readonly authKey: string,
    private readonly authSecret: string
  ) {}

  public async sendStatement(statement: XAPIStatement): Promise<string> {
    const credentials = Buffer.from(`${this.authKey}:${this.authSecret}`).toString("base64");

    const response = await axios.post(
      `${this.endpointUrl.replace(/\\/$/, "")}/statements`,
      statement,
      {
        headers: {
          "Content-Type": "application/json",
          "X-Experience-API-Version": "1.0.3",
          Authorization: `Basic ${credentials}`,
        },
      }
    );

    return response.data[0]; // Returns recorded statement UUID
  }
}

3. Best Practices Checklist

  • [ ] LMS API Discovery: Always recurse through window.parent and window.opener up to 10 levels to locate the SCORM API instance in multi-frame LMS setups.
  • [ ] Commit Frequency: Call LMSCommit("") only on major milestone events (chapter finish, quiz submit) to avoid overwhelming LMS backend databases.
  • [ ] xAPI IRIs: Use official ADL vocabulary IRIs (e.g. http://adlnet.gov/expapi/verbs/passed) rather than ad-hoc custom verbs.

04 同仓库更多 Skills

hamzabellouch
hamzabellouch/agent-skills

security-audit

Comprehensive security guidance, source code audit, vulnerability assessment, and penetration test review for codebases, APIs, microservices, CLI tools, libraries, and LLM-backed applications. Triggers on requests to audit a codebase, conduct security reviews, find vulnerabilities or flaws, pen-test source code, or when the user asks in Arabic (فحص أمني، تدقيق الكود أمنياً، مراجعة الثغرات، فحص أمان المشروع). Supports Guidance mode (focused review) and Full Audit mode (deterministic 6-phase harness).

★ 8
hamzabellouch
hamzabellouch/agent-skills

malware-analysis-reversing

Production malware analysis workflows, reverse engineering methodologies, isolated sandbox triage, static/dynamic binary analysis, memory forensics, and YARA detection rule authoring.

★ 8
hamzabellouch
hamzabellouch/agent-skills

application-security-pentesting

Production Application Security (AppSec) standards, OWASP Top 10 vulnerability remediation, SAST/DAST pipeline integration, secure code review, threat modeling, and defensive security posture.

★ 8
hamzabellouch
hamzabellouch/agent-skills

oauth2-oidc-security-flows

Implement enterprise OAuth 2.1 and OpenID Connect (OIDC) authorization code flow with Proof Key for Code Exchange (PKCE), state and nonce verification, refresh token rotation, token revocation, and centralized IdP federation (Keycloak, Auth0, Okta). Trigger when building secure authentication, single sign-on (SSO), or third-party delegated authorization.

★ 8
hamzabellouch
hamzabellouch/agent-skills

jwt-session-management-hardening

Harden JWT-based authentication and session lifecycles using asymmetric signing (RS256/EdDSA), JWKS rotation, strict claims validation, Redis-backed sliding window sessions, revocation lists, and secure HttpOnly cookie storage. Trigger when implementing token validation, session revocation, or hardening API authentication.

★ 8
hamzabellouch
hamzabellouch/agent-skills

soc2-compliance-automation

Best practices for implementing SOC 2 Type II compliance controls, continuous evidence collection, infrastructure policy-as-code, and automated security monitoring. Use when automating Trust Services Criteria (Security, Availability, Confidentiality, Processing Integrity, Privacy), audit logging, IAM least privilege, or CI/CD security gates.

★ 8