typed-events

typed-events is a skill for Claude Code, Codex from stephansama/packages. It costs 80 tokens per session (1,826 once invoked), scanned A, original, MIT.

A TypeScript wrapper around browser messaging features: page events, communication between browser tabs, and messages sent to iframes or other windows. It checks event data against schemas before delivering it.

In plain words
What is it for?
Use it for typed custom events within a page, grouped event maps, state sharing across tabs, combined local-and-tab events, and messages to iframes or cross-origin windows.
Why use it?
It reduces the chance that browser messages contain the wrong data shape and provides one consistent way to send and receive them. Listeners can also be removed through a returned cleanup function.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for typed custom events within a page, grouped event maps, state sharing across tabs, combined local-and-tab events, and messages to iframes or cross-origin windows.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/stephansama/packages/typed-events
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add stephansama/packages --skill typed-events
Clone the repo
git clone --depth 1 https://github.com/stephansama/packages

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for typed-events

README.md
[![agentmods](https://agentmods.dev/badge/skills/stephansama/packages/typed-events.svg)](https://agentmods.dev/skills/stephansama/packages/typed-events)
Your own site
<a href="https://agentmods.dev/skills/stephansama/packages/typed-events"><img src="https://agentmods.dev/badge/skills/stephansama/packages/typed-events.svg" alt="Measured on agentmods" height="20"></a>
Per session 80 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,826 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00080 $0.01826
Opus 5 $0.00040 $0.00913
Sonnet 5 $0.00016 $0.00365
Haiku 4.5 $0.00008 $0.00183

Measured 7d ago against content hash 7126183bb83d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

typed-events scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

core/typed-events/skills/typed-events/SKILL.md · 256 lines

How it starts

The opening of the file, as written. The whole thing — 256 lines — stays where its author put it; the contents beside it link to each section on GitHub.

typed-events

Typed, schema-validated wrappers for native browser event APIs. Each factory returns an object with dispatch() and listen()listen() returns a cleanup function.

Choosing the right factory

Goal Use
Fire an event on the current page createEvent
Group related events under a namespace createEventMap
Sync state across browser tabs createBroadcastChannel
Fire locally AND across tabs simultaneously createBroadcastEvent
Send a message to an iframe or cross-origin window createMessage

Setup

import * as z from "zod";
import { createEvent } from "@stephansama/typed-events";

export const animationEvent = createEvent(
  "my-app:animation",
  z.object({ x: z.number(), y: z.number() }),
);

Core Patterns

Single validated CustomEvent

import * as z from "zod";
import { createEvent } from "@stephansama/typed-events";

export const clickEvent = createEvent(
  "my-app:click",
  z.object({ id: z.string() }),
);

// dispatch
clickEvent.dispatch({ id: "btn-1" });

// listen — store cleanup and call it when done
const cleanup = clickEvent.listen(({ data }) => {
  console.log(data.id);
});
// later:
cleanup();

Namespaced event map (group related events)

import * as z from "zod";
import { createEventMap } from "@stephansama/typed-events";

export const formEvents = createEventMap("form", {
  submit: z.object({ values: z.record(z.string()) }),
  reset: z.object({}),
});

formEvents.dispatch("submit", { values: { email: "[email protected]" } });

const cleanup = formEvents.listen("submit", ({ data }) => {
  console.log(data.values);
});

Event names are scoped internally as form:submit and form:reset.

Cross-tab sync with BroadcastChannel

import * as z from "zod";
import { createBroadcastChannel } from "@stephansama/typed-events";

export const tabChannel = createBroadcastChannel("my-app", {
  theme: z.object({ mode: z.enum(["light", "dark"]) }),
});

tabChannel.dispatch("theme", { mode: "dark" });

const cleanup = tabChannel.listen("theme", ({ data }) => {
  document.documentElement.dataset.theme = data.mode;
});

Read the full file on GitHub · 256 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 256 lines · 80 tokens per session scan A 7126183bb83d

Subscribe to this mod's changes

typed-events is a skill published in the GitHub repository stephansama/packages (5 stars, last pushed 1mo ago), licensed MIT. It adds 80 tokens to every session and 1,826 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

onejs-setup-and-overview

Use this skill whenever the user wants to build or set up user interface in a Unity project using OneJS, React, TypeScript, or JSX, e.g. 'add a main menu to my game', 'build a settings screen', 'make a HUD', 'set up OneJS', 'my OneJS panel is blank', 'the UI is not hot reloading'. Covers confirming OneJS is installed…

Singtaa/OneJS · 199 tokens

photo-sphere-viewer

Use when displaying 360-degree panoramic images (equirectangular/cubemap/dual-fisheye) in web applications, building virtual tours with markers and transitions, embedding interactive panoramas in Vue/React/vanilla JS, or creating 360-degree video players with gyroscope VR support. Photo-Sphere-Viewer v5: JavaScript…

znlgis/opengis-skills · 99 tokens

javascript-expert

Expert-level JavaScript development with modern ES2024+ features, Node.js, npm ecosystem, and best practices. Use when the user mentions ECMAScript, ES2024, Node.js, npm, or web, or when the task involves Modern JavaScript, Node.js Development, Modern Tooling, or Functional Programming.

personamanagmentlayer/pcl · 69 tokens

typescript-expert

Expert-level TypeScript development with modern tooling, advanced types, and best practices. Use this skill for TypeScript projects requiring type-safe code, modern bundling, and comprehensive testing.

personamanagmentlayer/pcl · 40 tokens

javascript-development

JavaScript/TypeScript ES2024+, async/await, DOM manipulation, Node.js, and API integration. Use when writing vanilla JS/TS code, working with REST/fetch APIs, implementing frontend logic, or configuring JS build tools.

PracticalSwan/agent-skills · 52 tokens

pixi-vn-getting-started

Use when setting up a new or existing project on @drincs/pixi-vn, wiring the main.ts entry point, or calling the top-level Game API (Game.init, Game.start, Game.onEnd, Game.addOnError, Game.onNavigate, Game.clear) — this is the entry point every Pixi'VN project needs before touching canvas, narration, sound, storage…

DRincs-Productions/pixi-vn · 90 tokens