set-up-modus-event-listeners

set-up-modus-event-listeners is a skill for Cursor from julianoczkowski/create-trimble-app. It costs 26 tokens per session (1,905 once invoked), scanned A, original, MIT.

A guide to connecting Modus web-component events to React using references and effect hooks. Event listeners are code that waits for actions such as clicks or changes; cleanup removes them when they are no longer needed.

In plain words
What is it for?
Use it when a Modus component must respond to events, update React state, or expose event callbacks from a wrapper component.
Why use it?
It helps keep component state synchronized with user interactions and avoids duplicate or stale event handlers.

Skill for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when a Modus component must respond to events, update React state, or expose event callbacks from a wrapper component.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/julianoczkowski/create-trimble-app/set-up-modus-event-listeners
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 julianoczkowski/create-trimble-app --skill set-up-modus-event-listeners
Clone the repo
git clone --depth 1 https://github.com/julianoczkowski/create-trimble-app

Made for: Cursor.

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 set-up-modus-event-listeners

README.md
[![agentmods](https://agentmods.dev/badge/skills/julianoczkowski/create-trimble-app/set-up-modus-event-listeners/github.svg)](https://agentmods.dev/skills/julianoczkowski/create-trimble-app/set-up-modus-event-listeners)
Your own site
<a href="https://agentmods.dev/skills/julianoczkowski/create-trimble-app/set-up-modus-event-listeners"><img src="https://agentmods.dev/badge/skills/julianoczkowski/create-trimble-app/set-up-modus-event-listeners/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.

agentmods 80×15 button for set-up-modus-event-listeners

Your own site · 80×15
<a href="https://agentmods.dev/skills/julianoczkowski/create-trimble-app/set-up-modus-event-listeners"><img src="https://agentmods.dev/badge/skills/julianoczkowski/create-trimble-app/set-up-modus-event-listeners.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,905 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.00026 $0.01905
Opus 5 $0.00013 $0.00953
Sonnet 5 $0.00005 $0.00381
Haiku 4.5 $0.00003 $0.00191

Measured 9d ago against content hash af8d80f3cecf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

set-up-modus-event-listeners 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 9d 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.

templates/react/.cursor/skills/set-up-modus-event-listeners/SKILL.md · 285 lines

How it starts

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

Set Up Modus Event Listeners

Properly set up and clean up event listeners for Modus web components following established patterns.

When to Use

Use this skill when:

  • Adding event handling to any Modus wrapper component
  • Components need to respond to web component events
  • You need to sync React state with web component state
  • Handling user interactions from Modus components

Pattern Overview

All Modus event listeners follow this pattern:

  1. Use useRef to get component reference
  2. Use useEffect to set up listeners
  3. Check for component existence before adding listeners
  4. Create typed handler functions for each event
  5. Conditionally attach listeners based on prop existence
  6. Return cleanup function to remove listeners

Reference Examples

  • Simple events: src/components/ModusCheckbox.tsx:91-150
  • Multiple events: src/components/ModusDropdownMenu.tsx:79-112
  • Complex events: src/components/ModusNavbar.tsx (multiple event handlers)

Basic Template

import { useEffect, useRef } from "react";
import { ModusWcComponent } from "@trimble-oss/moduswebcomponents-react";

export default function ModusComponent({
  onEventName,
}: {
  onEventName?: (event: CustomEvent<EventDetailType>) => void;
}) {
  const componentRef = useRef<HTMLModusWcComponentElement>(null);

  useEffect(() => {
    const component = componentRef.current;
    if (!component) return;

    const handleEventName = (event: Event) => {
      onEventName?.(event as CustomEvent<EventDetailType>);
    };

    if (onEventName) {
      component.addEventListener("eventName", handleEventName);
    }

    return () => {
      if (onEventName) {
        component.removeEventListener("eventName", handleEventName);
      }
    };
  }, [onEventName]);

  return <ModusWcComponent ref={componentRef} />;
}

Multiple Event Handlers

export default function ModusComponent({
  onInputChange,
  onInputFocus,
  onInputBlur,
  onValueChange,
}: {
  onInputChange?: (event: CustomEvent<InputEvent>) => void;
  onInputFocus?: (event: CustomEvent<FocusEvent>) => void;
  onInputBlur?: (event: CustomEvent<FocusEvent>) => void;
  onValueChange?: (event: CustomEvent<boolean>) => void;
}) {
  const componentRef = useRef<HTMLModusWcComponentElement>(null);

  useEffect(() => {
    const component = componentRef.current;
    if (!component) return;

    const handleInputChange = (event: Event) => {
      onInputChange?.(event as CustomEvent<InputEvent>);
    };
    const handleInputFocus = (event: Event) => {
      onInputFocus?.(event as CustomEvent<FocusEvent>);
    };
    const handleInputBlur = (event: Event) => {
      onInputBlur?.(event as CustomEvent<FocusEvent>);
    };
    const handleValueChange = (event: Event) => {
      onValueChange?.(event as CustomEvent<boolean>);
    };

    if (onInputChange)
      component.addEventListener("inputChange", handleInputChange);
    if (onInputFocus)
      component.addEventListener("inputFocus", handleInputFocus);
    if (onInputBlur)
      component.addEventListener("inputBlur", handleInputBlur);
    if (onValueChange)
      component.addEventListener("inputChange", handleValueChange);

    return () => {
      if (onInputChange)
        component.removeEventListener("inputChange", handleInputChange);
      if (onInputFocus)
        component.removeEventListener("inputFocus", handleInputFocus);
      if (onInputBlur)
        component.removeEventListener("inputBlur", handleInputBlur);
      if (onValueChange)
        component.removeEventListener("inputChange", handleValueChange);
    };
  }, [onInputChange, onInputFocus, onInputBlur, onValueChange]);

  return <ModusWcComponent ref={componentRef} />;
}

Read the full file on GitHub · 285 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. 9d ago First seen · 285 lines · 26 tokens per session scan A af8d80f3cecf

Subscribe to this mod's changes

set-up-modus-event-listeners is a skill published in the GitHub repository julianoczkowski/create-trimble-app (3 stars, last pushed 2mo ago), licensed MIT. It adds 26 tokens to every session and 1,905 once invoked, about $0.0001 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-09-03.

Related

Other skills, from other repositories

skillshare-ui-website-style

Skillshare frontend design system for the React dashboard (ui/) and Docusaurus website (website/). Use this skill whenever you: build or modify a dashboard page or component in ui/src/, style or layout website pages or custom CSS in website/, create new React components for the dashboard, add pages to the dashboard…

runkids/skillshare · 147 tokens

antd

Use when the user's task involves Ant Design (antd) — writing antd components, debugging antd issues, querying antd APIs/props/tokens/demos, migrating between antd versions, or analyzing antd usage in a project. Triggers on antd-related code, imports from 'antd', or explicit antd questions.

ant-design/ant-design-cli · 69 tokens

igniteui-wc-choose-components

Identify and select the right Ignite UI Web Components for your app UI, then navigate to official docs, usage examples, and API references.

IgniteUI/igniteui-cli · 34 tokens

igniteui-blazor-generate-from-image-design

Implement Blazor application views from design images using Ignite UI Blazor components. Uses MCP servers (igniteui-cli, igniteui-theming) to discover components, generate themes, and follow best practices. Triggers when the user provides a design image (screenshot, mockup, wireframe) and wants it built as a working…

IgniteUI/igniteui-cli · 127 tokens

igniteui-wc-customize-component-theme

Customize Ignite UI Web Components styling using CSS custom properties, optional Sass, and the igniteui-theming MCP server for AI-assisted theming.

IgniteUI/igniteui-cli · 37 tokens

igniteui-wc-generate-from-image-design

Implement application views from design images using Ignite UI Web Components. Uses MCP servers (igniteui-cli, igniteui-theming) to discover components, generate themes, and follow best practices. Triggers when the user provides a design image (screenshot, mockup, wireframe) and wants it built as a working view with…

IgniteUI/igniteui-cli · 121 tokens