Resend Skills

repository·main·Indexed 41 days ago

https://github.com/resend/resend-skills

A collection of specialized capabilities for AI coding agents following the Agent Skills format. It provides tools for interacting with the Resend email API, managing agent email inboxes, and using React Email via MCP or as plugins for Claude Code and Cursor.

Tokens
101.1K
Snippets
274
Records
408
Agent score
51%

What's inside Resend Skills

  1. Use the email-best-practices skill

    main

    The email-best-practices skill provides guidance for building deliverable, compliant, and user-friendly email features. Use this skill when you need help with:

    • Deliverability: Setting up SPF/DKIM/DMARC authentication, fixing spam issues, or managing high bounce rates.
    • Email Types: Deciding between transactional vs. marketing emails or building specific flows like password resets, OTPs, and confirmations.
    • Compliance: Ensuring adherence to CAN-SPAM, GDPR, and CASL regulations.
    • Email Capture: Implementing newsletter signups and validating email addresses.
    • Reliability: Implementing retry logic, idempotency, and handling webhooks.
    • List Management: Managing suppression lists, handling bounces, and maintaining list hygiene.
    • Accessibility: Making emails accessible for screen readers (using alt text, headings, contrast, etc.).
  2. Available Resend Skills

    main

    Resend Skills provides a collection of specialized capabilities for AI agents. Skills are categorized by whether they are authored directly in this repository or synced from external sources.

    Note: Do not edit skills marked as "Synced from" in this repository, as changes will be overwritten. Edit those in their original source repositories.

    SkillDescriptionSource
    resendResend email APIAuthored here
    agent-email-inboxSecure email inbox for AI agentsAuthored here
    resend-cliOperate Resend from the terminalSynced from resend/resend-cli
    react-emailBuild HTML emails with React componentsSynced from resend/react-email
    email-best-practicesGuidance for building deliverable, compliant, user-friendly emailsSynced from resend/email-best-practices
  3. Choose a security level for inbound email processing

    main

    Because inbound emails are untrusted input, you must choose a security level to protect your AI agent from unauthorized instructions or malicious content.

    LevelNameWhen to UseTrade-off
    1Strict AllowlistKnown, fixed set of sendersMaximum security, limited functionality
    2Domain AllowlistOrganization-wide access from trusted domainsMore flexible, anyone at domain can interact
    3Content FilteringAccept from anyone, filter unsafe patternsCan receive from anyone, pattern matching not foolproof
    4Sandboxed ProcessingProcess all emails with restricted agent capabilitiesMaximum flexibility, complex to implement
    5Human-in-the-LoopRequire human approval for untrusted actionsMaximum security, adds latency
  4. Organize i18n message files

    main

    Choose one of two recommended patterns for organizing your translation files:

    One file per language containing all namespaces:

    messages/
    ├── en.json (contains welcome-email, password-reset, etc.)
    ├── es.json
    └── fr.json

    Separate files per namespace, grouped by language:

    messages/
    ├── en/
    │   ├── welcome-email.json
    │   └── password-reset.json
    ├── es/
    │   ├── welcome-email.json
    │   └── password-reset.json
    └── fr/
        └── welcome-email.json
  5. Choose between Single and Batch email endpoints

    main

    Resend provides two distinct endpoints for sending emails. Choosing the correct one depends on your specific requirements for attachments, scheduling, and volume.

    Single Email (POST /emails)

    Use this approach when:

    • Sending a single email.
    • Including attachments (max 40MB total).
    • Scheduling an email for a future time (scheduled_at).
    • Recipients require different delivery timings.

    Batch Email (POST /emails/batch)

    Use this approach when:

    • Sending 2 or more distinct emails in a single request.
    • You want to reduce API calls (the default rate limit is 2 requests per second).
    • Limitations:
      • No attachments allowed.
      • No scheduling allowed.
      • Atomic behavior: If one email in the batch fails validation, the entire batch fails.
      • Max 100 emails per request.
      • Max 50 recipients per individual email within the batch.
  6. Distinguish between Transactional and Marketing lists

    main

    It is critical to keep Transactional and Marketing lists separate.

    • Transactional Lists: Can include anyone with an active account relationship (e.g., password resets, order confirmations).
    • Marketing Lists: Only include users who have explicitly opted-in.

    Key Differences in Suppression

    • Hard bounces and complaints: These apply globally across both list types.
    • Unsubscribes: These are marketing-only. A user unsubscribing from marketing communications can still legally receive transactional emails related to their account or purchases.
  7. Understand Resend Suppressions

    main

    Suppressions are used to block future sends to specific email addresses. Suppressions are categorized by their origin:

    • bounce: Automatically added after a hard bounce.
    • complaint: Automatically added after a spam complaint.
    • manual: Added manually by the user via the suppressions add command.

    Note: Suppressions is a Beta feature. Commands are available in the CLI but will return an API error unless the suppression list is enabled for your specific Resend account. Contact Resend to join the beta.

  8. Use triple mustache syntax for template variables

    main

    Resend templates use triple mustache syntax for variable substitution in both HTML and the email subject.

    Important Constraints:

    • Syntax: Use {{{VARIABLE_NAME}}}. Double braces {{VAR}} will not render.
    • No Logic: Templates only support plain substitution. They do not support Handlebars control flow like {{#each}} or {{#if}}. For dynamic lists, pre-render the HTML server-side and pass it as a single string variable.
    • Casing: Variable key casing is arbitrary but must be consistent between the template definition and the variables object in your send call.
    • Reserved Names: You cannot use the following as custom variable keys: FIRST_NAME, LAST_NAME, EMAIL, UNSUBSCRIBE_URL, RESEND_UNSUBSCRIBE_URL, contact, or this. Use prefixes like USER_FIRST_NAME instead.
    <!-- ✅ Correct -->
    <p>Hi {{{CUSTOMER_NAME}}}, your order #{{{ORDER_ID}}} has shipped!</p>
    
    <!-- ❌ Wrong (will not render) -->
    <p>Hi {{CUSTOMER_NAME}}</p>
  9. Compliance requirements by region (CAN-SPAM, GDPR, CASL)

    main

    Email compliance requirements vary significantly by jurisdiction. When sending internationally, it is a best practice to follow the most restrictive requirements (typically GDPR) to ensure global compliance.

    CAN-SPAM (United States)

    • Requirements: Accurate header info (From, To, Reply-To), non-deceptive subject lines, physical mailing address in every email, and a clear opt-out mechanism.
    • Opt-out timing: Must honor opt-outs within 10 business days.
    • Transactional emails: Can be sent without opt-in if they are related to a transaction and not promotional.

    GDPR (European Union)

    • Requirements: Explicit opt-in consent (no pre-checked boxes) that is freely given, specific, and informed. Users must be able to withdraw consent as easily as they gave it.
    • Rights: Users have the right to access data and the "right to be forgotten" (deletion).
    • Transactional emails: Can be sent based on contract fulfillment or legitimate interest.

    CASL (Canada)

    • Consent types:
      • Express consent: Explicit opt-in (recommended).
      • Implied consent: Based on an existing business relationship (valid for 2 years) or an inquiry (valid for 6 months).
    • Requirements: Clear sender identification (valid for 60 days after send) and a functional unsubscribe mechanism (valid for 60 days after send).
    • Opt-out timing: Process unsubscribe no later than 10 business days.
    • Record keeping: Keep consent records for 3 years after expiration.
  10. Use the Resend MCP Server

    main

    The plugin registers Resend's hosted MCP server at https://mcp.resend.com/mcp (streamable HTTP). This gives AI agents tool access to the full Resend API.

    Authentication: Authentication is handled via OAuth. On the first connection, your client will walk you through the sign-in process. No manual API key or header configuration is required for the MCP server connection.

  11. How Resend Templates work

    main

    Resend Templates are reusable email structures stored on the Resend platform. They allow you to define HTML and variables once and reference them by a template ID or a human-readable alias during email sends.

    Template Lifecycle:

    1. Create (Draft): When you create a template, it starts in a Draft state. Drafts cannot be sent.
    2. Publish: You must call .publish() to move a template to the Published state. Only Published templates can be used in resend.emails.send() calls.
    3. Edit: Editing a published template creates a new draft. The existing published version remains active and continues to send until you explicitly publish the new version.

    When to use templates vs. inline HTML:

    • Use Templates when: You reuse the same structure across many sends, want non-engineers to edit copy via the dashboard, or need version history.
    • Use inline html when: The structure changes per send, you need more than 50 dynamic variables, or you require complex logic like loops/conditionals (which templates do not support).
    // Lifecycle: Create -> Publish -> Send
    const { data } = await resend.templates.create({
      name: 'Welcome',
      html: '<p>Hi {{{NAME}}}</p>',
    }).publish();