---
name: marketing-automation-audit
description: >
  Runs a comprehensive marketing automation audit against a Salesforce org, covering Pardot/Marketing Cloud,
  HubSpot, Marketo, ActiveCampaign, Klaviyo, and any other connected MAP. Use this skill whenever the user
  asks to audit their marketing automation stack, check why leads aren't converting, diagnose campaign
  attribution problems, find duplicate leads, assess MAP sync health, or review marketing ROI in Salesforce.
  Also trigger when the user says "audit my marketing automation", "check my Pardot/HubSpot/Marketo setup",
  "why is our attribution broken", "our leads aren't being worked", "run the marketing automation section of
  the org audit", "MAP audit", "marketing stack audit", "are our campaigns tracking correctly", or any request
  to evaluate how well marketing tools are performing and syncing into the revenue stack. Always trigger even
  if the user only mentions one MAP — this audit covers the full connected stack.
---

# Marketing Automation Audit

You are running a world-class marketing automation audit as part of the Promise ROI 1 Day Org Audit framework.
Your job: surface every place where marketing automation debt is silently costing revenue, and deliver a
business-impact report a CMO or CRO can act on immediately.

**Core principle:** Salesforce is the universal data layer. Every major MAP — HubSpot, Marketo, Pardot,
ActiveCampaign, Klaviyo — writes its data back into Salesforce objects (Lead, Contact, Campaign,
CampaignMember, Task, and custom fields). This means SOQL is the single most powerful lens for auditing
any MAP combination, regardless of which tools are connected.

---

## Step 1: Establish Salesforce Connection

Invoke the `connect-to-salesforce` skill to confirm the Salesforce MCP is active. If it fails, tell the
user: "This audit requires Salesforce MCP access. Please run `/connect-to-salesforce` first."

---

## Step 2: Discover the MAP Landscape

Before querying, identify which MAPs are connected. Run these quick detection queries:

```
# Pardot / Marketing Cloud
SELECT COUNT() FROM Lead WHERE pi__score__c != null

# HubSpot (check for HubSpot-written fields)
SELECT COUNT() FROM Lead WHERE HubSpot_Lead_Score__c != null
-- also check Contact for hs_ prefixed fields via FieldDefinition query

# Marketo
SELECT COUNT() FROM Lead WHERE mkto_si__Last_Interesting_Moment_Date__c != null

# ActiveCampaign
SELECT COUNT() FROM Lead WHERE AC_Contact_Id__c != null

# Generic: check CampaignMember for all active campaigns
SELECT COUNT() FROM CampaignMember WHERE Campaign.IsActive = true
```

Also check whether any MAP MCPs are available in this session — look for tools named:
`mcp__hubspot__*`, `mcp__marketo__*`, `mcp__klaviyo__*`, `mcp__activecampaign__*`

Record which MAPs are active and which MCP tools (if any) are available. This shapes the rest of the audit.

---

## Step 3: Run Core SOQL Audit Queries

Load `references/soql-queries.md` for the full query set with thresholds and explanations. Run all queries
in sequence and record results. Flag anything that exceeds the threshold.

**Query categories (full details in references file):**
1. Lead ownership gaps
2. Missing required fields
3. Duplicate lead detection
4. Campaign attribution coverage
5. MAP-specific field sync (pi__*, HubSpot__*, mkto__*, etc.)
6. CampaignMember status health
7. Unworked lead aging
8. Email opt-out and deliverability risk
9. Active automation / Flow health for marketing processes
10. Orphaned campaigns with zero members

---

## Step 4: Query Connected MAP MCPs (if available)

If any MAP MCP tools are found in Step 2, run these additional checks:

### HubSpot MCP (`mcp__hubspot__*`)
- Pull contact sync status — contacts in HubSpot not mirrored in Salesforce
- Check active workflow enrollment counts and completion rates
- Flag workflows with > 30% unsubscribe at any step

### Marketo MCP (`mcp__marketo__*`)
- Check lead database sync completeness
- Pull active smart campaign stats
- Flag programs with 0% engagement

### Klaviyo MCP (`mcp__klaviyo__*`)
- Pull top 10 lists by size and their unsubscribe/bounce rates
- Check flows with > 20% unsubscribe rate (deliverability risk)
- Flag suppressed profiles that may still be active in Salesforce

### ActiveCampaign MCP (`mcp__activecampaign__*`)
- Pull automation enrollment and completion rates
- Check tag sync accuracy vs Salesforce custom fields

### No MCP available for a tool?
Query what that tool has written into Salesforce instead. Every major MAP leaves a footprint in custom
fields, CampaignMember records, or Activity history. This is usually sufficient for the audit.

---

## Step 5: Score and Prioritize Findings

Score each finding:
- 🔴 **Critical** — actively losing revenue or creating compliance/deliverability risk (fix this week)
- 🟡 **High** — degrading funnel efficiency or attribution quality (fix this quarter)
- 🟢 **Quick Win** — low effort, immediate measurable ROI (fix in a sprint)

Estimate business impact where possible:
- **Unowned leads:** `count × avg_deal_size × historical_conversion_rate`
- **Attribution gaps:** % of pipeline with no source = budget defense risk
- **Duplicate records:** inflated segment cost + compliance exposure
- **High opt-out rate (>5% on leads):** deliverability degradation risk

---

## Step 6: Generate the Audit Report

Use this exact template. Be specific with numbers — percentages, record counts, dollar estimates.
Write for a CMO/CRO, not an admin. Don't soften bad news.

---

# Marketing Automation Audit Report
**Organization:** [org name]
**Date:** [today]
**MAPs Audited:** [list of connected tools found in Step 2]
**MCP Data Sources:** [Salesforce + any MAP MCPs queried]
**Conducted by:** Promise ROI

---

## Executive Summary

[3–5 sentences. Revenue-impact framing. Example: "Your org processed X leads last quarter across
[channels], but Y% have no record of how they were generated — leaving your CMO unable to defend the
marketing budget. Z leads created in the last 90 days have never been assigned to a rep, representing
an estimated $[range] in unworked pipeline. Three fixes can be implemented this week with no additional
tooling."]

---

## Findings Summary

| # | Finding | MAP/Area | Severity | Est. Impact |
|---|---------|----------|----------|-------------|
| 1 | | | 🔴 Critical | |
| 2 | | | 🟡 High | |
| 3 | | | 🟢 Quick Win | |

---

## Detailed Findings

### Finding [N]: [Name]

**What we found:**
[Specific data with counts and percentages.]

**Why it matters:**
[Business consequence in plain language.]

**How to fix it:**
[Step-by-step. Who, how long, what changes.]

**Effort:** [Low / Medium / High] | **Time to value:** [Days / Weeks / Months]

---

## Quick Wins (implement this week)
- [Specific action → specific outcome]

## Strategic Roadmap
[3–5 bigger improvements with effort estimates and expected ROI]

## What Would Complete This Audit
[List any MAPs without MCP access and what their direct data would add to this picture]

---

## Standards for Every Report

- Every finding has a specific number, not a vague description
- Every finding has a concrete next step
- Write for the business decision-maker, not the Salesforce admin
- If data shows a serious problem, say so — don't hedge
- If a finding can't be fixed cleanly, explain why and what the workaround is
