Resend CLI
This skill is for agents that should operate Resend through the official CLI first, not by
dropping straight to raw REST.
The goal is not just “know the commands”. The goal is to make an agent:
- choose the right Resend primitive,
- choose the right CLI command,
- run it in a deterministic non-interactive way,
- detect the important CLI coverage gaps before it gets stuck, and
- fall back to MCP/API only when the CLI genuinely does not cover the job.
Start here
Load only the files that match the task:
references/agent-operating-model.md — the default decision process for live Resend work
references/install-auth-and-profiles.md — install methods, auth priority, profiles, config paths
references/subprocess-contract.md — how agents should invoke resend safely and parse output
references/command-selection.md — fast routing from user intent to the right command(s)
references/sending-scheduling-and-batch.md — transactional sends, schedules, tags, attachments, batch limits
references/domains-dns-and-deliverability.md — domain creation, verification, receiving, TLS, tracking, 403/domain mismatch
references/webhooks-and-listeners.md — webhook creation, update, signature handling, temporary local listeners
references/inbound-receiving-and-threading.md — inbound list/get/attachments/forward/listen flows
references/contacts-topics-segments-and-broadcasts.md — subscription modelling, targeting, campaigns
references/templates-and-coverage-gaps.md — template lifecycle and the important current CLI gaps
references/diagnostics-and-fallbacks.md — debug order, CLI quirks, when to fall back to MCP/API
references/recipes.md — short end-to-end playbooks
references/sources.md — first-party source manifest and refresh notes
Machine-readable assets:
assets/command-catalog.json — command index with detail levels (source_inspected, readme_confirmed, tree_confirmed)
assets/task-router.json — route common tasks to command sequences
assets/error-map.json — fast-fail diagnosis hints
assets/coverage-gaps.json — current CLI limitations and ambiguities that matter to agents
assets/subprocess-contract.json — deterministic invocation defaults
assets/scaffold-index.json — reusable command/file scaffolds
assets/source-manifest.json — authoritative URLs used to build this skill
Bundled helper:
scripts/resend_cli.py — agent wrapper for probing, routing, scaffolding, batch linting, diagnosis, and safe subprocess execution
Core operating rules
1) Prefer the official CLI for live Resend work
Default order of preference:
- Official Resend CLI for live terminal/CI/agent operations
- Official Resend MCP server if the environment already exposes it and the CLI is unavailable
- Official SDK when editing app code inside an existing integration
- Raw REST only for stack-neutral examples, protocol debugging, or feature gaps
Do not choose raw REST just because it is familiar.
2) For agents, stay non-interactive by default
For bounded commands:
- pass all required flags explicitly
- use global
--json -q
- prefer
RESEND_API_KEY or a stored profile over typing secrets interactively
- set
RESEND_NO_UPDATE_NOTIFIER=1 for deterministic output
- capture both stdout and stderr defensively
3) Run doctor early when the environment is unknown
When you do not know whether the CLI is installed, authenticated, or pointed at the right account:
resend --json -q doctor
This is usually the fastest first read on:
- CLI availability/version
- whether an API key is being resolved
- whether verified domains exist
- whether the machine looks like an AI-agent environment
4) Choose the primitive before the command
- One logical transactional email →
emails send
- Up to 100 distinct transactional emails in one request →
emails batch
- Scheduled transactional email mutation →
emails update / emails cancel
- Campaign to a segment →
broadcasts create / broadcasts send
- Reusable hosted content →
templates *
- Sender or receiving setup →
domains *
- Inbound processing →
emails receiving * + webhooks *
- Scoped credentials →
api-keys *
- Recipient data and preferences →
contacts, contact-properties, topics, segments
- Local dev event loop →
webhooks listen or emails receiving listen
5) Know the current CLI gaps
This version of the skill treats these as especially important:
- Template send gap: the CLI manages templates, but the current
emails send command surface does not expose a direct --template-id/template-vars flow.
- Domain capability update gap:
domains update exposes TLS/open/click tracking, but not an explicit sending/receiving capability toggle, while inbound help text references such a toggle.
- Stream commands are special:
webhooks listen and emails receiving listen are long-running and should be treated as NDJSON/event streams in agent mode.
- JSON error channel discrepancy: the README promises machine JSON on stdout only, but the current source writes JSON errors with
console.error, so wrappers must parse stderr too.
6) Keep IDs and file paths
Most multi-step flows become much easier if the agent persists:
- domain IDs
- email IDs
- webhook IDs
- topic IDs
- segment IDs
- template IDs/aliases
- API key IDs
- the file paths it generated for HTML or batch JSON
The mutation ladder
For state-changing live operations:
- classify the task
- confirm the command sequence
- make any needed file assets (
.html, batch JSON)
- run with
--json -q
- verify with
get, list, or a follow-up check
- persist returned IDs and next-step context
- only then continue to the next mutation
Bundled helper script
scripts/resend_cli.py is intentionally agent-oriented.
Commands:
probe — find the CLI, report install hints, and show environment basics
catalog — list known commands from the bundled catalogue
info — inspect one command and its notes/gaps
recommend — route a free-text task to the best CLI sequence
scaffold — print or materialise sample commands/files
lint-batch — statically validate an emails batch JSON file
doctor — explain likely causes of common CLI/API failures
run — execute the official CLI with deterministic defaults and tolerant JSON parsing
Examples:
python3 scripts/resend_cli.py probe
python3 scripts/resend_cli.py catalog --resource emails
python3 scripts/resend_cli.py info "emails send"
python3 scripts/resend_cli.py recommend "send 70 different shipment notifications"
python3 scripts/resend_cli.py scaffold batch-send --write-dir ./tmp
python3 scripts/resend_cli.py lint-batch ./tmp/batch-emails.json
python3 scripts/resend_cli.py doctor --command "emails send" --status 403 --message "1010 forbidden"
python3 scripts/resend_cli.py run -- emails list --limit 5
Response shape this skill should produce
A strong answer usually includes:
- the exact Resend primitive,
- the exact CLI command or command sequence,
- any file scaffolding the user needs,
- the operational caveats that matter here,
- the verification step,
- the fallback path if the CLI does not currently cover the flow.
Example prompts this skill should handle
- “Use the Resend CLI to send a scheduled password reset email”
- “Should I use
emails send, emails batch, or broadcasts create?”
- “Create a sending + receiving domain in
eu-west-1”
- “Set up local webhook listening with ngrok”
- “Why is my batch file failing?”
- “How do I manage multiple Resend accounts from one agent?”
- “Can the CLI send a hosted template directly?”
- “How should my agent parse
resend output safely?”
1---2name: resend-cli3description: Use this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.4---5
6# Resend CLI
7
8This skill is for agents that should operate **Resend through the official CLI first**, not by
9dropping straight to raw REST.
10
11The goal is not just “know the commands”. The goal is to make an agent:
12
131. choose the right Resend primitive,
142. choose the right CLI command,
153. run it in a deterministic non-interactive way,
164. detect the important CLI coverage gaps before it gets stuck, and
175. fall back to MCP/API only when the CLI genuinely does not cover the job.
18
19## Start here
20
21Load only the files that match the task:
22
23- `references/agent-operating-model.md` — the default decision process for live Resend work
24- `references/install-auth-and-profiles.md` — install methods, auth priority, profiles, config paths
25- `references/subprocess-contract.md` — how agents should invoke `resend` safely and parse output
26- `references/command-selection.md` — fast routing from user intent to the right command(s)
27- `references/sending-scheduling-and-batch.md` — transactional sends, schedules, tags, attachments, batch limits
28- `references/domains-dns-and-deliverability.md` — domain creation, verification, receiving, TLS, tracking, 403/domain mismatch
29- `references/webhooks-and-listeners.md` — webhook creation, update, signature handling, temporary local listeners
30- `references/inbound-receiving-and-threading.md` — inbound list/get/attachments/forward/listen flows
31- `references/contacts-topics-segments-and-broadcasts.md` — subscription modelling, targeting, campaigns
32- `references/templates-and-coverage-gaps.md` — template lifecycle and the important current CLI gaps
33- `references/diagnostics-and-fallbacks.md` — debug order, CLI quirks, when to fall back to MCP/API
34- `references/recipes.md` — short end-to-end playbooks
35- `references/sources.md` — first-party source manifest and refresh notes
36
37Machine-readable assets:
38
39- `assets/command-catalog.json` — command index with detail levels (`source_inspected`, `readme_confirmed`, `tree_confirmed`)
40- `assets/task-router.json` — route common tasks to command sequences
41- `assets/error-map.json` — fast-fail diagnosis hints
42- `assets/coverage-gaps.json` — current CLI limitations and ambiguities that matter to agents
43- `assets/subprocess-contract.json` — deterministic invocation defaults
44- `assets/scaffold-index.json` — reusable command/file scaffolds
45- `assets/source-manifest.json` — authoritative URLs used to build this skill
46
47Bundled helper:
48
49- `scripts/resend_cli.py` — agent wrapper for probing, routing, scaffolding, batch linting, diagnosis, and safe subprocess execution
50
51## Core operating rules
52
53### 1) Prefer the official CLI for live Resend work
54
55Default order of preference:
56
571. **Official Resend CLI** for live terminal/CI/agent operations
582. **Official Resend MCP server** if the environment already exposes it and the CLI is unavailable
593. **Official SDK** when editing app code inside an existing integration
604. **Raw REST** only for stack-neutral examples, protocol debugging, or feature gaps
61
62Do not choose raw REST just because it is familiar.
63
64### 2) For agents, stay non-interactive by default
65
66For bounded commands:
67
68- pass all required flags explicitly
69- use global `--json -q`
70- prefer `RESEND_API_KEY` or a stored profile over typing secrets interactively
71- set `RESEND_NO_UPDATE_NOTIFIER=1` for deterministic output
72- capture **both stdout and stderr** defensively
73
74### 3) Run `doctor` early when the environment is unknown
75
76When you do not know whether the CLI is installed, authenticated, or pointed at the right account:
77
78```bash
79resend --json -q doctor
80```
81
82This is usually the fastest first read on:
83
84- CLI availability/version
85- whether an API key is being resolved
86- whether verified domains exist
87- whether the machine looks like an AI-agent environment
88
89### 4) Choose the primitive before the command
90
91- One logical transactional email → `emails send`
92- Up to 100 distinct transactional emails in one request → `emails batch`
93- Scheduled transactional email mutation → `emails update` / `emails cancel`
94- Campaign to a segment → `broadcasts create` / `broadcasts send`
95- Reusable hosted content → `templates *`
96- Sender or receiving setup → `domains *`
97- Inbound processing → `emails receiving *` + `webhooks *`
98- Scoped credentials → `api-keys *`
99- Recipient data and preferences → `contacts`, `contact-properties`, `topics`, `segments`
100- Local dev event loop → `webhooks listen` or `emails receiving listen`
101
102### 5) Know the current CLI gaps
103
104This version of the skill treats these as especially important:
105
106- **Template send gap:** the CLI manages templates, but the current `emails send` command surface does not expose a direct `--template-id`/template-vars flow.
107- **Domain capability update gap:** `domains update` exposes TLS/open/click tracking, but not an explicit sending/receiving capability toggle, while inbound help text references such a toggle.
108- **Stream commands are special:** `webhooks listen` and `emails receiving listen` are long-running and should be treated as NDJSON/event streams in agent mode.
109- **JSON error channel discrepancy:** the README promises machine JSON on stdout only, but the current source writes JSON errors with `console.error`, so wrappers must parse stderr too.
110
111### 6) Keep IDs and file paths
112
113Most multi-step flows become much easier if the agent persists:
114
115- domain IDs
116- email IDs
117- webhook IDs
118- topic IDs
119- segment IDs
120- template IDs/aliases
121- API key IDs
122- the file paths it generated for HTML or batch JSON
123
124## The mutation ladder
125
126For state-changing live operations:
127
1281. classify the task
1292. confirm the command sequence
1303. make any needed file assets (`.html`, batch JSON)
1314. run with `--json -q`
1325. verify with `get`, `list`, or a follow-up check
1336. persist returned IDs and next-step context
1347. only then continue to the next mutation
135
136## Bundled helper script
137
138`scripts/resend_cli.py` is intentionally agent-oriented.
139
140Commands:
141
142- `probe` — find the CLI, report install hints, and show environment basics
143- `catalog` — list known commands from the bundled catalogue
144- `info` — inspect one command and its notes/gaps
145- `recommend` — route a free-text task to the best CLI sequence
146- `scaffold` — print or materialise sample commands/files
147- `lint-batch` — statically validate an `emails batch` JSON file
148- `doctor` — explain likely causes of common CLI/API failures
149- `run` — execute the official CLI with deterministic defaults and tolerant JSON parsing
150
151Examples:
152
153```bash
154python3 scripts/resend_cli.py probe
155python3 scripts/resend_cli.py catalog --resource emails
156python3 scripts/resend_cli.py info "emails send"
157python3 scripts/resend_cli.py recommend "send 70 different shipment notifications"
158python3 scripts/resend_cli.py scaffold batch-send --write-dir ./tmp
159python3 scripts/resend_cli.py lint-batch ./tmp/batch-emails.json
160python3 scripts/resend_cli.py doctor --command "emails send" --status 403 --message "1010 forbidden"
161python3 scripts/resend_cli.py run -- emails list --limit 5
162```
163
164## Response shape this skill should produce
165
166A strong answer usually includes:
167
1681. the exact Resend primitive,
1692. the exact CLI command or command sequence,
1703. any file scaffolding the user needs,
1714. the operational caveats that matter here,
1725. the verification step,
1736. the fallback path if the CLI does not currently cover the flow.
174
175## Example prompts this skill should handle
176
177- “Use the Resend CLI to send a scheduled password reset email”
178- “Should I use `emails send`, `emails batch`, or `broadcasts create`?”
179- “Create a sending + receiving domain in `eu-west-1`”
180- “Set up local webhook listening with ngrok”
181- “Why is my batch file failing?”
182- “How do I manage multiple Resend accounts from one agent?”
183- “Can the CLI send a hosted template directly?”
184- “How should my agent parse `resend` output safely?”