Turn an insight into a draft
Turns one finding from a report into one draft change in Klaviyo, after the user approves it: a segment and draft campaign, revised campaign copy, or an edited flow message.
This skill is experimental. It may change, so review what it produces.
npx skills add klaviyo-labs/skills --skill klaviyo-insight-to-draftFiles
Turns one finding from a report into one draft change in Klaviyo, after the user approves it: a segment and draft campaign, revised campaign copy, or an edited flow message.
If the Klaviyo MCP server's tools are not available in this session, say so and stop. Do not guess at results.
When to use
- Right after a report or the klaviyo-account-overview skill surfaced a problem or opportunity
- "Okay, fix the abandoned cart flow"
- "Can you set that up?"
- "Target the people who clicked but didn't buy"
If no finding is in the conversation yet, get one first with a performance report or the klaviyo-account-overview skill. Do not invent a problem to solve. If the user wants a segment or campaign built from scratch, with no finding behind it, a dedicated segment or campaign skill is a better fit.
Data rules
Event metrics. Accounts often have the same event from more than one source, such as one Placed Order from Shopify and another from the API. Before building a condition on an event, check each copy's count with
query_metric_aggregates(measurements: ["count"],interval: "month") and use the copy that has events.Timeframes. Report tools (
get_campaign_report,get_flow_report) take either a preset{"key": "last_90_days"}or a custom range{"start": "<ISO datetime>", "end": "<ISO datetime>"}, with no wrapper object.query_metric_aggregatesis different: its range goes in thefilterlist as two strings,greater-or-equal(datetime,<ISO datetime>)andless-than(datetime,<ISO datetime>).Names, not IDs. Find objects by name with the list tools. Never guess an ID. If a name matches more than one object, ask.
Segment definitions. Condition groups are ANDed; conditions inside a group are ORed. Each thing that must be true gets its own group. Shape, from the
create_or_update_segmentschema:json {"condition_groups": [ {"conditions": [{"type": "profile-metric", "metric_id": "<started checkout id>", "measurement": "count", "measurement_filter": {"type": "numeric", "operator": "greater-than-or-equal", "value": 1}, "timeframe_filter": {"type": "date", "operator": "in-the-last", "unit": "day", "quantity": 60}}]}, {"conditions": [{"type": "profile-metric", "metric_id": "<placed order id>", "measurement": "count", "measurement_filter": {"type": "numeric", "operator": "equals", "value": 0}, "timeframe_filter": {"type": "date", "operator": "in-the-last", "unit": "day", "quantity": 60}}]}, {"conditions": [{"type": "profile-marketing-consent", "consent": {"channel": "email", "can_receive_marketing": true, "consent_status": {"subscription": "any"}}}]} ]}
Instructions
Work in this order. One approval covers one row of the proposal table, with every tool call that row needs.
- Restate the finding in one sentence, with the metric value behind it (for example "123 checkouts started in the last 60 days, 0 recovery emails sent"). If several findings are open, recommend one and ask which to act on.
- Check whether the real fix is a change this skill makes, a change the server can make another way, or something only Klaviyo's UI can do:
- Flow trigger, trigger filters, or profile filters.
update_flowchanges only a flow's status. Callreport_unsupported_task(blocker_type: "tool_too_narrow",area: "flows",action: "update"), then offer the supported route: read the flow withget_flow(additional_fields_flow: ["definition"]), and build a copy withcreate_flowthat keeps the actions and uses the new trigger. The copy is created in draft. Tell the user to review it in Klaviyo, set it live, and set the old flow to manual or draft themselves. Do not change the old flow. - Form changes.
create_or_update_formcan edit a form, but that is outside this skill. Say so and stop. - Otherwise, pick the smallest change below.
- Flow trigger, trigger filters, or profile filters.
- Pick the smallest change that addresses it:
- Audience (sends to a small or full list, low engagement, or a group that responds): a segment, then a draft campaign aimed at it.
- Weak campaign message: a new draft with a revised subject line, preview text and body outline, modeled on the account's best campaign.
- Weak or missing flow step: new copy or timing for that specific message.
- For a segment, check that the audience exists before proposing it. Count unique profiles for each event condition over the window you plan to use, with
query_metric_aggregatesmeasurements: ["unique"]. This is an upper bound, not the segment size: it ignores the AND between conditions and the consent condition. If any count is zero, the segment would be empty. Widen the window to cover when the events actually happened, or say the audience does not exist yet and stop. Always add a condition group requiring that profiles can receive email marketing. Write the logic out in plain language with AND and OR, for example "started checkout in the last 60 days AND no placed order in the last 60 days AND can receive email marketing". - For copy, gather the brand inputs before writing:
get_brand_voice,get_brand_email_defaults, and the account's best recent campaign (get_campaign_reportforlast_90_days, thenget_campaign_messageon the top conversion-rate campaign with at least about 100 recipients). Write subject line, preview text and body outline in that voice. - For a flow message, read the action with
get_flowandget_flow_messageand note its status. If the action is draft or manual, the edit is a draft and goes throughupdate_flow_action. If the action is live, an edit would reach customers immediately, so this skill never edits it: create the revised copy as a standalone template withcreate_email_templatenamed{flow} - {message} - revised, leave the live message untouched, and tell the user how to swap it in Klaviyo. - Check the sender. Read
get_account_detailsfor the default sender andget_sending_domainsfor a verified branded domain. If the default sender is on a free mailbox domain (gmail.com, yahoo.com, outlook.com and similar) and no branded domain is verified, say so in the proposal: campaigns from that sender are likely to be filtered or blocked, so the draft should not be sent until a branded domain is set up. Do not block the draft on it. - Show the full proposal before any write: what will be created or changed, its name, the audience and its estimated size (labeled as an upper bound until the segment exists), the copy, and each tool you will call. Wait for an explicit yes.
- Write only what was approved:
- Segment:
create_or_update_segmentwith noid. Segments process asynchronously. Onceis_processingis false, read the size withget_segment(additional_fields_segment: ["profile_count"]) and report it. If it is still processing, say so rather than reporting zero. Use this count, not the step 4 estimate, in the campaign proposal. - Campaign:
create_email_template(orcreate_or_update_dnd_email_templatefor a drag-and-drop template), thencreate_campaignwith the audience and one message whose variation setstemplate_id. If the template was not attached inline, useassign_template_to_campaign_message. Thenrefresh_campaign_recipient_estimationandget_campaign_recipient_estimationfor the real recipient count. Preview withrender_email_templateand offer a test send withcreate_template_preview_send_job. A test send is the one email this skill ever sends, so confirm the recipient address with the user before calling it and send to no one else. - Existing campaign copy: read first with
get_campaign_messageorget_email_template, thenupdate_campaign_messageorupdate_email_template. For a campaign that was already sent, usecreate_campaign_cloneand edit the clone. - Flow message: per step 6. Never change the flow's status.
- Segment:
- After each write, read the object back and confirm it by name. If a write fails, explain the error in plain language, list what was already created in this run by name so nothing is orphaned silently, and stop. Do not retry with guessed IDs or fields.
- Close with what was created, where to review it in Klaviyo (segments at
https://www.klaviyo.com/lists/{SEGMENT_ID}, campaigns athttps://www.klaviyo.com/campaign/{CAMPAIGN_ID}/wizard), and how to tell whether it worked: the metric, the baseline, and when to check. For example, "Ask me for a weekly brief in two weeks."
Output
- Finding: one sentence with the metric value behind it.
- Proposal: a table with Change, Name, Audience (with size and whether it is an estimate), Tool calls.
- After writes: a checklist of what was created or updated, each by its Klaviyo name, with the review link.
- How to measure: the metric, the baseline, and when to check.
Boundaries
- This skill ends at a draft. It does not send a campaign, schedule one or set a flow live. Its only send is the test email in step 9, to an address the user confirms. If the user explicitly asks to send or schedule, follow that instruction outside this skill: first confirm audience, sender and send time in one message, and wait for a clear yes.
- This skill never edits a live flow action. The revised copy is always delivered as a standalone template (step 6).
- If no one can reply in this session (for example an API call, a non-interactive run, or a scheduled task), stop after presenting the proposal and write nothing. An approval cannot be assumed.
- One finding per run. Several changes are done one at a time, each with its own approval.
- Never delete anything. If a change seems to need a deletion, explain that and stop.
- Do not claim the change will lift a metric by a specific amount.