action-creator
Creates user-specific one-click action templates that execute email operations when clicked in the chat interface. Use when user…
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
$ npx -y skills add anthropics/claude-agent-sdk-demos --skill listener-creator --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/listener-creatorContext preview
The summary Claude sees to decide when to auto-load this skill.
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
name: listener-creator description: 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. allowed-tools: Write, Edit, Read, Glob
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: 1. Export a `config` object defining the event type and metadata 2. Export a `handler` function that filters and processes events 3. Use `ListenerContext` 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:
// Available event types: - "email_received" // Most common - new email arrives - "email_sent" // User sends an email - "email_starred" // Email is starred - "email_archived" // Email is archived - "email_labeled" // Label added to email - "scheduled_time" // Time-based (cron) - requires scheduler setup
Create a file in `agent/custom_scripts/listeners/` with this structure:
import type { ListenerConfig, Email, ListenerContext } from "../types";
export const config: ListenerConfig = {
id: "unique_listener_id", // kebab-case, descriptive
name: "Human Readable Name", // For UI display
description: "What this does", // Optional but helpful
enabled: true, // Start enabled
event: "email_received" // Event type
};
export async function handler(email: Email, context: ListenerContext): Promise<void> {
// 1. Basic filter (identity/sender only)
if (!email.from.includes("example@email.com")) return;
// 2. Use AI for intelligent classification (PREFERRED over keyword matching)
const analysis = await context.callAgent<{ isUrgent: boolean; reason: string }>({
prompt: `Is this email urgent?\nSubject: ${email.subject}\nBody: ${email.body.substring(0, 500)}`,
schema: {
type: "object",
properties: {
isUrgent: { type: "boolean" },
reason: { type: "string" }
},
required: ["isUrgent", "reason"]
},
model: "haiku"
});
if (!analysis.isUrgent) return;
// 3. Perform actions via context methods
await context.notify(`Urgent email: ${email.subject}\n${analysis.reason}`, {
priority: "high"
});
await context.starEmail(email.messageId);
}Use kebab-case matching the listener's purpose:
The `ListenerContext` provides these methods:
// Notifications
await context.notify(message, { priority: "high" | "normal" | "low" });
// Email actions
await context.archiveEmail(emailId);
await context.starEmail(emailId);
await context.unstarEmail(emailId);
await context.markAsRead(emailId);
await context.markAsUnread(emailId);
await context.addLabel(emailId, "label-name");
await context.removeLabel(emailId, "label-name");
// AI-powered analysis
const result = await context.callAgent<ResultType>({
prompt: "Your prompt with email content",
schema: {
type: "object",
properties: { field: { type: "string" } },
required: ["field"]
},
model: "haiku" // or "sonnet" or "opus"
});**Default to using `context.callAgent()` for intelligent decision-making** instead of hard-coded keyword lists. This provides better accuracy and adaptability.
// PREFERRED: AI-based urgency detection
const analysis = await context.callAgent<{ isUrgent: boolean; reason: string }>({
prompt: `Analyze if this email is urgent:
Subject: ${email.subject}
Body: ${email.body.substring(0, 500)}
Is this email urgent or time-sensitive? Consider context, not just keywords.`,
schema: {
type: "object",
properties: {
isUrgent: { type: "boolean" },
reason: { type: "string" }
},
required: ["isUrgent", "reason"]
},
model: "haiku" // Fast and cost-effective
});
if (analysis.isUrgent) {
await context.notify(`Urgent: ${email.subject}\n${analysis.reason}`);
}
// AVOID: Hard-coded keyword lists (brittle and prone to false positives)
// const isUrgent = subject.includes("urgent") || subject.includes("asap");Reference the template files for common patterns:
1. **
⚠️ IMPORTANT: These are demo applications by Anthropic. They are intended for local development only and should NOT be deployed to production or used at scale.
Creates user-specific one-click action templates that execute email operations when clicked in the chat interface. Use when user…
Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and…
Transforms research findings into executive-ready briefings. Automatically activated when user mentions 'executive', 'briefing',…
Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and…
Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and…