Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Perform RFM (Recency, Frequency, Monetary) customer segmentation from transaction data. Use this skill when the user needs to segment customers by purchase behavior, identify high-value buyers, design retention campaigns, or prioritize marketing spend by customer value — even if they say 'who are our best customers', 'which customers are at risk of churning', or 'how do we target our marketing'.
.claude/skills/asgard-ai-platform-ecom-rfm-analysis/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 2% | 0% |
| case-02 | ✗→✓ | ▲ Improved | -27% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 6% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 26% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 56% | 0% |
RFM segments customers based on three behavioral dimensions: Recency (when they last bought), Frequency (how often they buy), and Monetary (how much they spend). It converts raw transaction data into actionable customer segments for targeted marketing.
IRON LAW: RFM Uses ACTUAL Behavior, Not Demographics
RFM is behavioral segmentation — it classifies by what customers DO,
not who they ARE. A 25-year-old and a 65-year-old in the same RFM segment
should receive the same treatment. Never mix RFM with demographic
assumptions.| Dimension | What It Measures | How to Calculate | |-----------|-----------------|-----------------| | Recency (R) | Days since last purchase | Today - Last purchase date | | Frequency (F) | Number of purchases in period | Count of distinct transactions | | Monetary (M) | Total spend in period | Sum of transaction values |
Note: For Recency, LOWER days = HIGHER score (more recent is better).
| Segment | RFM Pattern | Description | Strategy | |---------|------------|-------------|----------| | Champions | R5, F5, M5 | Best customers, recent, frequent, high-value | Reward, loyalty program, early access | | Loyal | R4-5, F4-5, M3-5 | Consistent buyers | Upsell, cross-sell, referral program | | Potential Loyalists | R4-5, F2-3, M2-3 | Recent, moderate frequency | Nurture to increase frequency | | At Risk | R2-3, F3-5, M3-5 | Were frequent/high-value, not buying recently | Win-back campaign, special offers | | Hibernating | R1-2, F1-2, M1-2 | Long dormant, low value | Low-cost reactivation or let go | | New Customers | R5, F1, M1-2 | Just made first purchase | Onboarding, second-purchase incentive |
Phase 1: Data Preparation
Phase 2: Calculate RFM Scores
Phase 3: Segment and Act
markdown# RFM Analysis: {Business} ## Data Summary - Customers analyzed: {N} - Analysis window: {start} to {end} - Transactions: {N} ## Segment Distribution | Segment | Count | % | Avg R (days) | Avg F | Avg M | |---------|-------|---|-------------|-------|-------| | Champions | {N} | {%} | {days} | {count} | ${X} | | At Risk | {N} | {%} | ... | ... | ... | | ... | ... | ... | ... | ... | ... | ## Key Findings - Top 20% customers contribute {X%} of revenue - {N} customers at risk of churning (were high-value, now dormant) - {N} new customers need second-purchase nurturing ## Recommended Actions | Segment | Action | Channel | Expected Impact | |---------|--------|---------|----------------| | Champions | {loyalty reward} | {email/app} | Increase AOV by X% | | At Risk | {win-back offer} | {email/SMS} | Recover X% of dormant revenue |
| Script | Description | Usage | |--------|-------------|-------| | scripts/rfm_score.py | Score customers on R/F/M and assign segment labels | python scripts/rfm_score.py --help |
Run python scripts/rfm_score.py --verify to execute built-in sanity tests.
references/rfm-implementation.mdreferences/clv-prediction.md| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 28,103 | 30,699 | +9% | 1 | 1 | 0% | 5,697 | 5,820 | +2% | 0 | 0 | — |
case-02 | fail→pass | 26,969 | 14,052 | -48% | 1 | 1 | 0% | 5,558 | 4,069 | -27% | 0 | 0 | — |
case-03 | fail→fail | 5,503 | 25,952 | +372% | 1 | 1 | 0% | 1,009 | 6,374 | +532% | 0 | 0 | — |
case-04 | fail→pass | 16,638 | 8,420 | -49% | 1 | 1 | 0% | 2,643 | 2,799 | +6% | 0 | 0 | — |
case-05 | fail→fail | 6,486 | 13,884 | +114% | 1 | 1 | 0% | 1,015 | 3,924 | +287% | 0 | 0 | — |
case-06 | fail→pass | 24,062 | 17,822 | -26% | 1 | 1 | 0% | 3,409 | 4,304 | +26% | 0 | 0 | — |
case-07 | pass→pass | 3,598 | 2,723 | -24% | 1 | 1 | 0% | 655 | 1,682 | +157% | 0 | 0 | — |
case-08 | pass→pass | 3,763 | 2,266 | -40% | 1 | 1 | 0% | 613 | 1,560 | +154% | 0 | 0 | — |
case-09 | pass→pass | 8,056 | 4,068 | -50% | 1 | 1 | 0% | 1,509 | 1,937 | +28% | 0 | 0 | — |
case-10 | pass→pass | 10,516 | 6,398 | -39% | 1 | 1 | 0% | 1,463 | 2,348 | +60% | 0 | 0 | — |
case-11 | fail→pass | 12,190 | 9,547 | -22% | 1 | 1 | 0% | 1,790 | 2,794 | +56% | 0 | 0 | — |
case-12 | fail→pass | 12,459 | 12,013 | -4% | 1 | 1 | 0% | 1,901 | 3,254 | +71% | 0 | 0 | — |
case-13 | pass→pass | 11,875 | 14,053 | +18% | 1 | 1 | 0% | 2,238 | 3,363 | +50% | 0 | 0 | — |
case-14 | pass→pass | 15,793 | 10,837 | -31% | 1 | 1 | 0% | 2,367 | 2,906 | +23% | 0 | 0 | — |
case-15 | pass→pass | 11,233 | 8,133 | -28% | 1 | 1 | 0% | 1,685 | 2,657 | +58% | 0 | 0 | — |
case-16 | pass→pass | 14,482 | 14,789 | +2% | 1 | 1 | 0% | 2,185 | 3,691 | +69% | 0 | 0 | — |
case-17 | fail→pass | 8,197 | 3,965 | -52% | 1 | 1 | 0% | 1,477 | 1,939 | +31% | 0 | 0 | — |
case-18 | fail→pass | 7,580 | 3,391 | -55% | 1 | 1 | 0% | 1,314 | 1,908 | +45% | 0 | 0 | — |
case-19 | pass→pass | 6,802 | 2,272 | -67% | 1 | 1 | 0% | 1,270 | 1,682 | +32% | 0 | 0 | — |
case-20 | pass→pass | 14,864 | 7,484 | -50% | 1 | 1 | 0% | 2,068 | 2,548 | +23% | 0 | 0 | — |
case-21 | pass→pass | 11,102 | 5,244 | -53% | 1 | 1 | 0% | 1,769 | 2,145 | +21% | 0 | 0 | — |
case-22 | fail→pass | 11,841 | 2,239 | -81% | 1 | 1 | 0% | 1,028 | 1,527 | +49% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +41 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.