Install any skill in seconds. Free to start, no credit card required.
Get Started Free →webiny/webiny-event-handler-pattern
EventHandler implementation pattern — handle method, event payloads, filtering, DI, domain event definition, publishing events from UseCases, and reacting to external events.
Passed 21 of 22 test cases with the skill, and 13 of 22 without it.
and 13 more in the full report
9 fixed12 passed either way0 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 9 test cases the skill fixed. Same model, same prompt, with and without the skill.
I am registering a Webiny handler extension in my API application using the Api.Extension component. Should the src prop be src={"@/extensions/my-handler"} or src={"@/extensions/my-handler.ts"}? Show the JSX snippet.
| Checked | Without skill | With skill |
|---|---|---|
| The src prop includes the explicit .ts extension in the file path | Missed | Passed |
The instructions your model reads when the skill loads.
An EventHandler reacts to domain events in the Webiny lifecycle (e.g., EntryBeforeCreateEventHandler, TenantAfterDeleteEventHandler). Each handler is a DI abstraction with a single handle method.
{Entity}Before{Operation}EventHandler — fires before persistence, can validate/transform/reject{Entity}After{Operation}EventHandler — fires after persistence, for side effectsinterface SomeEventHandler.Interface {
handle(event: SomeEventHandler.Event): Promise<void>;
}
The Event is a DomainEvent<Payload> where the payload contains the entity and input data.
Never put business logic directly inside an EventHandler. EventHandlers are thin orchestrators — they receive an event and delegate to an injected service or use case. The real logic lives in a dedicated abstraction.
Why: Inline handler logic cannot be reused by other handlers, GraphQL resolvers, or CLI commands.
Always follow this structure:
features/
├── myService/ ← the reusable abstraction
│ ├── abstractions.ts
│ ├── feature.ts
│ └── MyService.ts
└── syncOnCreate/ ← thin handler that injects the service
├── feature.ts
└── EntryAfterCreateHandler.ts
test cases passed, vs 13 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.