Skip to content
Skills Library
Data & analytics · Analysis

customer-analytics

/customer-analytics

Turns transaction data into cohort retention, lifetime value, RFM segments, and churn predictions tied to concrete actions. Use when someone asks "what's our customer LTV", "build a cohort retention table", "which customers are about to churn", "how do repeat purchase rates look by cohort", or "who should we target with a win-back offer". Do NOT use for event-level product usage and feature adoption analysis - use product-analytics instead; for defining market segments for positioning and messaging - use segmentation-strategy instead; for designing the interventions that reduce churn once at-r

Repository
skills ↗
Licence
MIT
Last repository change
13.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 13.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Turns transaction data into cohort retention, lifetime value, RFM segments, and churn predictions tied to concrete actions. Use when someone asks "what's our customer LTV", "build a cohort retention table", "which customers are about to churn", "how do repeat purchase rates look by cohort", or "who should we target with a win-back offer". Do NOT use for event-level product usage and feature adoption analysis - use product-analytics instead; for defining market segments for positioning and messaging - use segmentation-strategy instead; for designing the interventions that reduce churn once at-r

Triggers from the description

whatbuild a cohort retention tablewhich customers are about to churnhow do repeat purchase rates look by cohortwho should we target with a win-back offer
Original author description

Turns transaction data into cohort retention, lifetime value, RFM segments, and churn predictions tied to concrete actions. Use when someone asks "what's our customer LTV", "build a cohort retention table", "which customers are about to churn", "how do repeat purchase rates look by cohort", or "who should we target with a win-back offer". Do NOT use for event-level product usage and feature adoption analysis - use product-analytics instead; for defining market segments for positioning and messaging - use segmentation-strategy instead; for designing the interventions that reduce churn once at-r

How it works

  1. Operating procedure
  2. Worked artifact: retention triangle excerpt with reading
  3. Deliverable
  4. Do NOT
  5. Quality bar
Original SKILL.md headings · 112 lines, 1,061 words
SKILL.md preview
---
name: customer-analytics
description: Turns transaction data into cohort retention, lifetime value, RFM segments, and churn predictions tied to concrete actions. Use when someone asks "what's our customer LTV", "build a cohort retention table", "which customers are about to churn", "how do repeat purchase rates look by cohort", or "who should we target with a win-back offer". Do NOT use for event-level product usage and feature adoption analysis - use product-analytics instead; for defining market segments for positioning and messaging - use segmentation-strategy instead; for designing the interventions that reduce churn once at-risk customers are identified - use churn-reduction instead; for step-by-step conversion drop-off - use funnel-analysis instead.
metadata:
  title: "Customer Analytics"
---

# Customer Analytics

Transaction logs already contain the answers to "who stays, who spends, who is about to leave" - the failure mode is computing them wrong: cohort charts that include the current incomplete month, LTV built on revenue instead of margin, and churn models validated on shuffled data that collapse in production. This skill produces cohort, LTV, and churn outputs a finance or lifecycle team can act on directly.

## Operating procedure

Work the steps in order: cohorts establish the retention reality that LTV math depends on, and churn modeling is only worth doing after the churn definition survives the cohort view.

### Step 1: Gather inputs

Collect these first; apply defaults and label guesses as guesses.

1. Transaction table: customer_id, order_date, revenue, and cost or margin if available.
2. Business model: contractual (subscription) or non-contractual (e-commerce/retail). This decides the LTV method in Step 3.
3. Cohort granularity. Default: monthly cohorts when the natural purchase cycle is 2 weeks or longer; weekly cohorts for high-frequency products (food delivery, media). Granularity finer than the purchase cycle produces jagged, unreadable triangles.
4. Gross margin, as a fraction. If unknown, get finance's blended number and mark it a guess - never silently assume 100%.
5. Churn definition. Contractual: subscription cancelled or lapsed. Non-contractual default: no purchase in 90 days, but check it against the observed inter-purchase distribution - set the cutoff near the 90th percentile of gaps between orders, not at a round number chosen by habit.

### Step 2: Build cohorts and retention curves

Group customers by acquisition period and track activity across subsequent periods:

```sql
with first_order as (
  select customer_id,
         date_trunc('month', min(order_date)) as cohort_month
  from orders group by 1
),
activity as (
  select o.customer_id,
         f.cohort_month,
         date_trunc('month', o.order_date) as active_month
  from orders o join first_order f using (customer_id)
)
select cohort_month,
       date_diff('month', cohort_month, active_month) as month_number,
       count(distinct customer_id) as active_customers
from activity group by 1, 2 order by 1, 2;
```

Render as a retention triangle: cohorts on rows, months-since-acquisition on columns, each cell as a percent of cohort size. Always exclude the most recent incomplete period - it reads as a retention cliff that is not there. Retention usually drops fast then flattens; the flattening level is the durable base, and it is the single most important number on the chart. Reference points: e-commerce cohorts commonly flatten with 20-30% of customers making a repeat purchase; healthy subscription monthly logo churn runs under 5% for SMB, under 2% for mid-market, under 1% for enterprise. A cohort curve that never flattens means the product has no retained core - fix that before spending on acquisition.

### Step 3: Lifetime value

Two approaches; label which one each number came from.

1. Historical: sum realized margin per customer to date. Ground truth, but backward-looking.
2. Predictive: model expected future value.

Contractual LTV:

```
LTV = ARPU * gross_margin / churn_rate
```

Use margin, never revenue - revenue LTV flatters the business by the full cost of goods. For non-contractual businesses the churn-rate formula is invalid (there is no observable churn event); use a BG/NBD model for purchase frequency and a Gamma-Gamma model for monetary value:

```python
from lifetimes import BetaGeoFitter, GammaGammaFitter
bgf = BetaGeoFitter(penalizer_coef=0.01)
bgf.fit(rfm['frequency'], rfm['recency'], rfm['T'])
```

Cap the projection horizon at roughly the data you have: with 12 months of history, projecting beyond 24 months is extrapolation - present it as a range, not a number. Report LTV by cohort and by acquisition channel, because the blended average hides the channels that are underwater.

### Step 4: RFM segmentation

Score customers on Recency, Frequency, and Monetary value into quintiles (1-5 each), then group into named, actionable segments: Champions (R5 F4-5), Loyal, At Risk (R1-2 F4-5 - used to buy often, went quiet), and Hibernating (R1-2 F1-2). Each segment must map to one campaign: Champions get referral asks, At Risk gets the win-back offer (pair with win-back-campaign), Hibernating gets suppressed from paid retargeting to save spend.

### Step 5: Churn prediction

Only after the churn definition is fixed. Build features per customer as of a snapshot date:

- Recency, frequency, monetary, tenure.
- Trend features: change in order rate quarter over quarter - trend beats level for early warning.
- Engagement: logins, support tickets, feature usage where available.

Train a gradient boosting classifier. Evaluate with AUC and, more importantly, precision at the top decile - that is the list the retention team will actually work. Calibrate probabilities so "70% churn risk" means 70%. Validate on a held-out future window, never a random shuffle: shuffled validation leaks the future and overstates AUC. Use SHAP to explain drivers so the business can act on causes, not just scores.

## Worked artifact: retention triangle excerpt with reading

```
Cohort     Size    M0     M1     M2     M3     M6
2024-01    2,140   100%   34%    27%    24%    22%
2024-02    2,380   100%   31%    25%    23%    21%
2024-03    2,910   100%   26%    19%    16%    -
Reading: Jan and Feb flatten at 21-22% - a durable base. The March cohort is
tracking 5-7 points below at every age: acquisition mix shifted (paid social
spike). LTV for March-acquired customers will run ~25% below plan; flag the
channel before scaling it further.
```

## Deliverable

Produce a customer analytics pack containing: the retention triangle with the flattening level called out, LTV by cohort and channel (method labeled historical or predictive, margin-based), RFM segment sizes with one mapped action each, and a scored churn list with top-decile precision and the top three SHAP drivers.

## Do NOT

- Do not include the current incomplete period in cohort charts; it fabricates a retention cliff.
- Do not compute LTV on revenue; use contribution margin.
- Do not apply the ARPU/churn formula to non-contractual businesses; use BG/NBD + Gamma-Gamma.
- Do not validate a churn model with a random split; use a held-out future window or the production model will disappoint.
- Do not ship a metric without an owner and an action - "who do we contact, with what offer" is part of the analysis, not a follow-up.

## Quality bar

- Cohort definition, churn definition, and margin assumption are written on the artifact.
- Every LTV number states its method and horizon; projections beyond ~2x the observed history are presented as ranges.
- Churn model reports AUC and top-decile precision on a future window, with calibrated probabilities.
- Each RFM segment has exactly one attached action and owner.

Versions

RepositoryScoreLicence
This page · SkillMedev/skills100MIT
varunk130/ai-gtm-skill-library100MIT

Database snapshot: 13.11.2026 · package version fea2f8f3b0c5 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 1 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100customer-segmentation
    Segments customers using RFM scoring, behavioral clustering, or needs-based research, validates the segments, and writes actionable segment profiles. Use when targeting campaigns, designing lifecycle programs, prioritizing markets or personas, or explaining differences in value…
  • 100customer-segmentation-rfm
    Scores every buyer by RFM from Shopify, WooCommerce, Magento, BigQuery or CSV orders, names segments with revenue shares, and sets each segment's offer and email frequency. Use when asked for RFM analysis, customer segments, email list segmentation or who the best buyers are.
  • 100cohort-analysis
    Perform cohort analysis on user engagement data — retention curves, feature adoption trends, and segment-level insights. Use when analyzing user retention by cohort, studying feature adoption over time, investigating churn patterns, or identifying engagement trends.
  • 100data-cohort-analysis
    Conduct cohort analysis to track user behavior over time, build retention matrices, and compare cohort performance. Use this skill when the user needs to measure retention, understand how user behavior changes after acquisition, compare product versions' impact on engagement, or…
  • 95cohort-analysis
    Perform cohort analysis on user engagement data — retention curves, feature adoption trends, and segment-level insights. Use when analyzing user retention by cohort, studying feature adoption over time, investigating churn patterns, or identifying engagement trends.
  • 90cohort-analysis
    Time-based cohort analysis with retention and behaviour tracking. Activate when you need to measure how groups of users/customers behave over time — retention rates, revenue by cohort, or feature adoption curves.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.