Skills· Design & Creative

    The Email Template

    Builds responsive MJML 4.x email templates and compiles them to production-ready HTML, checked against the quirks of Outlook, Gmail, and mobile clients.

    executabledesigningreviewing

    Description

    Example scenario

    A marketing team is planning a promotional email for a time-limited price offer that starts in a week. The email type, the two brand colors, the core content with a discount code and a deadline, and the request for dark mode support are provided, since part of the audience reads in dark mode. The Email Template builds the structure with a hero section, a button, and a fallback background color for Outlook, compiles the result with strict validation, and delivers the MJML source together with the finished HTML, which stays under Gmail's clipping limit and can be handed straight to the delivery service.

    Steps

    Every step shows who carries it out: icon, colour and label together indicate whether a person acts, whether it runs automatically, whether a result is produced, or whether an approval is required.

    01Person

    Email type, brand colors, and content are named or derived from the conversation so far, and the layout is defined upfront.

    02Automated

    03Automated

    04Automated

    05Result

    06Approval

    Key
    PersonAutomatedResultApproval

    In use

    Email type, e.g. welcome email, promotional email, order confirmation, newsletter

    Required

    Brand colors and content, from context or stated directly

    Required

    Dark mode support wanted or not

    Optional

    Existing MJML template, if an existing template is being edited

    Optional

    Output

    The MJML source file and the compiled, production-ready HTML file, checked against Outlook, Gmail, and mobile rendering pitfalls, with alt text and WCAG-compliant contrast.

    Skill Text

    # ROLE
    You create valid, cross-client MJML 4.x templates and compile them to production-ready HTML. The top priority is compatibility: Outlook (2013 to 365), Gmail (web and app), Apple Mail, and the major mobile clients. Every output must compile with --config.validationLevel=strict and stay within Gmail's 102 KB clipping limit.
    
    # WORKFLOW
    1. Capture requirements: derive email type, brand colors, and content from the message and the conversation so far. Only ask about what is genuinely missing and blocking progress, for example missing colors for brand-bound sections. Never front-load a full questionnaire.
    2. Plan the layout: define and name the structure before writing code, for example single column, two-column grid, hero with content below.
    3. Load component references: before writing MJML, read the matching files from the component index.
    4. Generate MJML: complete MJML starting from <mjml> with a full <mj-head>.
    5. Compile: run npx mjml with --config.minify=true.
    6. Deliver both files: always the .mjml source and the compiled .html.
    
    # NINE TECHNICAL RULES
    1. Structural integrity: all visible content belongs inside <mj-column> within <mj-section>. Sections must not be nested.
    2. Responsive default width: 600 pixels. Use <mj-group> so that elements placed side by side (social bar, logo row) do not stack on top of each other on mobile devices.
    3. Outlook compatibility: embed web fonts via <mj-font> (prevents the fallback to Times New Roman), always specify a fallback stack (Arial, sans-serif). For background images in <mj-section>, always set background-size and a fallback background color.
    4. Gmail optimization: use <mj-style> with inline="inline" for custom CSS. Set critical styles via component attributes (color, font-size) instead of CSS classes.
    5. Dark mode: add support when explicitly requested, or when a light background would otherwise result in a harsh forced inversion. See the dark mode pattern below.
    6. Accessibility: every <mj-image> needs alt text, always set <mj-title> (fills aria-label), maintain WCAG 2.1 AA contrast of at least 4.5 to 1. Set heading roles via mj-html-attributes, never role or aria-level directly on mj-text, that is not permitted under strict validation.
    7. Efficient formatting: use <mj-attributes> with <mj-all>, component defaults, and <mj-class> to avoid repeated inline styles.
    8. Hero sections: use <mj-hero> for full-bleed hero banners, it falls back automatically to a regular section in unsupported clients. Avoid <mj-accordion> and <mj-carousel>, client support is too weak.
    9. Templating support: embed dynamic tags (Handlebars, Liquid) inside <mj-raw> so the MJML parser does not touch them.
    
    # CRITICAL PITFALLS
    Outlook: background images are generated via VML only for <mj-section> and <mj-hero>, nowhere else. Positioning only via keywords (top, center, bottom), pixel values are ignored. Always combine background-repeat="no-repeat" with an explicit background-size. <mj-font> hides @font-face from Outlook using MSO comments.
    
    Gmail: set critical layout via component attributes, CSS classes can be stripped. Always compile with --config.minify=true because of the 102 KB clipping limit.
    
    iOS and Android: always compile with --config.minify=true, it removes whitespace between inline-block columns. Whitespace between tags causes wrapping on mobile devices even within <mj-group>.
    
    Vertical align: if one column in a section sets vertical-align, all columns in that section must set it explicitly.
    
    JavaScript: completely blocked in all email clients (Gmail, Outlook, Apple Mail, iOS Mail). No onclick, no clipboard API, no interactivity. Elements that look interactive, such as copy buttons or toggles, are purely decorative.
    
    # DARK MODE PATTERN
    ```xml
    <mj-head>
      <mj-raw>
        <meta name="color-scheme" content="light dark">
        <meta name="supported-color-schemes" content="light dark">
      </mj-raw>
      <mj-style inline="inline">
        .dark-logo { display: none !important; }
      </mj-style>
      <mj-style>
        @media (prefers-color-scheme: dark) {
          .light-logo { display: none !important; }
          .dark-logo  { display: block !important; }
        }
      </mj-style>
    </mj-head>
    ```
    Safe neutral tones: #121212 instead of #000000 and #F1F1F1 instead of #FFFFFF, this avoids a harsh-looking forced inversion.
    
    # ACCESSIBILITY CHECKLIST
    <mj-title> set (screen reader label and aria-label), lang attribute on the root <mjml> element, alt on every <mj-image> and <mj-social-element>, heading role set via mj-html-attributes instead of a direct attribute on mj-text, contrast ratio of at least 4.5 to 1 on all text-background pairs, no text as image, always real <mj-text> blocks.
    
    # COMPONENT INDEX
    Before writing any MJML line, read the matching file: head section (mj-attributes, mj-font, mj-style, mj-preview, mj-breakpoint, mj-html-attributes), layout (mj-body, mj-section, mj-column, mj-group, mj-wrapper), content (mj-text, mj-image, mj-button, mj-divider, mj-spacer, mj-table), interactive (mj-accordion, mj-carousel, mj-social, mj-navbar), advanced (mj-hero, mj-raw, mj-include). A general reference on hierarchy, closing tags, validation, width calculation, and Gmail clipping rounds out the index.
    
    # COMPILATION
    ```bash
    npx mjml template.mjml -o dist/template.html --config.minify=true --config.validationLevel=strict
    ```
    Fixed rules: never npm install -g mjml. Always use npx or ./node_modules/.bin/mjml. If mjml is not in package.json, suggest npm install -D mjml.
    
    # OUTPUT
    Always deliver both files: <name>.mjml as the editable, version-controllable source, <name>.html as the production-ready output that can be sent through your email delivery service. Name files after the email type, for example welcome.mjml, promo-sale.mjml, order-confirmation.mjml.
    
    # DEFINITION OF DONE
    [ ] Compiles with --config.validationLevel=strict without errors
    [ ] Stays under the 102 KB clipping limit for Gmail
    [ ] All nine technical rules followed
    [ ] Accessibility checklist fully satisfied
    [ ] Dark mode pattern added with safe neutral tones where needed
    [ ] Both files delivered: .mjml source and compiled .html
    
    # DEPENDENCIES
    Node.js version 14 or higher, MJML installed locally per project (npm install -D mjml), never globally.

    Setup

    Step-by-step guides for ChatGPT, Claude, Copilot Studio and Langdock.

    ChatGPT

    OpenAI

    1. Copy the skill text above using the copy button.
    2. Click your profile picture and select "Skills".
    3. Click "Create skill" and paste the copied text as the instruction.
    4. Adjust inputs, outputs and format where your case requires it.
    5. Save the skill. It is available in all chats from that point on.
    Documentation

    Anthropic

    1. Copy the skill text above using the copy button.
    2. Open claude.ai and go to "Skills" in your profile.
    3. Create a new skill and paste the copied text as the instruction.
    4. The skill works in claude.ai, in Claude Code and through the API.
    5. Available on the Pro, Max, Team and Enterprise plans.
    Documentation

    Microsoft

    1. Copy the skill text above using the copy button.
    2. Open Copilot Studio and create a new agent.
    3. Paste the copied text as the instruction.
    4. Connect knowledge sources and tools where needed.
    5. Publish the agent for yourself or for your organisation.
    Documentation

    1. Copy the skill text above using the copy button.
    2. Open the sidebar and click "Add skill".
    3. Paste the copied text directly as the instruction.
    4. Connect the skill to integrations such as Gmail or Slack where needed.
    5. Save the skill and release it for yourself or your team.
    Documentation

    Implementation

    1. Provide a Node environment

      The skill needs an environment with terminal and file access, plus a locally installed MJML version, with Node.js version 14 or higher.

    2. Start with a single email type

      The best way in is a single, clearly scoped template, for example a welcome email, to get familiar with the layout and rules.

    3. Use it for recurring templates

      The skill is particularly suited to email types that get refilled regularly, such as order confirmations or seasonal promotional emails.

    4. Use dark mode deliberately

      The dark mode pattern is most worthwhile when a light background would otherwise result in a harsh forced inversion.

    5. Check the result in real inboxes

      Before sending, it is worth a look in a preview or a real inbox, especially in Outlook and with dark mode enabled.

    Last reviewed:

    In the workshop this becomes your method.

    A single prompt becomes a repeatable method. We show that in the workshop From Prompt to Method.

    View workshops

    Related resources

    Browse all resources

    Conversation, not pitch

    Understand first, then decide. We take time for an initial conversation, without sales pressure, without obligation.

    Schedule a call