From mixshift-ai
This skill should be used when the user asks to "run daily health check", "check account status", "how is the account", or needs comprehensive daily exception-based analysis of advertising account performance across campaign types, objectives, and item groups. Uses percentile-based confidence intervals to detect spend and ACOS anomalies requiring management attention.
How this skill is triggered — by the user, by Claude, or both
Slash command
/mixshift-ai:daily-health-checkThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
These rules supersede any other instruction. Violating them produces inconsistent output across runs.
These rules supersede any other instruction. Violating them produces inconsistent output across runs.
references/ folder during execution. Brand context comes exclusively from the context snapshot (or context.yaml fallback) and narrative.md.Complete this checklist before Step 1. Stop and surface the failure if any item cannot be checked off. Do not proceed with a partial preflight.
PREFLIGHT — daily-health-check — <brand> — <date>
[ ] context snapshot loaded: ~/.mixshift/clients/<brand>/context.yaml (via `mixshift brand validate <brand>`)
(fallback: ~/.mixshift/clients/<brand>/context.yaml — extract required fields manually)
[ ] Required fields present and non-null:
accounts[*].seller_id, accounts[*].account_type
management.primary_metric, management.acos_target_pct, management.attribution_window_days
goals.monthly_total_sales_target, goals.tacos_goal_pct
posture.stance, posture.multiplier
sub_brands, campaign_structure.naming_pattern
[ ] Data artifact present: ~/.mixshift/clients/<brand>/runs/daily-health-check/<date>/data.md (or data.json)
[ ] DHC-04 (anomaly_detection_settings) present in artifact with non-null thresholds
*** HARD GATE: if absent or thresholds null, STOP. Cannot compute CI. ***
[ ] Prior-run sidecar loaded: ~/.mixshift/clients/<brand>/runs/daily-health-check/<latest>.json
(if absent: continue — no baseline yet; note in report header)
[ ] No active escalation conditions:
- context stale > 7 days → surface warning, do not block
- verdict regresses RED without structural_events explanation → surface before delivering
Run this skill to get a comprehensive daily exception-based analysis of advertising account performance. The output tells the account manager whether action is required or they can move on with their day. "No intervention required" is a valid, complete outcome.
Before executing, you need:
~/.mixshift/clients/<brand-slug>/:
context.yaml — mechanical truth (SellerIDs, account_type, ACOS/TACOS targets, capture-rate calibration, structural events, posture, campaign_structure, sub-brands, goals)narrative.md — interpretive prose (positioning, management history, per-skill guidance)corpora/ — ASIN lists if neededmixshift brand validate <brand-slug> before any skill run.context.yaml — never hardcodeIf context.yaml is missing or fails validation, run the account-cold-start skill first.
Read these sources simultaneously:
~/.mixshift/clients/<brand-slug>/context.yaml (validated via mixshift brand validate ) — compact context snapshot pre-extracted by the pre-fetch script. Contains only the fields this skill consumes: seller_id, account_type, primary_metric, acos_target_pct, attribution_window_days, capture_rate_calibration, goals, structural_events, posture.stance, posture.multiplier, sub_brands, campaign_structure.naming_pattern, delivery.report_url, delivery.archive_dir. If absent, fall back to reading ~/.mixshift/clients/<brand-slug>/context.yaml directly and extracting those fields.~/.mixshift/clients/<brand-slug>/runs/daily-health-check/ (most recent <date>-<run-id>.json) — prior run sidecar (~65 lines). If present, use for drift context and prior verdict. If absent, skip — no baseline yet.~/.mixshift/clients/<brand-slug>/narrative.md — for prose context only (interpretation rules, per-skill guidance). Do not extract numbers from this file.Fail closed: if the context snapshot is absent AND context.yaml is absent or missing account_type/acos_target_pct, stop and direct user to cold-start. Do not infer from prose.
Timing: Do not run before 8:00 AM in the account's local timezone. For PST-based cron: 6:30 AM PST covers most US time zones.
History tier check: Before running CI-based anomaly detection, verify you have:
Null handling rules: Distinguish three states:
$0 or 0 orders.-- with a data lag note.Determine the account type from brand context:
business_reports_dpst_date for Total Sales and TACOS windows. SC has a 1-day data lag.vendor_sales_manufacturing_asin for Ordered Revenue. VC has a 2-day data lag.Do not mix sources or discover the path mid-run. If account type is missing, stop and update brand context first.
Do NOT read SQL library files. Do NOT execute queries. All query results are pre-computed before this skill runs.
Read the data artifact — prefer the .md file (pre-formatted markdown tables, no parsing overhead):
~/.mixshift/clients/<brand-slug>/runs/daily-health-check/<run_date>/data.md
Fallback to .data.json only if the .md file is absent.
This file contains pre-executed results for all queries, keyed by query ID:
DHC-01 — Campaign-level metrics (T-1, T-7, T-30, MTD, TACOS window): spend, adsales, orders, acos across all time windowsDHC-02 — Total Sales / SC accounts (business_reports_dpst_date): total_sales for T-1, T-7, T-30, MTD windowsDHC-03 — Ordered Revenue / VC accounts (vendor_sales_manufacturing_asin): ordered_revenue for T-1, T-7, T-30, MTD windowsDHC-04 — Anomaly Detection Settings: UpperSensitivityLimit, LowerSensitivityLimit by SellerIDDHC-05 — T-30 Daily Actuals (anomaly_detection_MV): daily spend, adsales, acos, total_sales, tacos for CI computationDHC-06 — Campaign Type Performance (T-1, T-7, T-30): campaign_type, spend, adsales, acosDHC-07 — Objective Performance (T-1, T-7, T-30): objective, spend, adsales, acosDHC-08 — Item Group Performance (T-1, T-7, T-30): item_group, spend, adsales, acosDHC-09 — Brand Performance (conditional — present only when sub-brand segmentation is active): brand_label, spend, adsales, acosDHC-10 — Data lag check (campaign-level vs. keyword-level spend comparison): campaign_spend_t1, keyword_spend_t1DHC-11 — Keyword-level spend comparison supplemental dataDHC-12 — Additional anomaly detection contextLIB-PT-01 — Price test query (conditional — present only when structural_events includes an active price_test): asin, total_sales, units for tested vs. untested sub-linesAll queries share the join key: (SellerID, date) at account level; dimensional queries use (SellerID, CampaignName/Objective/ItemGroup, date) as appropriate.
If the artifact is missing: Run prefetch now — do not stop and ask the user:
mixshift prefetch --brand <brand-slug> --skill daily-health-check --date <YYYY-MM-DD>
Use brand-slug derived from the brand context path and today's date as run_date. Wait for completion, then read the artifact and continue.
Critical: If DHC-04 (Anomaly Detection Settings) is absent or thresholds are null, stop immediately. Log the error and do not proceed. You cannot compute CI without these thresholds.
Join pre-fetched query results on the shared key to produce one unified record per row. DHC-01 forms the base campaign-level record; DHC-04/DHC-05 provide CI thresholds and T-30 daily actuals; DHC-06/DHC-07/DHC-08/DHC-09 provide dimensional breakdowns. DHC-02 or DHC-03 (account type determines which) provides total sales for TACOS computation.
From Batch D daily actuals:
Never hardcode CI thresholds. Always read them dynamically from anomaly_detection_settings.
From Batch A (campaignmetric):
spend_t1 = T-1 total spendspend_t7_avg = T-7 total spend / 7spend_t30_avg = T-30 total spend / 30adsales_t1 = T-1 ad salesacos_t1 = spend_t1 / adsales_t1 × 100acos_t7 = spend_t7_total / adsales_t7_total × 100acos_t30 = spend_t30_total / adsales_t30_total × 100acos_mtd = spend_mtd / adsales_mtd × 100From Batch B (Total Sales):
total_sales_t1 = T-1 total sales (T-2 date for SC accounts; latest available for VC)total_sales_t7_avg = T-7 total sales / 7 (or active days, see pacing rule below)total_sales_t30_avg = T-30 total sales / 30total_sales_mtd = MTD total salesTACOS (matched windows, both lagged to same date):
tacos_t1 = spend_t2 / total_sales_t1 × 100 [both sides are T-2 date for SC]tacos_t7 = spend_t7_window / total_sales_t7_window × 100tacos_t30 = spend_t30_window / total_sales_t30_window × 100tacos_mtd = spend_mtd_window / total_sales_mtd_window × 100Pacing projection (universal rule for SC and VC):
days_remaining = (month_end_day - last_available_data_date_day) — NOT (month_end_day - run_date_day)pacing_total_sales = total_sales_mtd + (total_sales_t7_avg × days_remaining)pacing_ad_sales = adsales_mtd + (adsales_t7_avg × days_remaining)pacing_spend = spend_mtd + (spend_t7_avg × days_remaining)pacing_acos = pacing_spend / pacing_ad_sales × 100T-7 Active Days Correction (for lag accounts):
t7_avg = t7_total / active_days (not t7_total / 7)VC-Specific: Adjusted ACOS (when attribution calibration exists in brand context):
Selecting the capture rate (cold-start v2.3.1+):
capture_rate_calibration.daily_settlement_curve.by_campaign_type.sponsoredProducts.settled_pct_at_1day (decimal of 100). This is the per-campaign-type signal produced by cold-start v2.3.1; for example brand this is 82.7 (0.827 as a fraction). When present and non-null, use it as capture_rate instead of the legacy account-blended number.capture_rate_calibration.daily_settlement_curve.dow_offset_pts[<dow_of_t1_read>] (e.g. friday: 0.32 means Friday clicks settle 0.32 ACOS-pts slower than the weekly mean). Apply the offset additively to improvement_pts_1_to_14 if you're computing the additive form (see below). Skip the DOW step if the offset map is absent or stability_score == "low" (the offsets aren't reliable enough to act on).capture_rate_calibration.capture_rate_pct / 100 (account-blended single number — example brand legacy: 80.93).Computing Adj. ACOS:
capture_rate.
adjusted_adsales_t1 = adsales_t1 / capture_rateadj_acos_t1 = spend_t1 / adjusted_adsales_t1 × 100improvement_pts_1_to_14):
effective_improvement_pts = improvement_pts_1_to_14 + dow_offset_pts[<dow>] (DOW term defaults to 0 if curve absent or stability=low)adj_acos_t1 ≈ acos_t1 - effective_improvement_ptsadj_acos_t30 = spend_t30 / (settled_sales + open_sales / capture_rate) × 100Caveat on the per-CT curve: the curve gives reliable numbers only for sponsoredProducts because SB and SD have insufficient 1-day attribution volume on most accounts. DHC operates at the account level; using the SP curve as the account-level capture_rate is a strict improvement for SP-dominant brands (example brand: SP is 91% of spend) but slightly under-corrects for the small SB/SD slice. For accounts with materially balanced SP/SB/SD mix, this is worth revisiting; for now, the SP curve is the canonical fresh-day input.
Spend CI Breach:
ACOS CI Breach:
TACOS vs. Target:
Pacing vs. Target:
pacing_gap_pct = (pacing_total_sales - monthly_target) / monthly_target × 100Before making any intervention call, cross-reference brand context for:
If a structural event explains a breach, keep the status flag but label it explicitly in narrative. A promo-driven spend breach during Easter sale is YELLOW, not RED, and must be named as such.
Build the core summary table with these columns:
| Metric | T-1 | T-7 (avg) | T-30 (avg) | MTD | Pacing | Lower CI | Upper CI |
|---|---|---|---|---|---|---|---|
| Spend | $XXX | $XXX | $XXX | $X,XXX | $X,XXX | $XXX | $XXX |
| Ad Sales | $XXX | $XXX | $XXX | $X,XXX | $X,XXX | $XXX | $XXX |
| ACOS | XX.X% | XX.X% | XX.X% | XX.X% | XX.X% | XX.X% | XX.X% |
| Total Sales* | $XXX | $XXX | $XXX | $X,XXX | $X,XXX | $XXX | $XXX |
| TACOS* | XX.X% | XX.X%† | XX.X%† | XX.X%† | XX.X% | XX.X% | XX.X% |
Formatting rules:
VC accounts: Include Ordered Revenue pacing row (substitute for Total Sales pacing). Include a separate "Reference-only TACOS pacing" line labeled explicitly as reference-only if applicable.
For each dimension (Campaign Type, Objective, Item Group; Brand if applicable), build a table with these columns grouped by time window:
Column structure (locked schema, identical across all dimensional tables):
| Dimension | T-1 Spend | T-1 Ad Sales | T-1 ACOS | T-7 Avg Spend | T-7 Avg Sales | T-7 ACOS | T-30 Avg Spend | T-30 Avg Sales | T-30 ACOS |
|---|---|---|---|---|---|---|---|---|---|
| [Name] | $ | $ | % | $ | $ | % | $ | $ | % |
Grouped column headers: Use distinct background colors for T-1 / T-7 Avg / T-30 Avg bands to visually separate time windows.
Always include: A Total row (sum of spend/sales, blended ACOS).
Never include: T-1 Orders column, Rate labels, or "vs CI" inline annotations. CI context belongs in narrative only.
Begin output immediately. Do not restate these instructions, summarize what you are about to do, or ask clarifying questions.
Lead with account-level verdict and posture. Reference specific metric rows from the summary table when anomalies are present.
State both the campaign-level and keyword-level T-1 figures and confirm their parity or flag the gap.
Write in this exact structure (validated pattern):
Example structure:
No intervention required.
Account is running lean and intentional — efficiency posture is holding where it should.
Total Sales pacing to $26,400 for March, $71,200 for Q1, on track against the $72K target.
TACOS pacing to 32.1% for the month, 33.8% for the quarter, inside the 35% target.
Recommendation: Hold current posture. No bid or budget changes warranted today.
VC accounts: When no quarterly target exists in brand context, omit the quarterly projection sentence entirely. Monthly ACOS vs. target is sufficient.
Only include if brand context documents sub-brand segmentation. Use campaign-side brand labels for ad metrics. Follow the table with narrative connecting brand findings to account-level pacing or goal proximity.
Table first, then narrative. Lead with plain-language verdict ("This type is clean" / "Weak performance here requires attention"). For chronic inefficiency (100%+ ACOS, zero conversions): surface an explicit recommendation ("Consider pause or restructure"), not just a description.
Same structure as Campaign Type. When per-objective CI distributions exist (stored in SQL-REFERENCE.md), use those thresholds instead of account-level CI.
Same structure. When brand context documents a price test on any item group, add a sub-section within this table:
Price Test Sub-Section:
3–4 bullets, one sentence each. Recap of callouts made above; no new analysis. This is a decision queue, not an analysis section. Format: name the thing, state the watch condition or action.
Build a single HTML page with:
Use consistent CSS styling with:
Before delivering output:
--)Compose the report as markdown (default) or HTML (if the user explicitly requests HTML).
Save the report to the brand's local reports directory using the Write tool:
~/.mixshift/clients/<brand-slug>/reports/<YYYY-MM-DD>/health-check.md
(or .html if HTML was requested.) If context.yaml::delivery.reports_local_dir is set, save there instead — honor that override.
Drift comparison against the prior sidecar will be handled by mixshift sidecar compare (not yet implemented). For now, you can manually inspect prior sidecars under ~/.mixshift/clients/<brand-slug>/runs/daily-health-check/ to spot config / verdict drift before delivering.
After delivery, write a structured JSON sidecar capturing this run's inputs and headline outputs. Sidecars live at ~/.mixshift/clients/<brand-slug>/runs/daily-health-check/<data-date>-<run-id>.json. Schema source of truth: plugins/mixshift-ai/shared/run-sidecar.schema.yaml.
Compose the input JSON (write to a temp file, then invoke the harness). Pick DHC-02 for SC OR DHC-03 for VC in sql_calls — never both. DHC-09 (sub-brand) is conditional on sub_brands segmentation. LIB-PT-01 is conditional on an active price_test in structural_events:
// /tmp/dhc-sidecar-input.json
{
"skill": "daily-health-check",
"skill_version": "0.2.0",
"brand_slug": "<brand-slug>",
"run_kind": "per_account",
"data_date": "YYYY-MM-DD", // T-1 (yesterday)
"verdict": "GREEN|YELLOW|RED|OBSERVATIONAL",
"history_tier": "provisional|tier-14|tier-30",
"context_snapshot": {
"account_type": "SC|VC",
"seller_id": 0,
"primary_metric": "ACOS|TACOS",
"acos_target_pct": 20,
"attribution_window_days": 14,
"tacos_goal_pct": 5,
"posture_stance": "scale|efficiency|defend|clear_bleed",
"posture_multiplier": 0
},
"headline_metrics": {
"spend_t1": 0,
"spend_t7_avg": 0,
"spend_t30_avg": 0,
"adsales_t1": 0,
"acos_t1": 0,
"acos_t30": 0,
"tacos_t30": 0,
"pacing_total_sales": 0,
"pacing_acos": 0,
"pacing_gap_pct": 0,
"upper_ci_spend": 0,
"lower_ci_spend": 0
},
"sql_calls": [
{"id": "DHC-01", "params": {"seller_id": 0, "yesterday": "YYYY-MM-DD", "month_start": "YYYY-MM-01"}},
// Pick ONE: DHC-02 (SC) or DHC-03 (VC) -- never both
{"id": "DHC-02", "params": {"seller_id": 0, "yesterday": "YYYY-MM-DD"}},
{"id": "DHC-04", "params": {"seller_id": 0}},
{"id": "DHC-05", "params": {"seller_id": 0, "lookback_days": 30}},
{"id": "DHC-06", "params": {"seller_id": 0, "yesterday": "YYYY-MM-DD"}},
{"id": "DHC-07", "params": {"seller_id": 0, "yesterday": "YYYY-MM-DD"}},
{"id": "DHC-08", "params": {"seller_id": 0, "yesterday": "YYYY-MM-DD"}},
{"id": "DHC-10", "params": {"seller_id": 0, "yesterday": "YYYY-MM-DD"}},
{"id": "DHC-11", "params": {"seller_id": 0}},
{"id": "DHC-12", "params": {"seller_id": 0}}
// Optional: DHC-09 when sub_brands segmentation is active
// Optional: LIB-PT-01 when structural_events includes an active price_test
],
"artifacts": {
"report_html_path": "<path-to-rendered-output>"
}
}
Then write it:
mixshift sidecar write --input-file /tmp/dhc-sidecar-input.json
Verdict rule: GREEN = no intervention required. YELLOW = approaching threshold or structural-event-explained anomaly. RED = intervention required. OBSERVATIONAL = history tier <14 days; no claims made.
mixshift sidecar compare will surface drift against the prior run once implemented; until then, sidecars accumulate read-only for retrospective inspection.
Never assert a causal explanation without data that directly supports it. This is IP integrity — MixShift's patent claims attribution via deterministic functional relationships, not probabilistic inference.
If you cannot point to specific query data supporting a causal claim, describe the pattern and stop.
All SQL queries are pre-fetched before skill execution. Do not read the references/ folder during skill execution.
Provides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.
npx claudepluginhub mixshift/mx-claude-plugin --plugin mixshift-ai