resend-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Resend CLI

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:
  1. choose the right Resend primitive,
  2. choose the right CLI command,
  3. run it in a deterministic non-interactive way,
  4. detect the important CLI coverage gaps before it gets stuck, and
  5. fall back to MCP/API only when the CLI genuinely does not cover the job.
此技能适用于应优先通过官方CLI操作Resend的Agent,而非直接使用原生REST接口。
目标不仅是“了解命令”,而是让Agent能够:
  1. 选择合适的Resend原语,
  2. 选择合适的CLI命令,
  3. 以确定性的非交互方式运行命令,
  4. 在陷入困境前发现重要的CLI覆盖缺口,
  5. 仅当CLI确实无法完成任务时,才回退到MCP/API。

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
仅加载与任务匹配的文件:
  • references/agent-operating-model.md
    —— 实时Resend工作的默认决策流程
  • references/install-auth-and-profiles.md
    —— 安装方法、认证优先级、配置文件、配置路径
  • references/subprocess-contract.md
    —— Agent应如何安全调用
    resend
    并解析输出
  • references/command-selection.md
    —— 将用户意图快速路由到正确命令的方法
  • references/sending-scheduling-and-batch.md
    —— 事务性发送、调度、标签、附件、批量限制
  • references/domains-dns-and-deliverability.md
    —— 域名创建、验证、收件、TLS、追踪、403/域名不匹配问题
  • references/webhooks-and-listeners.md
    —— Webhook创建、更新、签名处理、临时本地监听器
  • references/inbound-receiving-and-threading.md
    —— 收件列表/获取/附件/转发/监听流程
  • references/contacts-topics-segments-and-broadcasts.md
    —— 订阅建模、目标定位、营销活动
  • references/templates-and-coverage-gaps.md
    —— 模板生命周期及当前重要的CLI缺口
  • references/diagnostics-and-fallbacks.md
    —— 调试顺序、CLI特性、何时回退到MCP/API
  • references/recipes.md
    —— 简短的端到端操作手册
  • references/sources.md
    —— 第一方源清单及更新说明
机器可读资源:
  • assets/command-catalog.json
    —— 带详细级别标记的命令索引(
    source_inspected
    readme_confirmed
    tree_confirmed
  • assets/task-router.json
    —— 将常见任务路由到命令序列
  • assets/error-map.json
    —— 快速故障诊断提示
  • assets/coverage-gaps.json
    —— 当前对Agent重要的CLI限制与歧义
  • assets/subprocess-contract.json
    —— 确定性调用默认值
  • assets/scaffold-index.json
    —— 可复用的命令/文件脚手架
  • assets/source-manifest.json
    —— 用于构建此技能的权威URL
捆绑助手:
  • scripts/resend_cli.py
    —— 用于探测、路由、脚手架搭建、批量检查、诊断及安全子进程执行的Agent封装器

Core operating rules

核心操作规则

1) Prefer the official CLI for live Resend work

1) 实时Resend工作优先使用官方CLI

Default order of preference:
  1. Official Resend CLI for live terminal/CI/agent operations
  2. Official Resend MCP server if the environment already exposes it and the CLI is unavailable
  3. Official SDK when editing app code inside an existing integration
  4. Raw REST only for stack-neutral examples, protocol debugging, or feature gaps
Do not choose raw REST just because it is familiar.
默认优先级顺序:
  1. 官方Resend CLI 用于实时终端/CI/Agent操作
  2. 官方Resend MCP服务器(若环境已暴露且CLI不可用)
  3. 官方SDK(在现有集成中编辑应用代码时)
  4. 原生REST 仅用于栈中立示例、协议调试或功能缺口
不要仅因为熟悉就选择原生REST。

2) For agents, stay non-interactive by default

2) 对于Agent,默认保持非交互模式

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
对于有限命令:
  • 显式传递所有必需的标志
  • 使用全局
    --json -q
    参数
  • 优先使用
    RESEND_API_KEY
    或存储的配置文件,而非交互式输入密钥
  • 设置
    RESEND_NO_UPDATE_NOTIFIER=1
    以获得确定性输出
  • 防御性地捕获标准输出和标准错误

3) Run
doctor
early when the environment is unknown

3) 环境未知时尽早运行
doctor
命令

When you do not know whether the CLI is installed, authenticated, or pointed at the right account:
bash
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
当你不确定CLI是否已安装、认证或指向正确账户时:
bash
resend --json -q doctor
这通常是最快了解以下信息的第一步:
  • CLI可用性/版本
  • 是否已解析API密钥
  • 是否存在已验证的域名
  • 机器是否看起来像AI-Agent环境

4) Choose the primitive before the command

4) 先选择原语,再选择命令

  • 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
  • 单封逻辑事务性邮件 →
    emails send
  • 一次请求中最多100封不同的事务性邮件 →
    emails batch
  • 调度事务性邮件修改 →
    emails update
    /
    emails cancel
  • 针对细分群体的营销活动 →
    broadcasts create
    /
    broadcasts send
  • 可复用的托管内容 →
    templates *
  • 发件人或收件设置 →
    domains *
  • 收件处理 →
    emails receiving *
    +
    webhooks *
  • 限定范围的凭据 →
    api-keys *
  • 收件人数据与偏好 →
    contacts
    contact-properties
    topics
    segments
  • 本地开发事件循环 →
    webhooks listen
    emails receiving listen

5) Know the current CLI gaps

5) 了解当前CLI的缺口

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.
此版本技能特别关注以下缺口:
  • 模板发送缺口:CLI可管理模板,但当前
    emails send
    命令未暴露直接的
    --template-id
    /模板变量流程。
  • 域名能力更新缺口
    domains update
    支持TLS/打开/点击追踪,但未提供显式的发送/接收能力切换,而收件帮助文本提及了此类切换。
  • 流命令特殊处理
    webhooks listen
    emails receiving listen
    是长期运行的命令,在Agent模式下应视为NDJSON/事件流。
  • JSON错误通道不一致:README承诺仅在标准输出返回机器可读JSON,但当前源码使用
    console.error
    写入JSON错误,因此封装器必须同时解析标准错误。

6) Keep IDs and file paths

6) 保留ID和文件路径

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
如果Agent持久化以下信息,大多数多步骤流程会变得容易得多:
  • 域名ID
  • 邮件ID
  • Webhook ID
  • 主题ID
  • 细分群体ID
  • 模板ID/别名
  • API密钥ID
  • 为HTML或批量JSON生成的文件路径

The mutation ladder

变更阶梯

For state-changing live operations:
  1. classify the task
  2. confirm the command sequence
  3. make any needed file assets (
    .html
    , batch JSON)
  4. run with
    --json -q
  5. verify with
    get
    ,
    list
    , or a follow-up check
  6. persist returned IDs and next-step context
  7. only then continue to the next mutation
对于改变状态的实时操作:
  1. 分类任务
  2. 确认命令序列
  3. 创建所需的文件资源(
    .html
    、批量JSON)
  4. 使用
    --json -q
    运行命令
  5. 通过
    get
    list
    或后续检查验证结果
  6. 持久化返回的ID和下一步上下文
  7. 之后才继续执行下一个变更操作

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:
bash
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
scripts/resend_cli.py
专为Agent设计。
命令:
  • probe
    —— 查找CLI,报告安装提示,并显示环境基础信息
  • catalog
    —— 列出捆绑目录中的已知命令
  • info
    —— 检查单个命令及其说明/缺口
  • recommend
    —— 将自由文本任务路由到最佳CLI序列
  • scaffold
    —— 打印或生成示例命令/文件
  • lint-batch
    —— 静态验证
    emails batch
    JSON文件
  • doctor
    —— 解释常见CLI/API故障的可能原因
  • run
    —— 使用确定性默认值和容错JSON解析执行官方CLI
示例:
bash
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:
  1. the exact Resend primitive,
  2. the exact CLI command or command sequence,
  3. any file scaffolding the user needs,
  4. the operational caveats that matter here,
  5. the verification step,
  6. the fallback path if the CLI does not currently cover the flow.
优质回答通常包含:
  1. 确切的Resend原语,
  2. 确切的CLI命令或命令序列,
  3. 用户所需的任何文件脚手架,
  4. 此处重要的操作注意事项,
  5. 验证步骤,
  6. 如果CLI当前不支持该流程的回退路径。

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?”
  • “使用Resend CLI发送一封定时密码重置邮件”
  • “我应该使用
    emails send
    emails batch
    还是
    broadcasts create
    ?”
  • “在
    eu-west-1
    创建一个发送+接收域名”
  • “使用ngrok设置本地Webhook监听”
  • “为什么我的批量文件失败了?”
  • “如何从一个Agent管理多个Resend账户?”
  • “CLI能否直接发送托管模板?”
  • “我的Agent应如何安全解析
    resend
    输出?”