用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/megazear7/spinder --skill spinder-event-management命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | spinder-event-management |
| description | Create, dispatch, and listen to custom events in the Spinder app using the Zod-validated event system. |
This skill helps implement the custom event system used throughout the Spinder application for component communication, following the Zod-validated event pattern.
Use this skill when you need to:
The Spinder event system uses:
src/client/event.<event-name>.tssrc/client/util.events.tsdispatch utilityimport z from "zod";
export const ExampleEventName = z.literal("ExampleEvent");
export type ExampleEventName = z.infer<typeof ExampleEventName>;
export const ExampleEventDetail = z.object({
someData: z.string(),
count: z.number().optional(),
});
export type ExampleEventDetail = z.infer<typeof ExampleEventDetail>;
export const ExampleEventData = z.object({
name: ExampleEventName,
detail: ExampleEventDetail,
});
export type ExampleEventData = z.infer<typeof ExampleEventData>;
export const ExampleEvent = (someData: string, count?: number): ExampleEventData => ({
name: ExampleEventName.value,
detail: { someData, count },
});
In src/client/util.events.ts, add your event to the SpinderEvent union:
export const SpinderEvent = z.union([
// ... existing events
ExampleEventData,
// ... more events
]);
Use the dispatch utility function to send events:
import { dispatch } from "./util.events.js";
import { ExampleEvent } from "./event.example.js";
// In a component method
private handleAction(): void {
dispatch(this, ExampleEvent("some value", 42));
}
Listen to events in components or providers:
import { ExampleEvent } from "./event.example.js";
override connectedCallback(): void {
super.connectedCallback();
this.addEventListener(ExampleEvent.name, this.handleExampleEvent);
}
private handleExampleEvent = (event: Event): void => {
const customEvent = event as CustomEvent;
const eventData = customEvent.detail as ExampleEventDetail;
// Handle the event
console.log(eventData.someData, eventData.count);
};
event.<kebab-case>.ts<EventName>EventComponents dispatch events that providers listen to for state updates.
Providers update context that components consume.
Use events for cross-component communication through a common parent.
stopPropagation() if needed with stopProp() utilityCreate and manage expense categorization buckets in the Spinder app, including filtering logic and data aggregation.
Create new Lit-based components for the Spinder expense tracking app, following the project's coding standards and architecture patterns.
Debug issues in the Spinder expense tracking app, including transaction processing, UI rendering, and data flow problems.