asgard-ai-platform/ecom-rfm-analysis
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'.
npx skills add https://github.com/asgard-ai-platform/skills --skill ecom-rfm-analysis
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
# 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.mdTake asgard-ai-platform/ecom-rfm-analysis from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.