Agent skill

Add Event

by openplayerjs in openplayerjs/openplayerjs

Add, rename, change the payload of, or remove a typed player event in OpenPlayerJS.

MITAuto-check passed

Install Add Event

skills CLI
$ npx skills add openplayerjs/openplayerjs --skill add-event -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install openplayerjs/openplayerjs add-event --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/openplayerjs/openplayerjs.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/add-event .claude/skills/add-event && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
add-event
GitHub stars
649
Token cost
~1.7k tokens
SKILL.md length
809 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

Add, rename, change the payload of, or remove a typed player event in OpenPlayerJS.

  • Works in 6 steps: Classify the event → Name and shape the payload → Declare the type → …
  • A task involves PlayerEventPayloadMap
  • SKILL.md covers Step 0 — Classify the event, Step 1 — Name and shape the…, Step 2 — Declare the type and Step 3 — Emit and consume, plus 5 more sections
  • Calls pnpm

What it does

Add Event is an agent skill from openplayerjs/openplayerjs. Add, rename, change the payload of, or remove a typed player event in OpenPlayerJS. Use whenever a task involves PlayerEventPayloadMap, EventBus events, cmd: commands, ads: events, or "emit/listen to X". Encodes the core-vs-package routing decision, declaration merging, payload conventions, and the safe-removal procedure.

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It works with TypeScript. The repository describes itself as: Lightweight HTML5 video/audio player with smooth controls and ability to play VAST/VMAP/SIMID/OMID/non-linear ads. The licence is MIT.

When your agent uses it

  • A task involves PlayerEventPayloadMap
  • EventBus events
  • Emit/listen to X

Example prompts

  • “emit/listen to X”
  • “/add-event”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Classify the event
  2. Name and shape the payload
  3. Declare the type
  4. Emit and consume
  5. Test
  6. Document

What it can do on your machine

Read from SKILL.md and the folder at commit c26914a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pnpm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pnpm, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Add Event loads about 1.7k tokens when it runs. Until then it costs about 84 tokens; SKILL.md has 809 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~84
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from openplayerjs/openplayerjs at commit c26914a, republished under its MIT licence (© openplayerjs). 809 words, ~1,663 tokens.

Download SKILL.mdSave it as .claude/skills/add-event/SKILL.md (or your agent's skills folder).
name
add-event
description
Add, rename, change the payload of, or remove a typed player event in OpenPlayerJS. Use whenever a task involves PlayerEventPayloadMap, EventBus events, cmd:* commands, ads:* events, or "emit/listen to X". Encodes the core-vs-package routing decision, declaration merging, payload conventions, and the safe-removal procedure.

Add / change / remove a player event

Events are the most rule-dense surface in this repo. Every step below exists because skipping it has broken something before. Work through the steps in order; do not improvise.

Step 0 — Classify the event

Answer one question: who emits it?

EmitterClassificationWhere the type goes
Core, StateManager, surfaces, DefaultMediaEngine, track plumbingKernel eventPlayerEventPayloadMap interface in packages/core/src/core/events.ts
Any other package (ads, player UI, hls, youtube, external plugins)Package eventThat package's src/events.ts declaration-merging augmentation

Hard rules:

  • Core's map may contain ONLY: lifecycle, cmd:* commands, HTML5-native names (playing, pause, ended, loadedmetadata, …), track events, source:set, player:interacted.
  • If you find yourself editing packages/core/src/core/events.ts for an ads:*, hls:*, ui:*, or zoom:* key — stop, you are in the wrong file.
  • If the emitting package is unclear (e.g. core emits it but only ads consumes it), it is a kernel event only if core can describe the payload without importing any package concept. Otherwise redesign so the package emits it.

Step 1 — Name and shape the payload

Naming:

  • cmd:<verb> — player→engine command (cmd:play, cmd:seek). Kernel only.
  • <pkg-prefix>:<noun>[:<phase>] — package events (ads:break:start, ui:menu:open).
  • Never a bare untyped string; never dot-notation (ads.foo was migrated away — colon only).

Payload conventions (follow existing shapes, don't invent parallel ones):

  • A break descriptor is { id: string; kind: string } carried under a break property.
  • Flat id references use breakId (e.g. ads:quartile: { breakId, quartile: 25|50|75|100 }).
  • Paired events (X:open/X:close, X:start/X:end) must both exist and both be emitted — the player package relies on pairing (e.g. menu open/close gates the auto-hide timer).
  • Error payloads: { reason?, error?, message?, owner? } (see ads:error).

Step 2 — Declare the type

Kernel event: add the key to the PlayerEventPayloadMap interface in packages/core/src/core/events.ts. Do not convert the interface to a type — it is the one sanctioned interface (declaration merging requires it).

Package event: edit (or create) packages/<pkg>/src/events.ts:

ts
import '@openplayerjs/core';

declare module '@openplayerjs/core' {
  // eslint note: this augments core's sanctioned interface
  interface PlayerEventPayloadMap {
    'my:event': MyPayload;
  }
}

Then verify the side-effect import exists in packages/<pkg>/src/index.ts:

ts
import './events';

If you created events.ts and forget this import, everything compiles locally but consumers of the published package silently lose the typing. Check it explicitly.

If the package keeps a union of its own events (ads has AdsEvent in src/types.ts), update it in the same commit — the augmentation and the union must stay in sync.

Special case — HLS: it deliberately has NO events.ts. It drives the player through standard core events only. Before adding an HLS event, confirm a real consumer exists (three HLS events were removed in Jun 2026 because nothing listened). Duration/live/ID3 metadata already flow through native channels — do not re-add events for them.

Step 3 — Emit and consume

  • Emit: ctx.events.emit('my:event', payload) — payload type is enforced.
  • Subscribe in a plugin: ctx.on('my:event', cb) (auto-disposed) — never a bare events.on without registering the unsubscriber in ctx.dispose.
  • Subscribe in a control: this.onPlayer('my:event', cb).
  • Timing rule: if the emit sits anywhere in the Core.play() → cmd:play path, it must not introduce an await/microtask before cmd:play fires (Safari user-gesture context).
Show full SKILL.md (339 more words)Show less

Step 4 — Test

Minimum tests for a new event (in the owning package's __tests__/):

  1. Emission: drive the real trigger (not the emit itself) and assert the callback got the exact payload shape — assert every property, not just truthiness.
  2. Typing: subscribing through core.on('my:event', (p) => …) compiles with the precise payload type (this is implicit if the test file uses the typed callback).
  3. Pairing/cleanup, when applicable: the paired close/end event fires; unsubscribe on destroy.

Step 5 — Document

  • Add the event to the owning package's README event table (payload shape included).
  • If the event encodes a behavioral rule (ordering, pairing, sync requirement), add one line to that package's CLAUDE.md.

Renaming or changing a payload

This is a breaking change for downstream consumers. Stop and confirm with the user before doing it (manual §7 E1). Once approved:

  1. Change type + all emit sites + all subscribe sites in one commit.
  2. grep -rn "'old:name'" packages/ until it returns nothing. If .claude/CLAUDE.local.md lists other local consumer repos, grep and type-check those per its instructions.
  3. Run pnpm run type-check.
  4. Commit as feat(<scope>)!: or include a BREAKING CHANGE: footer so the release orchestrator bumps major.

Removing an event

Never trust "no typed listener" as proof of death — tests subscribe by string.

  1. grep -rn "'the:event'" packages/ — check src, __tests__/, e2e/, examples/.
  2. Same grep in any local consumer repos listed in .claude/CLAUDE.local.md, if present.
  3. Only when all hits are the emit itself: delete the emit, the type entry, and the union entry together. If the package's events.ts becomes empty, delete the file AND its import './events' line.
  4. Run the full test suite; a hanging/timing-out test means you missed a subscriber.

Final checklist

  • Type declared in the correct home (kernel map vs package augmentation)
  • import './events' present in the package's index.ts (package events)
  • Package event-union (e.g. AdsEvent) updated if one exists
  • Emission test asserts the full payload shape
  • README event table updated
  • pnpm run type-check && pnpm run lint && pnpm run test green
  • Breaking change? → user approved + both monorepos type-check + !/footer in commit

© openplayerjs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/add-event of openplayerjs/openplayerjs.

Open the folder on GitHubat commit c26914a

Compare with similar skills

Add Event next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Add Event compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Add Event this skillopenplayerjs/openplayerjs649—~1.7kAutomated safety check: PassMIT
MCP Server Builderanthropics/skills180k62 repos~2.3kAutomated safety check: PassApache-2.0
Web Artifacts Builderanthropics/skills180k40 repos~769Automated safety check: PassApache-2.0
Typescript Advanced Typesrolling-scopes/rsschool-app10k24 repos~4.2kAutomated safety check: PassMPL-2.0
Code Review ChecklistshareAI-lab/learn-claude-code78k5 repos~1.1kAutomated safety check: PassMIT
MCP Server BuildershareAI-lab/learn-claude-code78k5 repos~1.2kAutomated safety check: PassMIT

Similar skills

  • MCP Server Builder

    anthropics/skills

    Official

    Guides the design and implementation of Model Context Protocol servers in TypeScript or Python, from tool naming and error messages to evaluation.

    180k GitHub starsUsed in 62 repos~2.3k tokens
    Agent WorkflowsAuto-check passed
  • Web Artifacts Builder

    anthropics/skills

    Official

    Builds multi-component claude.ai HTML artifacts as a small React, TypeScript and Tailwind project, then bundles it into one shareable HTML file.

    180k GitHub starsUsed in 40 repos~769 tokens
    Frontend & DesignAuto-check passed
  • Typescript Advanced Types

    rolling-scopes/rsschool-app

    Master TypeScript's advanced type system including generics, conditional types, mapped types, template literals, and utility types for building type-safe applications.

    10k GitHub starsUsed in 24 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 5 repos~1.1k tokens
    DevelopmentAuto-check passed
  • MCP Server Builder

    shareAI-lab/learn-claude-code

    Walks through building MCP servers in Python or TypeScript that expose tools, resources and prompts to Claude, with templates, registration and testing.

    78k GitHub starsUsed in 5 repos~1.2k tokens
    Agent WorkflowsAuto-check passed
  • Nx Import

    nrwl/nx

    Import, merge, or combine repositories into an Nx workspace using nx import.

    29k GitHub starsUsed in 5 repos~3.5k tokens
    DevelopmentAuto-check passed

More from openplayerjs/openplayerjs

  • Audit Fix

    openplayerjs/openplayerjs

    Resolve a pnpm audit (dependency-audit CI job) failure — high/critical CVEs in the dependency tree.

    649 GitHub stars~1k tokensUpdated yesterday
    Auto-check passed
  • Preship

    openplayerjs/openplayerjs

    Run the full OpenPlayerJS verification gauntlet before committing, opening a PR, or preparing a release.

    649 GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed
  • Write Tests

    openplayerjs/openplayerjs

    Write or extend Jest tests for OpenPlayerJS to this repo's exact conventions — makeCore factories, typed internals handles instead of as any, media property mocking, fake timers, ads/vast mocks, and…

    649 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Optimize

    openplayerjs/openplayerjs

    Find and safely apply ONE worthwhile code optimization (reuse, simplification, efficiency, or a dead-weight cleanup) somewhere in packages//src, with new regression tests proving behavior is…

    649 GitHub stars~1.9k tokensUpdated yesterday
    Auto-check passed

Works with

Questions about Add Event

What does Add Event do?

Add, rename, change the payload of, or remove a typed player event in OpenPlayerJS. Add Event is an agent skill from openplayerjs/openplayerjs. Add, rename, change the payload of, or remove a typed player event in OpenPlayerJS.

When should I use Add Event?

Add Event fits situations like: A task involves PlayerEventPayloadMap; eventBus events; emit/listen to X.

How do I install Add Event in Claude Code?

Run `npx skills add openplayerjs/openplayerjs --skill add-event -a claude-code`. Or copy the skill folder (.claude/skills/add-event in openplayerjs/openplayerjs) into .claude/skills/add-event in your project. Claude Code loads it when a task matches its description.

How do I install Add Event in Codex?

Run `npx skills add openplayerjs/openplayerjs --skill add-event -a codex`. Or copy the skill folder (.claude/skills/add-event in openplayerjs/openplayerjs) into .agents/skills/add-event in your project. Codex loads it when a task matches its description.

Can I use Add Event in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add openplayerjs/openplayerjs --skill add-event -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/add-event, .gemini/skills/add-event, .github/skills/add-event and .opencode/skills/add-event in your project.

What does Add Event need to run?

Going by SKILL.md and its folder, Add Event needs the command-line tools its instructions call (pnpm).

Does Add Event access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Add Event safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Add Event use?

Add Event is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Add Event use?

About 1.7k tokens (SKILL.md is roughly 6.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Add Event?

Skills that share tags, products or a category with Add Event: MCP Server Builder (anthropics/skills, 180k stars), Web Artifacts Builder (anthropics/skills, 180k stars), Typescript Advanced Types (rolling-scopes/rsschool-app, 10k stars) and Code Review Checklist (shareAI-lab/learn-claude-code, 78k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Add Event?

openplayerjs (a GitHub organization) maintains it in openplayerjs/openplayerjs, which has 649 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on October 5, 2026.

Source: openplayerjs/openplayerjs on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.