# Xapi Specification

> This skill should be used when the user asks about "xAPI statement structure", "xAPI verbs", "activity types", "cmi5 specification", "learning record store", "xAPI result format", "interaction types", "xAPI context", or needs to understand Experience API standards for educational assessment tracking. Use when this capability is needed.

- Skill: `tomevault-io/xapi-specification` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/xapi-specification`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/xapi-specification/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/xapi-specification

---


# xAPI Specification Knowledge Base

Provide comprehensive guidance on xAPI (Experience API) specification for educational assessment and learning analytics.

## Core Concepts

### Statement Structure

An xAPI Statement follows the "Actor-Verb-Object" pattern with optional Result and Context:

```json
{
  "actor": { },      // Who performed the action
  "verb": { },       // What action was performed
  "object": { },     // What was acted upon
  "result": { },     // Outcome of the action (optional)
  "context": { },    // Additional context (optional)
  "timestamp": "",   // When the action occurred
  "id": ""           // Unique statement identifier (UUID)
}
```

### Required Fields

1. **Actor** - Agent or Group performing the action
2. **Verb** - Action taken (URI + display name)
3. **Object** - Activity, Agent, or Statement Reference

### Actor Types

**Agent** (single learner):
```json
{
  "objectType": "Agent",
  "name": "Learner Name",
  "mbox": "mailto:learner@example.com"
}
```

**Account-based identification** (recommended for LMS):
```json
{
  "objectType": "Agent",
  "account": {
    "homePage": "https://lms.example.com",
    "name": "user123"
  }
}
```

### Verb Structure

Define verbs with URI identifier and display text:

```json
{
  "id": "http://adlnet.gov/expapi/verbs/answered",
  "display": {
    "en-US": "answered"
  }
}
```

Consult `references/verbs.md` for the complete ADL and cmi5 verb registry.

### Object (Activity) Structure

```json
{
  "objectType": "Activity",
  "id": "https://example.com/activities/quiz-123",
  "definition": {
    "name": { "en-US": "Quiz on xAPI Basics" },
    "description": { "en-US": "A quiz testing knowledge of xAPI" },
    "type": "http://adlnet.gov/expapi/activities/assessment"
  }
}
```

### Result Structure

Capture assessment outcomes:

```json
{
  "score": {
    "scaled": 0.85,
    "raw": 85,
    "min": 0,
    "max": 100
  },
  "success": true,
  "completion": true,
  "response": "choice-a",
  "duration": "PT30S"
}
```

**Duration format**: ISO 8601 duration (PT = Period Time, e.g., PT1H30M = 1 hour 30 minutes)

### Context Structure

Provide additional information about the learning experience:

```json
{
  "registration": "uuid-for-attempt",
  "contextActivities": {
    "parent": [{ "id": "https://example.com/course-123" }],
    "grouping": [{ "id": "https://example.com/program-abc" }],
    "category": [{ "id": "https://w3id.org/xapi/cmi5/context/categories/cmi5" }]
  },
  "platform": "Example LMS",
  "language": "en-US"
}
```

## Interaction Types for Assessments

xAPI supports these interaction types for quiz questions:

| Type | Description | Use Case |
|------|-------------|----------|
| `true-false` | Binary choice | Yes/No, True/False questions |
| `choice` | Multiple choice | Single or multiple selection |
| `fill-in` | Text input | Short answer questions |
| `long-fill-in` | Long text | Essay questions |
| `matching` | Pair matching | Match items from two lists |
| `performance` | Task steps | Procedural tasks |
| `sequencing` | Order items | Arrange in correct sequence |
| `likert` | Scale rating | Survey/opinion questions |
| `numeric` | Number input | Mathematical answers |

Consult `references/interaction-types.md` for detailed examples of each type.

## Activity Types

Common activity types for educational contexts:

| Category | Type URI | Use Case |
|----------|----------|----------|
| Assessment | `http://adlnet.gov/expapi/activities/assessment` | Quizzes, exams |
| Question | `http://adlnet.gov/expapi/activities/cmi.interaction` | Individual questions |
| Course | `http://adlnet.gov/expapi/activities/course` | Course container |
| Module | `http://adlnet.gov/expapi/activities/module` | Course sections |
| Lesson | `http://adlnet.gov/expapi/activities/lesson` | Individual lessons |

Consult `references/activity-types.md` for the complete registry.

## cmi5 Profile

cmi5 is a standardized xAPI profile for e-learning. Key requirements:

1. **Defined verbs**: launched, initialized, completed, passed, failed, abandoned, waived, terminated
2. **Mandatory context**: registration, sessionId, masteryScore
3. **Required extensions**: sessionId, launchMode, launchURL

For cmi5-compliant statements, consult `references/cmi5-profile.md`.

## Statement Generation Workflow

To generate a valid xAPI statement:

1. Identify the **Actor** (learner/user information)
2. Select appropriate **Verb** from ADL registry
3. Define the **Object** (activity being tracked)
4. Include **Result** for assessment outcomes
5. Add **Context** for hierarchical relationships
6. Generate **UUID** for statement ID
7. Add **timestamp** in ISO 8601 format

## Validation Checklist

Validate statements against these criteria:

**Structural validation:**
- [ ] Actor has valid identifier (mbox, account, or openid)
- [ ] Verb has id (URI) and display (language map)
- [ ] Object has id and objectType

**Vocabulary validation:**
- [ ] Verb URI matches ADL/cmi5 registry
- [ ] Activity type URI is valid

**cmi5 validation:**
- [ ] Context includes registration UUID
- [ ] Context includes sessionId extension
- [ ] Correct verb sequence (launched → initialized → ... → terminated)

**Interaction validation:**
- [ ] interactionType matches response format
- [ ] correctResponsesPattern format matches interactionType
- [ ] choices/scale/source/target arrays are valid for type

## Additional Resources

### Reference Files

Detailed specifications and registries:
- **`references/verbs.md`** - Complete ADL and cmi5 verb registry
- **`references/activity-types.md`** - Activity type URIs and usage
- **`references/interaction-types.md`** - Detailed interaction type examples
- **`references/cmi5-profile.md`** - cmi5 requirements and extensions

### External Resources

- [xAPI Specification](https://github.com/adlnet/xAPI-Spec)
- [ADL Vocabulary](https://registry.tincanapi.com/)
- [cmi5 Specification](https://github.com/AICC/CMI-5_Spec_Current)

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/tim80411) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-16 -->

