MCP HubMCP Hub
SKILL·6E85A7

converting-email-templates

mailtrap
更新日 27 days ago
4 閲覧
9
1
9
GitHubで表示
メタai

について

このスキルは、SendGridやMailgunなどのプロバイダーのメールテンプレートを、Mailtrap互換のHandlebars構文に変換します。単一ファイル、一括ディレクトリ、またはインラインHTMLを処理し、パターンマッチングとエッジケース対応のLLMインテリジェンスを併用します。Mailtrapへのテンプレート移行時に構文変換を自動化するためにご利用ください。

クイックインストール

Claude Code

推奨
メイン
npx skills add mailtrap/mailtrap-skills -a claude-code
プラグインコマンド代替
/plugin add https://github.com/mailtrap/mailtrap-skills
Git クローン代替
git 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, or ses
  • Input: a single template file path, a directory of .html template 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 brevo AND 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:

  1. Read the flagged line in the original template.
  2. Consult references/conversion-rules.md for the specific rule and recommended action.
  3. 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:edit regions): 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.

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:

ProviderOld template fieldOld variables fieldMailtrap fieldMailtrap variables
SendGridtemplate_idpersonalizations[].dynamic_template_datatemplate_uuidtemplate_variables
Mailguntemplatet:variablestemplate_uuidtemplate_variables
Mandrilltemplate_nameglobal_merge_vars + merge_varstemplate_uuidtemplate_variables
PostmarkTemplateId/TemplateAliasTemplateModeltemplate_uuidtemplate_variables
BrevotemplateIdparamstemplate_uuidtemplate_variables
Amazon SESTemplateName/TemplateArnTemplateDatatemplate_uuidtemplate_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:

  1. Identify the source provider (ask if not stated).
  2. Apply the conversion rules from references/conversion-rules.md directly using LLM intelligence.
  3. 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.
  4. If there are flags, prepend a <!-- WARNING: ... --> comment at the top of the converted output noting how many flagged patterns need resolution.
  5. Present the converted Handlebars output with a list of changes made.
  6. Flag any patterns that need app-layer changes.
  7. 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 リポジトリ

mailtrap/mailtrap-skills
パス: skills/converting-email-templates
0
FAQ

よくある質問

converting-email-templates Skillとは何ですか?

converting-email-templates はmailtrap が作成した Claude Skillです。Skillは、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
メタ

このスキルは、Content Collections(Markdown/MDXファイルを型安全なデータコレクションに変換するTypeScriptファーストのツール)の本番環境でテストされた設定を提供します。Zodバリデーションによる型安全性を実現し、ブログ、ドキュメントサイト、コンテンツ重視のVite + Reactアプリケーション構築時にご利用ください。Viteプラグインの設定、MDXコンパイルから、デプロイ最適化、スキーマバリデーションまで、すべてを網羅しています。

スキルを見る
polymarket
メタ

このスキルは、開発者がPolymarket予測市場プラットフォームを活用したアプリケーション構築を可能にします。API統合による取引や市場データの取得に加え、WebSocketを介したリアルタイムデータストリーミングにより、ライブ取引や市場活動を監視できます。取引戦略の実装や、ライブ市場更新を処理するツールの作成にご利用ください。

スキルを見る
creating-opencode-plugins
メタ

このスキルは、開発者がコマンド、ファイル、LSP操作など25種類以上のイベントタイプにフックするOpenCodeプラグインを作成することを支援します。JavaScript/TypeScriptモジュール向けに、プラグイン構造、イベントAPI仕様、および実装パターンを提供します。カスタムイベント駆動ロジックでOpenCode AIアシスタントのライフサイクルをインターセプト、監視、または拡張する必要がある場合にご利用ください。

スキルを見る
sglang
メタ

SGLangは、高性能なLLMサービングフレームワークであり、RadixAttentionプレフィックスキャッシュを活用したJSON、正規表現、エージェントワークフロー向けの高速で構造化された生成を特長とします。特にプレフィックスが繰り返されるタスクにおいて、大幅に高速な推論を実現し、複雑な構造化出力やマルチターン対話に最適です。制約付きデコードが必要な場合や、広範なプレフィックス共有を伴うアプリケーションを構築する場合は、vLLMなどの代替案ではなくSGLangを選択してください。

スキルを見る