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 agentmods add skills/stephansama/packages/react-typed-eventsnpx skills add stephansama/packages --skill react-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/react-typed-events)<a href="https://agentmods.dev/skills/stephansama/packages/react-typed-events"><img src="https://agentmods.dev/badge/skills/stephansama/packages/react-typed-events.svg" alt="Measured on agentmods" 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 | $0.00063 | $0.00895 |
| Opus 5 | $0.00032 | $0.00447 |
| Sonnet 5 | $0.00013 | $0.00179 |
| Haiku 4.5 | $0.00006 | $0.00089 |
Grade A, and why
react-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 4d 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.
This is a copy
86% identical to data-migration — 176 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.
typed-events — React
This skill builds on typed-events. Read it first for foundational concepts including factory selection, cleanup patterns, and SSR behaviour.
Setup
import * as z from "zod";
import { createBroadcastEvent } from "@stephansama/typed-events";
import { useListeners } from "@stephansama/typed-events/react";
export const appEvents = createBroadcastEvent("my-app", {
update: z.object({ value: z.number() }),
reset: z.object({}),
});
Hooks and Components
useListener — single event
import { useListener } from '@stephansama/typed-events/react';
import { animationEvent } from './events';
function Canvas() {
useListener(animationEvent, ({ data }) => {
draw(data.x, data.y);
});
return <canvas />;
}
Registers the listener on mount and removes it on unmount via useEffect cleanup.
useListeners — multiple events from a map
import { useMemo } from 'react';
import { useListeners } from '@stephansama/typed-events/react';
import { appEvents } from './events';
function Dashboard() {
const handlers = useMemo(() => ({
update: ({ data }: { data: { value: number } }) => setValue(data.value),
reset: () => setValue(0),
}), []);
useListeners(appEvents, handlers);
return <div />;
}
Registers all handlers on mount and removes them all on unmount.
Common Mistakes
HIGH Inline listener object triggers re-registration every render
Wrong:
function MyComponent() {
useListeners(appEvents, {
update: ({ data }) => setValue(data.value), // new object each render
});
}
Correct:
function MyComponent() {
const handlers = useMemo(
() => ({
update: ({ data }) => setValue(data.value),
}),
[],
);
useListeners(appEvents, handlers);
}
useListeners has [map, listeners] in its useEffect dependency array. An inline object literal is a new reference every render, causing the effect to re-run: the old listener is removed and a new one is registered on every render.
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.
- 4d ago First seen · 146 lines · 63 tokens per session scan A 2674dade9d41
react-typed-events is a skill published in the GitHub repository stephansama/packages (5 stars, last pushed 1mo ago), licensed MIT. It adds 63 tokens to every session and 895 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. It is 86% identical to data-migration, differing in 176 lines, and is treated as a copy.
Other skills, from other repositories
compiler-orchestrator
Orchestrate the Rust compiler port end-to-end. Discovers the current frontier, fixes failing passes, ports new passes, reviews, and commits in a loop.
plan-update
Use when you need to update a plan document with deep research across all compiler passes. Launches parallel subagents to analyze how a topic affects every compiler phase, then consolidates findings into the plan doc.
feature-flags
Use when feature flag tests fail, flags need updating, understanding @gate pragmas, debugging channel-specific test failures, or adding new flags to React.
compiler-commit
Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits with the [compiler] or [rust-compiler] prefix.
compiler-port
Port a compiler pass from TypeScript to Rust. Gathers context, plans the port, implements in a subagent with test-fix loop, then reviews.
test
Use when you need to run tests for React core. Supports source, www, stable, and experimental channels.