Back to skills
SKILL.md
607 Event Handler Pattern Ecdb67b4
ASecurity```typescript type SupabaseEventType = 'resource.created' | 'resource.updated' | 'resource.deleted';
- 9 stars
- 0 votes
- 0 copies
- 0 views
- Added October 11, 2026
Security analysis
100/100Pro scans all 2 files and shows the line behind each finding
npx -y skills add tools-only/X-Skills --skill 607-event-handler-pattern_ecdb67b4 --agent claude-codeAre you the author of 607 Event Handler Pattern Ecdb67b4?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/tools-only-607-event-handler-pattern-ecdb67b4)# Event Handler Pattern
## Event Handler Pattern
```typescript
type SupabaseEventType = 'resource.created' | 'resource.updated' | 'resource.deleted';
interface SupabaseEvent {
id: string;
type: SupabaseEventType;
data: Record<string, any>;
created: string;
}
const eventHandlers: Record<SupabaseEventType, (data: any) => Promise<void>> = {
'resource.created': async (data) => { /* handle */ },
'resource.updated': async (data) => { /* handle */ },
'resource.deleted': async (data) => { /* handle */ }
};
async function handleSupabaseEvent(event: SupabaseEvent): Promise<void> {
const handler = eventHandlers[event.type];
if (!handler) {
console.log(`Unhandled event type: ${event.type}`);
return;
}
try {
await handler(event.data);
console.log(`Processed ${event.type}: ${event.id}`);
} catch (error) {
console.error(`Failed to process ${event.type}: ${event.id}`, error);
throw error; // Rethrow to trigger retry
}
}
```Files in this skill
- README.md
- skill.md
Attribution
Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.