跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 react-email

React Email

在构建带有 React 组件的 HTML 电子邮件模板时使用,在应用程序中添加一个可视化的电子邮件编辑器,使用 React 电子邮件可视化编辑器,在 HTML 中渲染电子邮件,或者用 Resend 发送电子邮件. 封面欢迎电子邮件、密码重置、通知、订单确认、通讯、交易邮件和可嵌入的电子邮件编辑器组件.

10125 安装量

官方网址:作者主页

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

在构建带有 React 组件的 HTML 电子邮件模板时使用,在应用程序中添加一个可视化的电子邮件编辑器,使用 React 电子邮件可视化编辑器,在 HTML 中渲染电子邮件,或者用 Resend 发送电子邮件. 封面欢迎电子邮件、密码重置、通知、订单确认、通讯、交易邮件和可嵌入的电子邮件编辑器组件.

何时用

构建带有 React 组件的 HTML 电子邮件模板,在应用程序中添加一个可视化的电子邮件编辑器,使用 React 电子邮件可视化编辑器,将电子邮件渲染到 HTML,或者发送带有Resend 的电子邮件. 封面欢迎邮件、密码重置、通知、订单确认、通讯

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:React Email、Installation、Adding to an Existing Project、Basic Email Template、Behavioral Guidelines、Essential Components。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/COMPONENTS.md、references/STYLING.md、references/SENDING.md、references/I18N.md、references/EDITOR.md、references/PATTERNS.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

Use when building HTML email templates with React components, adding a visual email editor to an application using the React Email visual editor, rendering emails to HTML, or sending emails with Resend. Covers welcome emails, password resets, notifications, order confirmations, newsletters, transactional emails, and the embeddable email editor component.

React EmailInstallationAdding to an Existing ProjectBasic Email TemplateBehavioral GuidelinesEssential ComponentsBefore Writing CodeStatic Files and ImagesDirectory StructureDev vs Production URLsStylingKey Rules

· 许可:MIT

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
react-email
description
Use when building HTML email templates with React components, adding a visual email editor to an application using the React Email visual editor, rendering emails to HTML, or sending emails with Resend. Covers welcome emails, password resets, notifications, order confirmations, newsletters, transactional emails, and the embeddable email editor component.
许可
MIT
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 6
  • references/COMPONENTS.md
  • references/STYLING.md
  • references/SENDING.md
  • references/I18N.md
  • references/EDITOR.md
  • references/PATTERNS.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「react-email」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-071f9afe4bbe6dd1-%E5%8F%8D%E5%BA%94%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6.html
请存为 .cursor/skills/react-email/SKILL.md 或 .claude/skills/react-email/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/resend/react-email 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/resend/react-email' --list

npx skills add 'https://github.com/resend/react-email' --skill 'react-email'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: react-email description: Use when building HTML email templates with React components, adding a visual email editor to an application using the React Email visual editor, rendering emails to HTML, or sending emails with Resend. Covers welcome emails, password resets, notifications, order confirmations, newsletters, transactional emails, and the embeddable email editor component. license: MIT metadata: author: Resend version: "2.1.0" homepage: https://react.email source: https://github.com/resend/react-email openclaw: install: - kind: node package: react-email label: React Email links: repository: https://github.com/resend/react-email documentation: https://resend.com/docs/react-email-skill --- # React Email Build and send HTML emails using React components. A modern, component-based approach to email development that works across all major email clients. ## Installation ```sh npm i react-email ``` Or scaffold a new project: ```sh npx create-email@latest cd react-email-starter npm install npm run dev ``` This works with any package manager (npm, yarn, pnpm, bun) — substitute accordingly. The dev server runs at localhost:3000 with a preview interface for templates in the `emails` folder. ### Adding to an Existing Project Install the packages and add a script to your `package.json`: ```json { "scripts": { "email": "email dev --dir emails --port 3000" } } ``` Make sure the path to the emails folder is relative to the base project directory. Ensure `tsconfig.json` includes proper support for JSX. ## Basic Email Template Create an email component with proper structure using the Tailwind component for styling: ```tsx 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 ( Welcome - Verify your email Welcome! Hi {name}, thanks for signing up! Verify Email ); } // Preview props for testing WelcomeEmail.PreviewProps = { name: 'John Doe', verificationUrl: 'https://example.com/verify/abc123' } satisfies WelcomeEmailProps; export { WelcomeEmail }; ``` ## Behavioral Guidelines - When iterating over the code, only update what the user asked for. Keep the rest intact. - If the user asks to use media queries, inform them that most email clients don't support them and suggest a different approach. - Never use template variables (like `{{name}}`) directly in TypeScript code. Instead, reference the underlying properties directly. If the user explicitly asks for `{{variableName}}`, place the mustache string only in PreviewProps, never in the component JSX: ```typescript const EmailTemplate = (props) => { return (

Hello, {props.variableName}!

); } EmailTemplate.PreviewProps = { variableName: "{{variableName}}", }; export default EmailTemplate; ``` - Never write the `{{variableName}}` pattern directly in the component structure. If the user insists, explain that this would make the template invalid. ## Essential Components See [references/COMPONENTS.md](references/COMPONENTS.md) for complete component documentation. **Core Structure:** - `Html` - Root wrapper with `lang` attribute - `Head` - Meta elements, styles, fonts - `Body` - Main content wrapper - `Container` - Outermost centering wrapper (has built-in `max-width: 37.5em`). Use only once per email. - `Section` - Interior content blocks (no built-in max-width). Use for grouping content inside `Container`. - `Row` & `Column` - Multi-column layouts - `Tailwind` - Enables Tailwind CSS utility classes **Content:** - `Preview` - Inbox preview text, always first inside `` - `Heading` - h1-h6 headings - `Text` - Paragraphs - `Button` - Styled link buttons (always include `box-border`) - `Link` - Hyperlinks - `Img` - Images (see Static Files section below) - `Hr` - Horizontal dividers **Specialized:** - `CodeBlock` - Syntax-highlighted code - `CodeInline` - Inline code - `Markdown` - Render markdown - `Font` - Custom web fonts ## Before Writing Code When a user requests an email template, ask clarifying questions FIRST if they haven't provided: 1. **Brand colors** - Ask for primary brand color (hex code like #007bff) 2. **Logo** - Ask if they have a logo file and its format (PNG/JPG only - warn if SVG/WEBP) 3. **Style preference** - Professional, casual, or minimal tone 4. **Production URL** - Where will static assets be hosted in production? ## Static Files and Images ### Directory Structure Local images must be placed in the `static` folder inside your emails directory: ``` project/ ├── emails/ │ ├── welcome.tsx │ └── static/ <-- Images go here │ └── logo.png ``` ### Dev vs Production URLs Use this pattern for images that work in both dev preview and production: ```tsx const baseURL = process.env.NODE_ENV === "production" ? "https://cdn.example.com" // User's production CDN : ""; export default function Email() { return ( ); } ``` **How it works:** - **Development:** `baseURL` is empty, so URL is `/static/logo.png` - served by React Email's dev server - **Production:** `baseURL` is the CDN domain, so URL is `https://cdn.example.com/static/logo.png` **Important:** Always ask the user for their production hosting URL. Do not hardcode `localhost:3000`. ## Styling See [references/STYLING.md](references/STYLING.md) for comprehensive styling documentation including typography, layout patterns, dark mode, and brand consistency. ### Key Rules - Use `Tailwind` with `pixelBasedPreset` (email clients don't support `rem`). Import `pixelBasedPreset` from `react-email`. - Never use flexbox or grid — use `Row`/`Column` components or tables for layouts. - Avoid CSS/Tailwind media queries (`sm:`, `md:`, `lg:`, `xl:`) — limited email client support. - Never use theme selectors (`dark:`, `light:`) — not supported. - Never use SVG or WEBP images — warn users about rendering issues. - Always specify border type (`border-solid`, `border-dashed`, etc.) — email clients don't inherit it. - For single-side borders, reset others first (`border-none border-l border-solid`). ### Required Classes | Component | Required Class | Why | |-----------|---------------|-----| | `Button` | `box-border` | Prevents padding from overflowing the button width | | `Hr` / any border | `border-solid` (or `border-dashed`, etc.) | Email clients don't inherit border type | | Single-side borders | `border-none` + the side | Resets default borders on other sides | ### Structure Notes - Always define `` inside `` when using Tailwind CSS - `` should always be the first element inside `` - Only include props in `PreviewProps` that the component actually uses - Use fixed width/height for known-size elements (logos, icons); responsive sizing (`w-full`, `h-auto`) for content images ## Rendering ### Convert to HTML ```tsx import { render } from 'react-email'; import { WelcomeEmail } from './emails/welcome'; const html = await render( ); ``` ### Convert to Plain Text ```tsx const text = await render(, { plainText: true }); ``` ## Sending React Email supports sending with any email service provider. See [references/SENDING.md](references/SENDING.md) for complete sending documentation including Resend, Nodemailer, and SendGrid examples. Quick example using the Resend SDK: ```tsx import { Resend } from 'resend'; import { WelcomeEmail } from './emails/welcome'; const resend = new Resend(process.env.RESEND_API_KEY); const { data, error } = await resend.emails.send({ from: 'Acme ', to: ['[email protected]'], subject: 'Welcome to Acme', react: }); ``` The Resend Node SDK automatically handles both HTML and plain-text rendering. ## CLI Commands The `react-email` package provides a CLI accessible via the `email` command: | Command | Description | |---------|-------------| | `email dev --dir --port ` | Start the preview development server (default: `./emails`, port 3000) | | `email build --dir ` | Build the preview app for production deployment | | `email start` | Run the built preview app | | `email export --outDir --pretty --plainText --dir ` | Export templates to static HTML files | | `email resend setup` | Connect the CLI to your Resend account via API key | | `email resend reset` | Remove the stored Resend API key | ## Internationalization See [references/I18N.md](references/I18N.md) for complete i18n documentation. React Email supports three libraries: next-intl, react-i18next, and react-intl. ## Email Editor React Email includes a visual editor (`@react-email/editor`) that can be embedded in your app. It's built on TipTap/ProseMirror and produces email-ready HTML. See [references/EDITOR.md](references/EDITOR.md) for complete documentation including: - `EmailEditor` — batteries-included component with bubble menus, slash commands, and theming - `StarterKit` — 35+ email-aware extensions (headings, lists, tables, columns, buttons, etc.) - `Inspector` — contextual sidebar for editing styles - `EmailTheming` — built-in themes (`basic`, `minimal`) with customizable CSS properties - `composeReactEmail` — export editor content to email-ready HTML and plain text - Custom extensions via `EmailNode` and `EmailMark` Quick example: ```tsx import { EmailEditor, type EmailEditorRef } from '@react-email/editor'; import '@react-email/editor/themes/default.css'; import { useRef } from 'react'; export function MyEditor() { const ref = useRef(null); return ( ); } ``` ## Common Patterns See [references/PATTERNS.md](references/PATTERNS.md) for complete examples including: - Password reset emails - Order confirmations with product lists - Notification emails with code blocks - Multi-column layouts - Team invitation emails ## Email Best Practices 1. **Test across email clients** - Gmail, Outlook, Apple Mail, Yahoo Mail 2. **Keep it responsive** - Max-width around 600px, test on mobile 3. **Use absolute image URLs** - Host on reliable CDN 4. **Write meaningful alt text** - Describe purpose and details for content images; use `alt=""` for decorative images (spacers, dividers, background flourishes). React Email's `` defaults to `alt=""`. 5. **Provide plain text version** - Required for accessibility 6. **Keep file size under 102KB** - Gmail clips larger emails 7. **Add proper TypeScript types** - Define interfaces for all email props 8. **Include preview props** - Add `.PreviewProps` for development testing 9. **Use verified domains** - For production `from` addresses ### Accessibility React Email handles the structural defaults; the rest is content. **What React Email gives you for free:** - `` sets `lang` and `dir` (defaults: `lang="en" dir="ltr"` — override per locale) - `` defaults to `alt=""` so decorative images are skipped by screen readers - `` renders layout tables with `role="presentation"` - `` also emits a `

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…