关于
This skill converts email templates from providers like SendGrid or Mailgun into Mailtrap-compatible Handlebars syntax. It handles single files, bulk directories, or inline HTML, using both pattern matching and LLM intelligence for edge cases. Use it when migrating templates to Mailtrap to automate syntax conversion.
快速安装
Claude Code
推荐npx skills add mailtrap/mailtrap-skills -a claude-code/plugin add https://github.com/mailtrap/mailtrap-skillsgit clone https://github.com/mailtrap/mailtrap-skills.git ~/.claude/skills/converting-email-templates在 Claude Code 中复制并粘贴此命令以安装该技能
技能文档
Converting email templates
Purpose
Automatically convert email templates from other email service providers into Mailtrap-compatible Handlebars syntax. Handles both deterministic pattern conversions (via a Python script) and complex edge cases (via LLM intelligence).
Related skills: using-email-templates (Handlebars syntax, API template send), sending-emails (stream bases and auth), authorizing-api-requests (tokens, env vars, account_id resolution — needed when creating templates or sending via the Templates API after conversion).
Input
- Source provider (required):
sendgrid,mailgun,mandrill-handlebars,mandrill-mergetags,postmark,brevo, orses - Input: a single template file path, a directory of
.htmltemplate files, or raw HTML pasted inline - Output directory (optional): defaults to a
/converted/subdirectory next to the input
If the user does not specify the source provider, ask before proceeding. If the user provides template HTML inline (pasted in chat), save it to a temporary .html file first.
Workflow
Step 1: Detect mode
Fast mode (default): For providers with deterministic conversion patterns. The Python script handles these reliably.
Deep mode: Triggered when:
- Provider is
brevoAND the template contains nested loops, multiple filters, or complex conditional nesting - The script flags patterns that could benefit from LLM judgment
- The user explicitly requests deep mode
- Inline HTML is provided (run LLM conversion directly)
Step 2: Run the converter script
Execute the Python converter script:
python3 {skill_dir}/scripts/converter.py \
--provider {provider} \
--input {input_path} \
--output {output_dir}
Where {skill_dir} is the directory containing this SKILL.md file.
Read the output:
- Exit code 0: clean conversion, no flags. Proceed to Step 4.
- Exit code 1: conversion completed with flags. Proceed to Step 3.
- Exit code 2: error. Report to user and stop.
Read the .report.txt file(s) generated alongside each converted template. For bulk conversions, also read _summary.txt.
Note: When flags are present, the script automatically:
- Prepends a
<!-- WARNING: ... -->comment at the top of the converted file - Wraps unsupported syntax in
<!-- FLAGGED [RULE]: message -->HTML comments so the file can be pasted into the Mailtrap editor without triggering parser errors
Step 3: Handle flags (Deep mode)
For each flag in the report:
- Read the flagged line in the original template.
- Consult
references/conversion-rules.mdfor the specific rule and recommended action. - Categorize the flag:
- App-layer change required (e.g.,
formatDate, comparison helpers): Cannot be resolved in the template. Report to the user with a clear explanation of what they need to change in their application code. Suggest the replacement variable name. - Template-level fix possible (e.g., Brevo nested loops, Mandrill
mc:editregions): Apply the conversion using LLM judgment. Show the user the before/after and ask for confirmation before writing. - Ambiguous (e.g., Postmark closing tag mismatch): Show the user both the original context and the converted output. Ask them to verify.
- App-layer change required (e.g.,
Present flags grouped by category:
## Conversion Complete
### Auto-converted: [count] changes
[Brief summary or collapsed details]
### Needs your application code: [count] flags
[For each: what to change, why, suggested variable name]
### Needs verification: [count] flags
[For each: show before/after, ask for confirmation]
Step 4: Present results
Single file:
Converted: {filename}
Changes: [count] | Flags: [count]
Output: {output_path}
[Show the conversion report summary]
[If flags exist, show the categorized flag breakdown from Step 3]
Bulk conversion:
Converted: [count] files
Total changes: [count] | Total flags: [count]
Clean: [count] files | Needs review: [count] files
Output: {output_dir}
[Show the summary report]
[List files needing review with their specific flags]
Step 5: API field mapping reminder
After template conversion, always remind the user about the API-side changes they need to make. Reference the quick mapping table:
| Provider | Old template field | Old variables field | Mailtrap field | Mailtrap variables |
|---|---|---|---|---|
| SendGrid | template_id | personalizations[].dynamic_template_data | template_uuid | template_variables |
| Mailgun | template | t:variables | template_uuid | template_variables |
| Mandrill | template_name | global_merge_vars + merge_vars | template_uuid | template_variables |
| Postmark | TemplateId/TemplateAlias | TemplateModel | template_uuid | template_variables |
| Brevo | templateId | params | template_uuid | template_variables |
| Amazon SES | TemplateName/TemplateArn | TemplateData | template_uuid | template_variables |
Only show the row for the provider that was just converted.
Inline conversion (no file)
If the user pastes template HTML directly in chat instead of providing a file path:
- Identify the source provider (ask if not stated).
- Apply the conversion rules from
references/conversion-rules.mddirectly using LLM intelligence. - Comment out unsupported syntax in the converted output by wrapping it in
<!-- FLAGGED [RULE]: message -->HTML comments (same format as the script). This prevents editor errors when the user pastes the output into Mailtrap. - If there are flags, prepend a
<!-- WARNING: ... -->comment at the top of the converted output noting how many flagged patterns need resolution. - Present the converted Handlebars output with a list of changes made.
- Flag any patterns that need app-layer changes.
- Offer to save the result to a file.
This mode always uses Deep mode (LLM) since there is no file to pass to the script.
Rules
- Never silently skip a flagged pattern. Every flag must be reported to the user.
- Never modify the original file. Converted output always goes to the output directory.
- Preserve HTML structure. Only modify template syntax (variables, conditionals, loops, helpers). Do not touch HTML tags, attributes, CSS, or non-template content.
- When in doubt, flag. If a pattern is ambiguous, flag it for manual review rather than making an incorrect conversion.
- Report counts. Always show the number of changes and flags so the user knows the scope.
- One provider at a time. If a directory contains templates from multiple providers, ask the user to separate them or specify the provider for the batch.
GitHub 仓库
常见问题
什么是 converting-email-templates Skill?
converting-email-templates 是一个 Claude Skill,作者为 mailtrap。Skill 将 Claude 按需加载的说明和资源打包,让 Claude 无需额外提示即可执行与 converting-email-templates 相关的任务。
如何安装 converting-email-templates?
使用本页的安装命令:将 converting-email-templates 作为插件添加到 Claude Code,或将其仓库克隆到 skills 目录,然后重启 Claude 以加载该 Skill。
converting-email-templates 属于哪个分类?
converting-email-templates 属于元分类。
converting-email-templates 可以免费使用吗?
可以。converting-email-templates 已收录在 AIMCP,可免费安装。
相关推荐技能
Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。
这个Claude Skill为开发者提供完整的Polymarket预测市场开发支持,涵盖API调用、交易执行和市场数据分析。关键特性包括实时WebSocket数据流,可监控实时交易、订单和市场动态。开发者可用它构建预测市场应用、实施交易策略并集成实时市场预测功能。
该Skill帮助开发者创建OpenCode插件,用于接入命令、文件、LSP等25+种事件。它提供了插件结构、事件API规范和JavaScript/TypeScript实现模式,适合需要拦截操作、扩展功能或自定义事件处理的场景。开发者可通过它快速构建响应式模块来增强OpenCode AI助手的能力。
SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。
