converting-email-templates
Use when converting or migrating email templates from another provider (SendGrid, Mailgun, Mandrill, Postmark, Brevo, Amazon SES) to Mailtrap-compatible Handlebars syntax. Supports single file, bulk directory, and inline HTML conversion.
What this skill does
# 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:
```bash
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:
| 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:
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.
Related in Ads & Marketing
ads
IncludedMulti-platform paid advertising audit and optimization skill. Analyzes Google, Meta, YouTube, LinkedIn, TikTok, Microsoft, and Apple Ads. 250+ checks with scoring, parallel agents, industry templates, and AI creative generation.
banana
IncludedAI image generation Creative Director powered by Google Gemini Nano Banana models. Use this skill for ANY request involving image creation, editing, visual asset production, or creative direction. Triggers on: generate an image, create a photo, edit this picture, design a logo, make a banner, visual for my anything, and all /banana commands. Handles text-to-image, image editing, multi-turn creative sessions, batch workflows, and brand presets.
rpg-migration-analyzer
IncludedAnalyzes legacy RPG (Report Program Generator) programs from AS/400 and IBM i systems for migration to modern Java applications. Extracts business logic from RPG III/IV/ILE source code, identifies data structures (D-specs), file operations (F-specs), program dependencies (CALLB/CALLP), and converts RPG constructs to Java equivalents. Generates migration reports, complexity estimates, and Java implementation strategies with POJO classes, JPA entities, and service methods. Use when modernizing AS/400 or IBM i legacy systems, analyzing RPG source files (.rpg, .rpgle, .RPGLE), converting RPG to Java, mapping data specifications to Java classes, planning legacy system migration, or when user mentions RPG analysis, Report Program Generator, RPG III/IV/ILE, AS/400 modernization, IBM i migration, packed decimal conversion, or mainframe application rewrite.
brand-library-architect
IncludedBuild a complete brand library for a product — visual asset render pipeline, brand documentation set (BRAND, COPY, MANIFESTO, BIOS, FAQ, GLOSSARY, TONE, PRICING), open-source convention files (README, CONTRIBUTING, SECURITY, CODE_OF_CONDUCT), and a self-contained press kit. This skill should be used when the user asks to "build a brand library / brand kit / press kit / brand assets" for a product, "set up a brand library workflow," "create a positioning manifesto plus visual identity," or any combination of brand documentation + visual asset pipeline. Apply phase-by-phase or run end-to-end. Templates are product-agnostic and use {{TOKEN}} placeholders the skill prompts the user to fill.
writing-tech-post
IncludedAuthors engineering blog posts end-to-end: launch deep-dives, incident postmortems, architecture migrations, performance case studies, tutorials, AI/agent system writeups, security disclosures, and research-to-product translations. Picks the correct archetype, plans the abstraction ladder, enforces an evidence cadence (diagrams, benchmarks, profiles, traces, code, ablations), tunes voice against publisher house styles (Datadog, Vercel, GitHub, AWS, Meta, Cloudflare, Jane Street), and runs a pre-publish gate for narrative momentum and disclosure ethics. Use when drafting a new engineering post, restructuring a draft that feels flat, deciding which evidence form belongs where, validating that depth and product context are balanced, or preparing a postmortem, migration, or performance narrative for external publication. Do not use for API reference documentation, README authoring, marketing copy, release notes, generic SEO content, ghost-written executive thought leadership, or non-engineering long-form essays.
blog-google
IncludedGoogle API integration for blog performance: PageSpeed Insights, CrUX Core Web Vitals with 25-week history, Search Console performance, URL Inspection, Indexing API, GA4 organic traffic, NLP entity analysis for E-E-A-T, YouTube video search for embedding, and Google Ads Keyword Planner. Progressive feature availability based on credential tier (API key, OAuth/service account, GA4, Ads). Shares config with claude-seo at ~/.config/claude-seo/google-api.json. Use when user says "google data", "page speed", "core web vitals", "search console", "indexation", "GA4", "keyword research", "nlp entities", "blog performance", "youtube search", "google api setup".