/skills:emailfrom skills
Setup transactional email with Resend (production) and Mailpit (local) for auth and notifications. Use this skill when the user says "setup email", "add email", "transactional email", or "auth emails".
Ships in skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Minimal transactional email system using Resend for production and Mailpit for local development, optimized for auth flows and notifications.
lib/email.ts (or src/lib/email.ts) - Unified email client (auto-switches between Mailpit/Resend)emails/base-layout.tsx - Shared layout wrapperemails/auth-code.tsx - 2FA verification codesemails/magic-link.tsx - Passwordless loginemails/password-reset.tsx - Password reset flowemails/notification.tsx - Generic notificationsNote: File paths shown use root-level directories (
lib/,emails/). If your project uses thesrc/directory structure, addsrc/prefix to all paths (e.g.,src/lib/email.ts).
src/ and --no-src-dir structures)bun add resend react-email @react-email/components
Ensure your tsconfig.json has proper path mapping:
For projects with src/ directory:
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"]
}
}
}
For projects without src/ directory (--no-src-dir):
{
"compilerOptions": {
"paths": {
"@/*": ["./*"]
}
}
}
Add to .env.local:
# Email sender
[email protected]
# Production (Resend)
RESEND_API_KEY=re_...
# Local (Mailpit - already in docker stack)
SMTP_HOST=localhost
SMTP_PORT=1025
Create lib/email.ts (or src/lib/email.ts if using src/ directory):
import { Resend } from "resend";
import { render } from "@react-email/components";
import type { ReactElement } from "react";
const isProduction = process.env.NODE_ENV === "production";
const resend = process.env.RESEND_API_KEY ? new Resend(process.env.RESEND_API_KEY) : null;
type SendEmailOptions = {
to: string | string[];
subject: string;
template: ReactElement;
replyTo?: string;
};
export async function sendEmail(options: SendEmailOptions) {
const html = await render(options.template);
const text = await render(options.template, { plainText: true });
const from = process.env.EMAIL_FROM ?? "[email protected]";
if (isProduction && resend) {
return resend.emails.send({
from,
to: Array.isArray(options.to) ? options.to : [options.to],
subject: options.subject,
html,
text,
replyTo: options.replyTo,
});
}
// Local: use Mailpit via nodemailer
const nodemailer = await import("nodemailer");
const transport = nodemailer.createTransport({
host: process.env.SMTP_HOST || "localhost",
port: Number(process.env.SMTP_PORT) || 1025,
secure: false,
});
return transport.sendMail({
from,
to: options.to,
subject: options.subject,
html,
text,
});
}
Create emails/base-layout.tsx (or src/emails/base-layout.tsx if using src/ directory):
import {
Body,
Container,
Head,
Html,
Preview,
Tailwind,
} from "@react-email/components";
import type { ReactNode } from "react";
type Props = { preview: string; children: ReactNode };
export function BaseLayout({ preview, children }: Props) {
return (
<Html>
<Head />
<Preview>{preview}</Preview>
<Tailwind>
<Body className="bg-zinc-50 font-sans">
<Container className="mx-auto max-w-[600px] p-8">
{children}
</Container>
</Body>
</Tailwind>
</Html>
);
}
Create emails/auth-code.tsx (or src/emails/auth-code.tsx if using src/ directory):
import { Heading, Section, Text } from "@react-email/components";
import { BaseLayout } from "./base-layout";
type Props = { code: string; expiresIn?: string };
export function AuthCodeEmail({ code, expiresIn = "10 minutes" }: Props) {
return (
<BaseLayout preview={`Your verification code: ${code}`}>
<Heading className="text-2xl font-bold text-zinc-900">
Verification Code
</Heading>
<Section className="my-6 rounded-lg bg-zinc-100 p-6 text-center">
<Text className="m-0 font-mono text-4xl font-bold tracking-widest text-zinc-900">
{code}
</Text>
</Section>
<Text className="text-zinc-600">
This code expires in {expiresIn}. If you didn't request this, ignore this email.
</Text>
</BaseLayout>
);
}
Create emails/magic-link.tsx:
import { Button, Heading, Text } from "@react-email/components";
import { BaseLayout } from "./base-layout";
type Props = { url: string; expiresIn?: string };
export function MagicLinkEmail({ url, expiresIn = "15 minutes" }: Props) {
return (
<BaseLayout preview="Sign in to your account">
<Heading className="text-2xl font-bold text-zinc-900">
Sign In
</Heading>
<Text className="text-zinc-600">
Click the button below to sign in. This link expires in {expiresIn}.
</Text>
<Button
href={url}
className="rounded-lg bg-zinc-900 px-6 py-3 text-white"
>
Sign In
</Button>
<Text className="mt-4 text-sm text-zinc-500">
If the button doesn't work, copy this link: {url}
</Text>
</BaseLayout>
);
}
Create emails/password-reset.tsx:
import { Button, Heading, Text } from "@react-email/components";
import { BaseLayout } from "./base-layout";
type Props = { url: string; expiresIn?: string };
export function PasswordResetEmail({ url, expiresIn = "1 hour" }: Props) {
return (
<BaseLayout preview="Reset your password">
<Heading className="text-2xl font-bold text-zinc-900">
Reset Password
</Heading>
<Text className="text-zinc-600">
Someone requested a password reset. If this was you, click below.
This link expires in {expiresIn}.
</Text>
<Button
href={url}
className="rounded-lg bg-zinc-900 px-6 py-3 text-white"
>
Reset Password
</Button>
<Text className="mt-4 text-sm text-zinc-500">
If you didn't request this, ignore this email.
</Text>
</BaseLayout>
);
}
Create emails/notification.tsx:
import { Button, Heading, Text } from "@react-email/components";
import { BaseLayout } from "./base-layout";
type Props = {
title: string;
message: string;
actionUrl?: string;
actionText?: string;
};
export function NotificationEmail({ title, message, actionUrl, actionText }: Props) {
return (
<BaseLayout preview={title}>
<Heading className="text-2xl font-bold text-zinc-900">{title}</Heading>
<Text className="text-zinc-600">{message}</Text>
{actionUrl && (
<Button
href={actionUrl}
className="rounded-lg bg-zinc-900 px-6 py-3 text-white"
>
{actionText ?? "View"}
</Button>
)}
</BaseLayout>
);
}
import { sendEmail } from "@/lib/email";
import { AuthCodeEmail } from "@/emails/auth-code";
await sendEmail({
to: "[email protected]",
subject: "Your verification code",
template: <AuthCodeEmail code="123456" />,
});
import { MagicLinkEmail } from "@/emails/magic-link";
await sendEmail({
to: "[email protected]",
subject: "Sign in to your account",
template: <MagicLinkEmail url="https://app.com/auth/verify?token=xyz" />,
});
import { PasswordResetEmail } from "@/emails/password-reset";
await sendEmail({
to: "[email protected]",
subject: "Reset your password",
template: <PasswordResetEmail url="https://app.com/reset?token=xyz" />,
});
import { NotificationEmail } from "@/emails/notification";
await sendEmail({
to: "[email protected]",
subject: "Welcome!",
template: (
<NotificationEmail
title="Welcome to our platform"
message="Thanks for signing up!"
actionUrl="https://app.com/dashboard"
actionText="Go to Dashboard"
/>
),
});
Start Docker stack (includes Mailpit):
docker compose up -d
View sent emails at: http://localhost:8025
All emails sent locally go to Mailpit regardless of recipient
Preview all templates in browser:
bunx email dev
Opens React Email preview at http://localhost:3000
This email setup is ready for auth integration:
sendResetPassword and sendVerificationEmail callbackssendEmail functionSign up for Resend
Verify your domain
Get API key (starts with re_)
Add to production environment variables:
RESEND_API_KEY=re_your_key_here
[email protected]
To add more templates later:
emails/ (or src/emails/)BaseLayout wrapperCommon additions:
Check Mailpit is running:
docker ps | grep mailpit
Verify SMTP port: Check your Mailpit container ports. Some configurations use different ports:
docker ps --format "{{.Names}}\t{{.Ports}}" | grep mailpit
Common port mappings:
1025:1025 (SMTP) and 8025:8025 (Web UI)1026:1025 (SMTP) and 8026:8025 (Web UI)Update your .env.local to match your actual ports:
SMTP_PORT=1026 # Use your actual SMTP port
Check EMAIL_FROM is set: Ensure .env.local includes:
[email protected]
View Mailpit UI: Open your browser to the correct port:
If you see import errors, ensure your tsconfig.json paths match your project structure (@/* should point to ./src/* or ./*).
The preview server may conflict with your Next.js dev server. Use a different port:
bunx email dev --port 3001
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mattwoodco/skills --plugin skillsOther plugins' skills for the same job
84 skills in this plugin
/add-featureParent skill for feature and project workflows. Use when the user wants to build a project, add a feature, polish a skill, test all skills, or browse the skill catalog. Routes to add-project (build project from idea), improve-skill (refine one skill in a sandbox), test-skills (validate full skill composition), or any child skill by name.
/add-projectEnd-to-end project builder: idea → spec → shell → ralph loop → secrets → report. SMS notification after every phase. Creates a project directory with symlinked skills and a ralph execution loop. Does NOT scaffold Next.js — ralph does that as step 1.1 of the plan. Use when the user says "build project", "build a project", "new project", "create project", "build from idea", "scaffold and notify", "spec a project", "plan a project", or "scaffold project".
/