$npx -y skills add indranilbanerjee/digital-marketing-pro --skill anomaly-scanDetect marketing anomalies. Use when: traffic drops, cost spikes, conversion changes, deliverability issues, budget overruns.
| 1 | # /digital-marketing-pro:anomaly-scan |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | Scan all connected marketing platforms for anomalies — statistically significant deviations from established baselines that could indicate problems (traffic drops, CPA spikes, deliverability collapse, budget overruns) or opportunities (viral content, conversion rate improvements, unexpected channel growth). Designed to catch issues early, before they compound into costly problems, and to surface wins worth amplifying. |
| 6 | |
| 7 | ## Input Required |
| 8 | |
| 9 | The user must provide (or will be prompted for): |
| 10 | |
| 11 | - **Sensitivity level**: Strict (flags deviations >1.5 standard deviations from baseline), normal (>2 std dev), |
| 12 | or relaxed (>3 std dev). Defaults to normal |
| 13 | - **Time period**: The window to scan for anomalies — today, last 3 days, last 7 days, last 30 days, or custom range. |
| 14 | Defaults to last 7 days |
| 15 | - **Platforms** (optional): Specific platforms to focus the scan on (e.g., "Google Ads and Meta only"). |
| 16 | If omitted, all connected platforms are scanned |
| 17 | - **Metrics focus** (optional): Specific metrics to prioritize (e.g., "CPA and conversion rate only"). |
| 18 | If omitted, all available metrics are evaluated |
| 19 | - **Baseline period** (optional): Custom baseline for comparison instead of the default. |
| 20 | Defaults to the rolling 30-day average maintained by performance-monitor.py |
| 21 | - **Exclude known events** (optional): List of known events to filter out (e.g., "Black Friday sale", |
| 22 | "site migration on Jan 15") so expected deviations are not flagged as anomalies |
| 23 | |
| 24 | ## Process |
| 25 | |
| 26 | 1. **Load brand context**: Read `~/.claude-marketing/brands/_active-brand.json` for the active slug, then load `~/.claude-marketing/brands/{slug}/profile.json`. Apply brand voice, compliance rules for target markets (`skills/context-engine/compliance-rules.md`), and industry context. Also check for guidelines at `~/.claude-marketing/brands/{slug}/guidelines/_manifest.json` — if present, load restrictions. Check for agency SOPs at `~/.claude-marketing/sops/`. If no brand exists, ask: "Set up a brand first (/digital-marketing-pro:brand-setup)?" — or proceed with defaults. |
| 27 | 2. **Pull current metrics from all connected MCPs**: Query each connected analytics platform |
| 28 | (google-analytics, google-ads, meta-marketing, linkedin-marketing, tiktok-ads, mailchimp, stripe, mixpanel, |
| 29 | amplitude, shopify, etc.) for all available metrics across the specified scan period. Include traffic, spend, |
| 30 | conversions, CPA, ROAS, engagement rates, deliverability, and revenue metrics. |
| 31 | 3. **Load historical baselines**: Execute `python "${CLAUDE_PLUGIN_ROOT}/scripts/performance-monitor.py" --brand {slug} --action get-baseline` |
| 32 | to retrieve rolling averages, standard deviations, and expected ranges for each metric. If no baseline exists yet, |
| 33 | use the comparison period data to establish a temporary baseline and note this in the output. |
| 34 | 4. **Run anomaly detection**: Execute `python "${CLAUDE_PLUGIN_ROOT}/scripts/performance-monitor.py" --brand {slug} --action detect-anomalies --data '{...current-period metrics...}'` |
| 35 | to flag metrics that fall outside the expected ranges computed from the stored baseline (mean ± standard deviations). |
| 36 | Apply day-of-week and seasonality adjustments where historical data supports it. |
| 37 | 5. **Cross-reference with recent executions**: Check execution history via |
| 38 | `python "${CLAUDE_PLUGIN_ROOT}/scripts/execution-tracker.py" --brand {slug} --action get-history --limit 14` |
| 39 | to correlate anomalies with recent changes — did a campaign launch, pause, budget shift, creative swap, |
| 40 | landing page change, or audience expansion precede the anomaly? |
| 41 | 6. **Cross-reference with known factors**: Check for known platform outages, algorithm updates |
| 42 | (Google core updates, Meta policy changes), industry events, seasonal patterns, and any user-provided |
| 43 | known events that could explain the deviation. |
| 44 | 7. **Classify anomalies by severity**: Critical (revenue-impacting, requires immediate action — tracking broken, |
| 45 | CPA 3x+ baseline, budget overspend >20%, deliverability below 80%), Warning (significant deviations worth |
| 46 | investigating within 24 hours — traffic down 30%+, engagement halved, CTR dropped 40%+), or Info (notable |
| 47 | but non-urgent — gradual trend shifts, minor CPA increases, seasonal patterns emerging). |
| 48 | 8. **Determine probable causes**: For each anomaly, analyze root causes using the diagnostic framework from |
| 49 | `skills/analytics-insights/anomaly-diagnosis.md`. Categorize as data/tracking issue, external factor |
| 50 | (algorithm update, competitor action, seasonal shift), internal change (campaign modification, landing page |
| 51 | update), or platform change (policy update, feature deprecation, auction dynamics shift). |
| 52 | 9. **Save critical anomalies as insights**: For critical and warning-level anomalies, persist via |
| 53 | `python "${CLAUDE_PLUGIN_ROOT}/scripts/cam |