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.
npx skills add stephansama/packages --skill typed-eventsgit clone --depth 1 https://github.com/stephansama/packagesWrote 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.
[](https://agentmods.dev/skills/stephansama/packages/typed-events)<a href="https://agentmods.dev/skills/stephansama/packages/typed-events"><img src="https://agentmods.dev/badge/skills/stephansama/packages/typed-events/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/stephansama/packages/typed-events"><img src="https://agentmods.dev/badge/skills/stephansama/packages/typed-events.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00080 | $0.01826 |
| Opus 5.5 | $0.00032 | $0.00730 |
| Sonnet 5.5 | $0.00016 | $0.00365 |
| Haiku 4.5 | $0.00008 | $0.00183 |
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 1mo 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.
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;
});
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.
- 1mo ago First seen · 256 lines · 80 tokens per session scan A 7126183bb83d
typed-events is a skill published in the GitHub repository stephansama/packages (5 stars, last pushed yesterday), licensed MIT. It adds 80 tokens to every session and 1,826 once invoked, about $0.0003 per session on Opus 5.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.
Other skills, from other repositories
psl-ast-layers
How to use the PSL syntax tree layers (green tree, red tree, strongly-typed AST classes) correctly. Use for any PSL-related work: PSL interpreters (contract-psl), helpers inside the psl-parser package, the language server, formatters, or anything else that consumes parse() output from @internal/psl-parser.
ast-visitor-pattern
Use the frozen-class/visitor pattern for discriminated unions that have multiple dispatch sites. Use when creating a new set of variants (commands, IR nodes, factory calls) that will be switched over in 2+ places, or when refactoring an existing union type that has grown multiple switch sites.
no-bare-casts
Writing as in TypeScript or TSX production code, modifying a file that contains a bare as cast, silencing a type error with a cast, encountering as unknown as, or reviewing a cast site.
bumping-biome
Bumps biome package versions (e.g. @biomejs/biome) using pnpm, aligns biome.jsonc files with the new version/s across the repository and runs biome-related checks. Use when required to update biome to a newer version - explicitly or implicitly (e.g. after running pnpm up, pnpm update, pnpm upgrade without specific…
migrate-oxfmt
Guide for migrating a project from Prettier or Biome to Oxfmt. Use when asked to migrate, convert, or switch a project's formatter from Prettier or Biome to Oxfmt.
ax-cpp-ai
Use when writing C++ code with axllm for named deployment profiles, generic provider clients, model selection, OpenAI-compatible calls, Responses, Gemini, Anthropic, routers, and balancers.