
designing-email-templates
Author, save, and edit email templates in the PostHog workflows library — compose email design JSON with Liquid personalization and create and round-trip-edit templates over MCP. Use when asked to design, build, update, or fix an email template for workflows, broadcasts, or campaigns.
- Installs
- 175
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/posthog/ai-plugin --skill designing-email-templates- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads designing-email-templates automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Designing email templates
Use this skill when creating or editing email templates for PostHog workflows — broadcast campaigns and function_email workflow actions send the rendered template.
How authoring works
You author the design JSON (content.email.design) and save it with workflows-create-email-template. The server renders the sent email from your design with the same renderer PostHog's visual editor uses, so the template opens as editable blocks for humans and sends exactly what the design describes. Schema, the native blocks and spacing rules every email follows, and a working example in references/unlayer-design-json.md.
When talking to the user, call it the template's design — the design document format is an internal implementation detail. Always share the template's _posthogUrl edit link in your reply after creating or updating, so the user can open it in PostHog directly.
Read references/design-guidelines.md before composing — it covers committing to a design direction, typography, color, and the patterns that make an email look designed rather than generated. For one fragment the block editor can't express, use an html-type content block inside the design.
Personalization with Liquid
Email content uses Liquid templating. Liquid tags pass through the renderer as plain text, so use them anywhere — block text, subject, links:
Hi {{ person.properties.first_name | default: 'there' }},
Marketing emails must include an unsubscribe link — render it with the built-in variables:
<a href="{{ unsubscribe_url }}">Unsubscribe</a>
({{ unsubscribe_url_one_click }} is also available for one-click list-unsubscribe flows.)
A template written for Customer.io can keep its {% unsubscribe_url %} tag, which renders the same link as {{ unsubscribe_url }}.
Output is HTML-escaped by default, so a value renders as text even when it contains markup:
- Don't add
| escape. It escapes a second time, and&reaches the inbox as&amp;. - For HTML your own backend builds, such as a summary list, add
| raw:{{ variables.summary_html | raw }}. Never userawon text a person typed. - Format money with
currency:{{ variables.amount | currency: "USD" }}renders$1,234.50. A value that isn't a number renders unchanged.
Click tracking and opt-out
Every link is automatically rewritten through a click-tracking redirect. This breaks mobile universal links / app deeplinks, which only resolve when the href stays on their own domain. To keep a link untracked, mark its anchor (use an html block) with clicktracking="off" or data-ph-no-track:
<a href="https://app.example.com/deeplink" data-ph-no-track>Open in app</a>
The marker must be on the <a> tag itself, not a child element. Opted-out links get no click metrics.
Images
Call media-images-list with purpose="email" first — reuse an existing image (a logo, a header banner) instead of uploading a duplicate.
To add a new image, upload it with the presigned flow rather than embedding bytes in the design:
media-image-upload-startwith the file's name andpurpose="email"— returnsid,upload_url, andform_fields.- From a shell, POST the local file to
upload_url:curl -X POST <upload_url> -F key=value... -F file=@/path/to/image.png(theform_fieldsfrom the response,filelast). Never base64-encode image bytes into a tool call — a flipped token corrupts the image. media-image-upload-completewith theid— returns the permanenturl.
Put that url in the image block's values.src.url (see references/unlayer-design-json.md). The block also takes values.src.width/height; the media tools don't return dimensions, so if you have shell access to the local file, measure it yourself rather than guessing.
Images must be under 4MB and decode as PNG, JPEG, GIF, WebP, AVIF or BMP.
Creating a template
Call workflows-create-email-template with:
{
"name": "Welcome email",
"description": "Sent to new signups on day 0",
"type": "email",
"content": {
"templating": "liquid",
"email": {
"subject": "Welcome to {{ person.properties.company | default: 'our product' }}",
"design": {
"counters": { "u_row": 1 },
"schemaVersion": 16,
"body": { "rows": ["…"], "values": { "preheaderText": "Three short steps to get you set up" } }
},
"text": "Plain-text fallback of the same message"
}
}
}
subjectis required for email templates.- Put the preview text that most inboxes show after the subject in the design's
body.values.preheaderText. The rendered html carries it, so it reaches the inbox on every send path. Leavecontent.email.preheaderunset, so the email carries one preview text. - Always author the
designand omithtml- the server renders html from the design. Sending hand-written html without a design produces an email the visual editor can only show as one raw block. - Always provide
textas a real plain-text rendering of the message - clients that block rich content show onlytext, so filler like "placeholder" reaches real inboxes, and a text part that doesn't match the html hurts deliverability. - The tool result returns an edit link into the PostHog library.
- After creating (or updating), call
workflows-show-email-template— it renders an inline preview so the user sees the result.
Payload mechanics
Pass the design directly in the tool call — no scratch files, no pre-validation subprocesses, no payload preview rounds. Liquid tags ({{ }}, {% %}), apostrophes, single quotes, and emoji are ordinary characters inside JSON strings; only standard JSON escaping applies. Never rewrite content to avoid them — converting Liquid's single quotes to double quotes inside markup attributes breaks the markup. If the tool call is rejected as malformed, fix the JSON escaping and resend the same content unchanged.
Converting an existing HTML email
To move an email from another platform, rebuild it from native blocks instead of pasting its HTML into one html block, so people can still edit it:
- Each part of the source becomes the native block it shows: a
heading, atextblock per paragraph, abuttonper call to action, animageper picture. Keep the source's colors, font sizes, and padding on each block. - Re-host every image through the media library (see Images). Put the file's real dimensions in
src.widthandsrc.height, and set the displayed width withsrc.maxWidthas a percentage of the content width. Source HTML often declares a height that doesn't match the file. - A section the source wraps in
{% if %}becomes a block with a display condition (see references/unlayer-design-json.md). - Rename the source platform's Liquid variables to the ones this send provides. A transactional API send provides everything the caller passes in
message_dataas{{ variables.* }}. - Buttons have no
box-shadow. A 3px bottom border in a darker shade (border.borderBottomWidth,borderBottomStyle,borderBottomColor) gives the same raised look. - The
socialblock draws only its own icon sets. To keep custom icons, put the icon row in anhtmlblock with the re-hosted images.
Editing a template (read–modify–write)
content is replaced as a whole on update, never merged — and humans may have edited the design in PostHog's visual editor since you last saw it:
workflows-get-email-template— always fetch fresh; the returneddesignis the current source of truth.- Modify the
design(keep subject/text alongside it). workflows-update-email-template— send the completecontentback. The server re-renders the sent email from the edited design.workflows-show-email-template— render the updated template so the user sees the change; its response carries the final rendered html, so read it before describing the result.
For small changes to an existing design, prefer workflows-patch-email-template: id-addressed operations over the Unlayer blocks, so you send only the edit instead of the whole design.
Editing the email inside a workflow step
A function_email step carries its own email snapshot (config.inputs.email.value with subject/text/html/design), independent of any library template.
Edit it with workflows-patch-action-email: the same design operations as workflows-patch-email-template, plus an email_patch merge for subject, preheader, text, and recipients.
workflows-get— the step's current design (and its block ids) is inconfig.inputs.email.value.design.workflows-patch-action-emailwith the workflow id, the step'saction_id, and your operations and/oremail_patch. When the operations change the copy, the same call'semail_patchsets a matchingtext.- The HTML is re-rendered server-side from the patched design, so it never goes stale.
- On an active workflow the edit stages a draft — test with
workflows-test-run(use_draft=true) and apply it withworkflows-publish.
Using templates
- List what exists with
workflows-list-email-templates(metadata only; fetch one for its content). - When the user asks to see a template, call
workflows-show-email-template— it renders an inline preview. - Reference a template from a workflow's
function_emailaction (its UUID inconfig.template_uuid), or start a broadcast from it in the PostHog UI. The step takes a snapshot of the template's body at save - editing the library template later does not change steps that already used it. To change a step's email, patch that step withworkflows-patch-action-email. - Templates are soft-deleted by setting
deleted: trueviaworkflows-update-email-template.
FAQ
What does the designing-email-templates skill do?
Author, save, and edit email templates in the PostHog workflows library — compose email design JSON with Liquid personalization and create and round-trip-edit templates over MCP. Use when asked to design, build, update, or fix an email template for workflows, broadcasts, or campaigns.
How do I install designing-email-templates?
Run npx skills add https://github.com/posthog/ai-plugin --skill designing-email-templates in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/designing-email-templates/ (personal) or .claude/skills/designing-email-templates/ (project).
Which AI agents can use designing-email-templates?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is designing-email-templates safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains designing-email-templates?
It is published by posthog in posthog/ai-plugin. It has 175 recorded installs.
More from posthog/ai-plugin
instrument-product-analytics
posthog/ai-plugin
Add PostHog product analytics events to track user behavior. Use after implementing new features or reviewing PRs to ensure meaningful user actions are captured. Also handles initial PostHog SDK setup if not yet installed.
instrument-feature-flags
posthog/ai-plugin
Add PostHog feature flags to gate new functionality. Use after implementing features or reviewing PRs to ensure safe rollouts with feature flag controls. Also handles initial PostHog SDK setup if not yet installed.
cleaning-up-stale-feature-flags
posthog/ai-plugin
Identify stale feature flags in a PostHog project and clean up the code that checks them. Use when the user wants to find, audit, or remove unused, fully rolled out, or abandoned feature flags, run a feature flag hygiene review or a weekly cleanup, reduce feature flag tech debt, or asks "which flags can I remove?". When the agent can read and edit a repository it performs the code cleanup itself: tested local changes, and one draft PR per flag when the user authorizes publishing. Agents without repository access generate a tailored cleanup prompt instead. Covers staleness detection, dependency checking, retained-path rules, and the code-first ordering. This skill does not archive or otherwise change a flag in PostHog.
auditing-experiments-flags
posthog/ai-plugin
Audit PostHog experiments and feature flags for configuration issues, staleness, and best-practice violations. Read when the user asks to audit, health-check, or review experiments or feature flags, check flag hygiene, or verify experiment setup.
querying-posthog-data
posthog/ai-plugin
Explains how to query PostHog data, defaulting to typed runners for supported product analytics. Read it before you write HogQL/SQL. Also read it before you call execute-sql against PostHog. Use it to find or aggregate PostHog entities. These entities include insights, dashboards, cohorts, feature flags, experiments, surveys, hog flows, warehouse data, and persons. Use it for trends, funnels, retention, lifecycle, paths, stickiness, web analytics, error tracking, logs, sessions, and LLM traces. Before you calculate a governed business or telemetry measure, check system.informationschema.metrics for an approved definition. Examples include MRR, activation, billable usage, active organizations, and failure rates. Use the approved definition before you derive a measure from raw events or use a typed domain tool. It also covers HogQL differences, system table schemas, functions, query examples, and schema discovery.
creating-experiments
posthog/ai-plugin
Guides agents through experiment creation: reading the project's setup with experiment-setup-context, defining the hypothesis, configuring rollout and bucketing, setting up analytics and running time, and reporting which choices are guesses. Delegates rollout decisions to configuring-experiment-rollout and metric setup to configuring-experiment-analytics. TRIGGER when: user asks to create a new experiment or A/B test, OR when you are about to call experiment-create. DO NOT TRIGGER when: user is updating an existing experiment, managing lifecycle, or only browsing experiments.
Popular productivity & automation skills
agent-browser
vercel-labs/agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.
lark-doc
open.feishu.cn
飞书云文档(Docx / Wiki)内容操作:读取、创建、编辑文档,插入或下载图片附件,以及操作思维笔记。用户提供文档 URL/token(包括 doubao.com 的 /docx/、/wiki/)时使用;按 URL 路径/token 而非域名路由;/page/ 是妙搭应用,非飞书云文档。文档内嵌资源按读取参考中的统一规则分流。独立评论操作走 lark-drive;随正文读取评论使用 docs +fetch。表格或 Base 内部数据操作不在本 skill。
lark-base
open.feishu.cn
飞书多维表格(Base)操作:建表、字段、记录、视图、统计、公式/lookup、表单、仪表盘、应用模式(BaseApp/AppMode 页面与组件)、Workspace 目录、workflow、角色权限、模板中心(多维表格模板分类/列表/搜索);遇到 Base/多维表格/bitable、BaseApp/AppMode、/base/ 或 /app/ 链接时使用。BaseApp 不走 lark-apps;文件导入/导出转 lark-drive,认证/授权转 lark-shared。
lark-drive
open.feishu.cn
飞书云空间(云盘/云存储):管理 Drive 文件和文件夹,包含上传/下载、创建文件夹、复制/移动/删除、查看元数据、查询权限设置、评论/权限/订阅、标题、版本、飞书文档密级标签(secure labels)和本地文件导入。用户需要整理云盘目录、处理云空间资源 URL/token、判断链接类型/真实 token/标题,或导入 Word/Markdown/Excel/CSV/PPTX/.base 为 docx/sheet/bitable/slides 时使用;doubao.com 云空间 URL/token 也按资源路径和 token 路由,不回退 WebFetch。不负责:文档内容编辑(走 lark-doc)、表格/Base 表内数据操作(走 lark-sheets/lark-base)、知识空间节点/成员管理(走 lark-wiki)、原生 Markdown 文件读写/patch/diff(走 lark-markdown)。
lark-shared
open.feishu.cn
Use for lark-cli setup/auth tasks: auth login/status/logout, user vs bot identity, business-domain permissions (--domain, including all/docs/drive), missing scopes, revoking authorization, or handling notice JSON.
lark-im
open.feishu.cn
飞书即时通讯:收发消息和管理群聊。发送和回复消息、搜索聊天记录、管理群聊成员、上传下载图片和文件、管理表情回复、发送应用内/短信/电话加急、发送和处理交互卡片(Interactive Card)、监听卡片按钮回调(card.action.trigger)。当用户需要发消息、查看或搜索聊天记录、下载聊天中的文件、查看群成员、搜索群、创建群聊或话题群、管理标记数据、管理 Feed 置顶(添加/移除/查询置顶会话)、管理标签数据、处理卡片回调时使用。