KS
Killer-Skills

custom-global-events — Categories.community

v1.0.0
GitHub

About this Skill

Perfect for Frontend Agents needing efficient cross-component communication without React context dependencies Slowly cloning t3 chat for fun

raythurnvoid raythurnvoid
[0]
[0]
Updated: 3/4/2026

Quality Score

Top 5%
46
Excellent
Based on code quality & docs
Installation
SYS Universal Install (Auto-Detect)
Cursor IDE Windsurf IDE VS Code IDE
> npx killer-skills add raythurnvoid/experiment--t3-chat/custom-global-events

Agent Capability Analysis

The custom-global-events MCP Server by raythurnvoid is an open-source Categories.community integration for Claude and other AI agents, enabling seamless task automation and capability expansion.

Ideal Agent Persona

Perfect for Frontend Agents needing efficient cross-component communication without React context dependencies

Core Value

Empowers agents to trigger events across different parts of the application using simple function calls, leveraging global events and React context-free communication, with implementations in TypeScript files like global-event.tsx

Capabilities Granted for custom-global-events MCP Server

Triggering events across components
Implementing cross-component communication without React context
Debugging global event triggers in TypeScript applications

! Prerequisites & Limits

  • Requires knowledge of React and TypeScript
  • Limited to applications using global events for cross-component communication
Project
SKILL.md
3.7 KB
.cursorrules
1.2 KB
package.json
240 B
Ready
UTF-8

# Tags

[No tags]
SKILL.md
Readonly

Overview

Global events are used for cross-component communication without React context dependencies, allowing for simple function calls to trigger events across different parts of the application.

Global Events Guidelines

Global events are used for cross-component communication without React context dependencies, allowing for simple function calls to trigger events across different parts of the application.

Overview

The global events system lives at global-event.tsx and is built on a typed Event subclass (XCustomEvent).

It exposes:

  • global_event_Event: the canonical type map of event keys → detail payload types
  • global_event_dispatch(event, payload): dispatch a typed event (works outside React)
  • global_event_listen(event, handler, options?): listen with typed handler (works outside React)
  • useGlobalEvent(event, handler): React hook for subscriptions with stale-closure protection

Event key naming

Event keys are string literals using the pattern:

(module::event_name), for example ai_chat::open_canvas.

How to add or modify an event

When the user requests a new global event, you must:

Update the event map

Add the new event key to the global_event_Event map in global-event.tsx.

Example:

ts
1export class global_event_Event extends XCustomEvent<{ 2 "ai_chat::open_canvas": { 3 pageId: app_convex_Id<"pages">; 4 mode: "diff" | "editor"; 5 modifiedContent?: string; 6 threadId: string; 7 }; 8 "ai_chat::open_canvas_by_path": { 9 path: string; 10 }; 11 "docs::focus_path": { 12 path: string; 13 }; 14}> {}

Keep all event keys centralized

All supported global event keys must be declared in that global_event_Event type map. Do not introduce ad-hoc stringly-typed events elsewhere.

Use the exported helpers

Prefer global_event_dispatch / global_event_listen / useGlobalEvent rather than calling window.dispatchEvent(new CustomEvent(...)) directly.

Usage patterns

React components

Use useGlobalEvent(eventName, handler) to subscribe. The handler receives a typed event object, and the payload is on event.detail.

Example (from canvas.tsx):

ts
1useGlobalEvent("ai_chat::open_canvas", (e) => { 2 const payload = e.detail; 3 // payload.pageId, payload.mode, payload.modifiedContent, payload.threadId 4});

Non-React code (or manual lifecycle control)

Use global_event_listen directly when you need to wire AbortController, or you are outside React.

ts
1const controller = new AbortController(); 2 3const cleanup = global_event_listen( 4 "ai_chat::open_canvas_by_path", 5 (e) => { 6 console.info("path:", e.detail.path); 7 }, 8 { signal: controller.signal }, 9); 10 11// later: 12controller.abort(); 13cleanup();

Dispatching

Use global_event_dispatch(eventName, payload) from anywhere client-side.

Example (from app-ai-chat.tsx):

ts
1global_event_dispatch("ai_chat::open_canvas_by_path", { path: args.path });

Handler typing and payload access

Handlers receive the typed event object, not the payload directly:

ts
1useGlobalEvent("ai_chat::open_canvas", (e) => { 2 const payload = e.detail; 3});

Files and references

Related Skills

Looking for an alternative to custom-global-events or building a Categories.community AI Agent? Explore these related open-source MCP Servers.

View All

widget-generator

Logo of f
f

widget-generator is an open-source AI agent skill for creating widget plugins that are injected into prompt feeds on prompts.chat. It supports two rendering modes: standard prompt widgets using default PromptCard styling and custom render widgets built as full React components.

149.6k
0
Design

chat-sdk

Logo of lobehub
lobehub

chat-sdk is a unified TypeScript SDK for building chat bots across multiple platforms, providing a single interface for deploying bot logic.

73.0k
0
Communication

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
Communication

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
Communication