React Email Skill: Write HTML Emails with React Components and Integrate Resend Workflows

Preface

For HTML emails like transactional emails, welcome letters, password resets, and order confirmations, a common approach is to hand-write table-layout HTML or assemble strings inside template engines. Componentized frontends and email templates often use two separate sets of conventions. Previews must be tested repeatedly in real clients, and styles have to accommodate limitations of clients such as Outlook. React Email lets you write emails as React components with a local preview; the react-email Skill provided by Resend in resend-skills turns “how to write templates, how to avoid pitfalls, and how to connect static assets” into instructions that agents can execute, and aligns with the Resend ecosystem (sending, docs, plugins). Below introduces the positioning, capabilities, and usage of this Skill.

What This Is

react-email is an Agent Skill maintained by Resend (metadata version 2.1.0, MIT license). The Skill description states it applies to building HTML email templates with React components, integrating the React Email visual editor into applications, rendering emails to HTML, and sending emails via Resend; covering scenarios such as welcome emails, password resets, notifications, order confirmations, newsletters, and transactional emails.

In the resend-skills repository, this Skill is marked as synced from resend/react-email; direct changes in resend-skills will be overwritten on the next sync. For long-term maintenance, changes should be made in the source repository.

Core Features

The Skill’s main content focuses on developing with React Email and its constraints. Agents follow its rules to generate or modify templates, including:

  1. Componentized templates: Use structural components such as Html, Head, Body, Container, Section, Row/Column, Preview, Heading, Text, Button, Link, Img; style with Tailwind using pixelBasedPreset.
  2. Local preview: Use email dev to preview templates in the emails directory in a browser (default port 3000).
  3. Scaffolding and integration: Create a new project with npx create-email@latest, or add an email script to package.json in an existing project.
  4. Static assets: Place images in emails/static/ and switch the baseURL between development and production CDN modes.
  5. Behavior guidelines: Clarify brand colors, logos, style, and the production static asset domain before writing code; do not directly write {{variableName}}-style placeholders inside JSX (only handle via PreviewProps per documented examples); during iteration, only modify the parts the user requests.
  6. Relationship with Resend: The Skill’s metadata includes sending scenarios; the resend-skills plugin also provides the Resend MCP (https://mcp.resend.com/mcp) and sibling Skills such as resend. Sending emails typically requires a Resend account, a verified domain, and the environment variable RESEND_API_KEY (see resend.com/api-keys).

Installation and Activation

Install the Agent Skill (resend-skills plugin)

In clients that support Agent Skills / Agent Plugins, you can install multiple Skills from the Resend skill set at once:

npx skills add resend/resend-skills

After running, select the Skills to install as prompted, including react-email. The same repository provides separate plugin manifests for Claude Code, Cursor, Grok, and others (for example, Cursor corresponds to .cursor-plugin/).

Install React Email itself (for writing templates)

The Skill’s openclaw metadata declares the Node package installation method:

npm i react-email

You can also use the official scaffold to create a new project (supports npm, yarn, pnpm, bun):

npx create-email@latest
cd react-email-starter
npm install
npm run dev

The development server runs at localhost:3000, previewing templates in the emails folder.

Integrating into an existing project: After installing dependencies, add a script to package.json, ensure the emails path is relative to the project root, and that tsconfig.json supports JSX:

{
  "scripts": {
    "email": "email dev --dir emails --port 3000"
  }
}

Typical Usage

Basic welcome email template (Tailwind)

The following example comes from the Skill’s official content: pass name and verificationUrl via props, use Preview for the inbox summary, and ensure Button includes box-border.

import {
  Html,
  Head,
  Preview,
  Body,
  Container,
  Heading,
  Text,
  Button,
  Tailwind,
  pixelBasedPreset
} from 'react-email';

interface WelcomeEmailProps {
  name: string;
  verificationUrl: string;
}

export default function WelcomeEmail({ name, verificationUrl }: WelcomeEmailProps) {
  return (
    <Html lang="en">
      <Tailwind
        config={{
          presets: [pixelBasedPreset],
          theme: {
            extend: {
              colors: {
                brand: '#007bff',
              },
            },
          },
        }}
      >
        <Head />
        <Body className="bg-gray-100 font-sans">
          <Preview>Welcome - Verify your email</Preview>
          <Container className="max-w-xl mx-auto p-5">
            <Heading className="text-2xl text-gray-800">
              Welcome!
            </Heading>
            <Text className="text-base text-gray-800">
              Hi {name}, thanks for signing up!
            </Text>
            <Button
              href={verificationUrl}
              className="bg-brand text-white px-5 py-3 rounded block text-center no-underline box-border"
            >
              Verify Email
            </Button>
          </Container>
        </Body>
      </Tailwind>
    </Html>
  );
}

WelcomeEmail.PreviewProps = {
  name: 'John Doe',
  verificationUrl: 'https://example.com/verify/abc123'
} satisfies WelcomeEmailProps;

export { WelcomeEmail };

Local preview relies on PreviewProps; for production sending, render in application code and pass to Resend or another sending API (for specific calls, see the Resend documentation and the resend Skill in the same plugin).

Images and the production CDN

Place files like logos in emails/static/. The Skill requires confirming the production static asset domain with the user and not hardcoding localhost:3000:

const baseURL = process.env.NODE_ENV === "production"
  ? "https://cdn.example.com"
  : "";

export default function Email() {
  return (
    <Img
      src={`${baseURL}/static/logo.png`}
      alt="Logo"
      width="150"
      height="50"
    />
  );
}

In development, baseURL is empty, and /static/... is served by the React Email dev server; in production, prepend the CDN root URL.

Applicable Scenarios and Considerations

Who it’s for: Teams already using or planning to use React/TypeScript; scenarios needing transactional email or notification templates and wanting agents to write code according to email client constraints; developers using Cursor, Claude Code, etc., with resend-skills installed.

Style and layout constraints (explicitly required in the Skill):

  • When using Tailwind, combine it with pixelBasedPreset (email clients have poor rem support).
  • Do not use flexbox / grid; for multiple columns, use Row/Column or a table-based approach.
  • Avoid media queries like sm:, md:, and theme selectors like dark:/light:.
  • Prefer PNG/JPG images; avoid SVG, WEBP; Button must include box-border; borders must specify a type such as border-solid.

If a user insists on writing Mustache-style placeholders like {{name}} inside component structures, the Skill requires the agent to explain that this will invalidate the template and to instead use props or handle it only in PreviewProps per the documentation.

Closing

The react-email Skill turns React Email’s component model, preview workflow, static asset handling, and client compatibility rules into an instruction set that agents can follow, and is maintained in sync with Resend’s official skill set and documentation. If your goal is “write templates as components + local preview + the same ecosystem as the Resend sending pipeline,” you can start by installing resend-skills and selecting this Skill. For template details, refer to skills/react-email and react.email.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye