npx skills add ...
npx skills add anthropics/claude-agent-sdk-demos --skill listener-creator
Creates event-driven email listeners that monitor for specific conditions (like urgent emails from boss, newsletters to archive, package tracking) and execute custom actions. Use when user wants to be notified about emails, automatically handle certain emails, or set up email automation workflows.
npx skills add anthropics/claude-agent-sdk-demos --skill listener-creator
Creates TypeScript listener files that monitor email events and execute custom logic when conditions are met.
Use this skill when the user wants to:
Listeners are TypeScript files in agent/custom_scripts/listeners/ that:
config object defining the event type and metadatahandler function that filters and processes eventsListenerContext methods to perform actions (notify, archive, star, etc.)The system automatically loads enabled listeners and executes them when matching events occur.
Parse the user's request to identify:
Create a file in agent/custom_scripts/listeners/ with this structure:
Use kebab-case matching the listener's purpose:
boss-urgent-watcher.tsauto-archive-newsletters.tspackage-tracking.tsdaily-summary.tsThe ListenerContext provides these methods:
Default to using context.callAgent() for intelligent decision-making instead of hard-coded keyword lists. This provides better accuracy and adaptability.
Reference the template files for common patterns:
context.callAgent() instead of hard-coded keyword lists for intelligent decision-makingAlways import types from the correct location:
Basic filter (sender/type) → Call AI agent for intelligent classification → Act on AI result → Notify if important
This is the recommended approach for most listeners as it:
Basic filter (sender only) → Notify → Optional star/label
Only use this when: The trigger is purely identity-based (e.g., "notify me about ALL emails from X")
Basic filter → Archive → Mark as read → Optional notify
Run at specific time → Query emails → Analyze → Send summary
When the user requests a listener:
Ask clarifying questions if the intent is unclear:
Choose the right event type (usually email_received)
Write the TypeScript file in agent/custom_scripts/listeners/
Use Write tool to create the file with:
Return listener reference in markdown format using [listener:filename.ts] notation (e.g., [listener:boss-urgent-watcher.ts]) for easy parsing and linking in the UI
Confirm with user that the listener matches their intent
When presenting a created listener to the user, use this format:
Use AI (context.callAgent()) when:
Use simple filtering when:
Default to AI unless the filter is purely identity-based.
For time-based actions (daily summaries, weekly reports):
Note: Scheduled listeners require cron scheduler configuration outside the listener file.
Full specification: See project root LISTENERS_SPEC.md for complete details on: