Cohort retention, top-customer share and RFM (cohort_table.py, pareto_rfm.py) for repeat and best customers, counting customers and orders, not lines. Not for k-means clusters; use modelling.
Ships in data-analytics. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Count distinct customers, not transaction lines, divide Table Across, and never hide loss-making accounts. Section 1 applies to both workflows; section 2 builds cohort retention, section 3 Pareto concentration and RFM segments.
gateway(op="call", capability="data", args={op: "stats", path: "<file>"}) first (op: "stats" for types, missing customer IDs as nulls plus sentinels, distinct customers and orders, and earliest/latest dates) and name the customer ID (never a display name alone when names collide), order ID, date, sales and profit columns. Pass --customer-col, --order-col, --date-col, --sales-col and --profit-col when they differ from defaults.out/ (count dropped null-ID rows, compute revenue as quantity times unit price, state the cancellation rule) and report what changed. Never edit data/; write all outputs under out/.COUNTD(Customer ID) (nunique()) and Frequency as distinct orders (COUNTD(Order ID)), never lines. First purchase is fixed per customer: Tableau {FIXED [Customer ID] : MIN([Order Date])} -> df.groupby("Customer ID")["Order Date"].transform("min").uv run python <base_dir>/scripts/cohort_table.py data/orders.csv --freq year --plot out/cohort_retention.png
--freq is year, quarter or month. Verify all three invariants before interpreting:
(cohort c, age k) divides active customers in (c, k) by cohort size at (c, 0) (COUNTD([Customer ID]) / LOOKUP(COUNTD([Customer ID]), FIRST()) Table Across). Age 0 must be 100.00% for every cohort; columns summing to 100% indicate Table Down.Account for left censoring (earliest cohort includes pre-existing buyers; report its share of all customers) and flag rising late-age retention (common in fixed-pool B2B catalogs or synthetic data; not zero churn). Close with cohort size, period-1 retention % and one business caveat.
Recency is days from last order to --as-of (default: day after max date so latest buyer has Recency 1; print the date used).
uv run python <base_dir>/scripts/pareto_rfm.py data/orders.csv \
--pareto-plot out/pareto_profit_sales.png --rfm-plot out/rfm_segments.png --out-csv out/customer_rfm.csv
Pareto assumes non-negative values. Sales rises monotonically from 0% to 100%; profit does not when loss-making customers exist (cumulative profit overshoots 100% of net profit, peaks where profit turns negative, then falls back to 100%). Report side by side: (1) customers and % reaching 80% of net profit, (2) top 20% customers' share of net profit vs sales, (3) peak cumulative profit % and profitable account count at the peak, and (4) loss-making customer count and combined loss.
RFM uses rank-based 1-5 quantiles (higher R = more recent, F = more distinct orders, M = higher sales). Show per segment: customer count, median R/F/Sales, total Sales, total Profit and loss-making count. Flag any high-sales segment carrying heavy losses (e.g. from discounting) and propose one retention or margin action grounded in the table.
What SKILL.md sets; muted values are Claude Code's defaults
/data-analytics:customer-analyticsfrom data-analytics
npx claudepluginhub panstudio/pancode --plugin data-analytics9 skills in this plugin
/analysis-projectStart a pinned uv analysis project or check one is ready (check_workspace.py), then lay out its notebook and prompt appendix. Read-only check; syncs only with the user's go. Not for the analysis itself; use pandas-descriptive./chartsMake and check bar, line, histogram or scatter charts (plotly_chart.py, matplotlib): backing table printed, sorted, labelled, bars from zero. Not for dashboards; use streamlit-app./excelTurn spreadsheet work into Python: VLOOKUP, SUMIFS and pivot tables to pandas, .xlsx read and write, with merged-header, text-number and total traps. Not for Tableau exports; use tableau.Other plugins' skills for the same job