RFM Customer Segmentation

VerifiedCaution

Analyze customer value using RFM (Recency, Frequency, Monetary) segmentation. Automatically cleans data, calculates RFM metrics, applies K-means clustering, and generates visual reports with actionable insights.

Sby Skills Guide Bot
Data & AIIntermediate
3/4/2026
Claude Code
#customer-segmentation#rfm-analysis#kmeans-clustering#ecommerce-analytics#chinese-support

Recommended for

Automated summary

Analyzes e-commerce transactions to segment customers by RFM metrics, apply K-means clustering, and generate reports and VIP lists.

Strengths

  • Automatically cleans invalid orders, such as negative quantities and zero prices, before analysis.
  • Uses the elbow method to select the cluster count and labels high-, medium-, and low-value customer segments.
  • Produces a PNG dashboard, detailed CSV exports, and a ranked VIP customer list.
  • Supports Chinese field names and Chinese-language visualizations.

Limitations

  • Assumes a specific transaction schema (user_id, date, quantity, unit price) and does not describe adapting to other formats.
  • Recommends 1000+ orders; clustering may be unreliable on small datasets.
  • Relies on the elbow method for cluster selection without deeper statistical validation or business-rule checks.
When to use it

Use this skill when you have e-commerce order history and need customer value segments or a VIP list for marketing campaigns.

When not to use it

Do not use it if your data lacks the required transaction fields or if you need segmentation based on criteria other than RFM purchase behavior.

Security analysis

Caution
Quality score84/100

The skill is a straightforward local data-analysis workflow: read e-commerce transaction data, clean it, compute RFM metrics with pandas/scikit-learn, and export CSVs and charts. Nothing instructs sending data out, deleting files, curling scripts, or disabling safety. The only reason it is not rated fully safe is that it grants Bash/Write and expects the agent to generate and run arbitrary Python, which is a legitimate but powerful capability with unrestricted scope over the working directory.

Findings
  • •Declares Bash and Write, so the agent will execute generated Python code (pandas/scikit-learn/matplotlib) and write files to the working directory — broad but standard for a data-analysis skill
  • •No pinned/audited script is shipped; the agent must author the analysis code itself, so actual executed commands are not fully determined by the skill
  • •Writes output files (CSVs, PNGs, reports) into the current directory without specifying a dedicated output path, risking clutter or overwriting same-named files
  • •No network access, credential handling, exfiltration, obfuscation, or destructive commands present
How this analysis is made

Examples

Basic segmentation
Analyze this e-commerce orders CSV and segment customers by RFM value. Fields: user_id, order_date, quantity, unit_price. Generate the dashboard and segment summary CSV.
VIP list
From our sales data, identify the top 100 most valuable customers, export vip_customers_list.csv, and summarize recommended marketing actions for each segment.
Revenue by segment
Create a customer segmentation report showing revenue contribution and customer counts by RFM segment, including pie charts and box plots.

name: rfm-customer-segmentation description: Perform RFM (Recency, Frequency, Monetary) customer segmentation analysis on e-commerce data. Use when you need to analyze customer value, identify VIP customers, or create marketing segments. Automatically cleans data, calculates RFM metrics, applies K-means clustering, and generates visualization reports with Chinese language support. allowed-tools: Read, Write, Bash, Glob

RFM Customer Segmentation Analysis

A comprehensive customer segmentation skill that automatically analyzes e-commerce transaction data to identify customer value segments using RFM (Recency, Frequency, Monetary) analysis with K-means clustering.

Instructions

1. Data Analysis

When users provide e-commerce data or ask about customer segmentation:

  • Load and validate the transaction data
  • Clean data by removing invalid orders (negative quantities, zero prices)
  • Calculate RFM metrics for each customer:
    • Recency: Days since last purchase
    • Frequency: Number of purchases
    • Monetary: Total purchase amount
  • Use K-means clustering on RFM dimensions
  • Automatically determine optimal number of clusters using elbow method

2. Customer Segmentation

  • Create customer value segments: High, Medium, Low value customers
  • Score each customer on RFM dimensions (1-3 scale)
  • Calculate overall customer value scores
  • Identify and rank VIP customers for marketing campaigns

3. Visualization and Reporting

  • Generate comprehensive customer segmentation dashboard
  • Create pie charts for segment distribution and revenue share
  • Build RFM scatter plots to visualize customer patterns
  • Generate box plots showing value distribution by segment
  • Export detailed CSV reports with VIP customer lists

4. Marketing Insights

  • Provide actionable marketing recommendations for each segment
  • Generate executive summary with key findings
  • Create customer activation strategies for different value tiers
  • Export VIP customer lists for targeted marketing campaigns

Usage Examples

Basic Customer Segmentation

Analyze these e-commerce orders and segment customers by value:
[CSV data with order_id, user_id, purchase_date, quantity, unit_price]

VIP Customer Identification

Find the top 100 most valuable customers from our sales data for marketing campaign

Customer Value Analysis

Create a customer segmentation report showing revenue contribution by customer segment

Key Features

  • Automatic Data Cleaning: Handles Chinese e-commerce data formats, removes invalid orders
  • Intelligent Clustering: Uses elbow method to determine optimal cluster count
  • Chinese Language Support: Full support for Chinese field names and visualizations
  • Comprehensive Reports: Generates HTML reports, PNG dashboards, and CSV exports
  • Marketing Ready: Provides VIP customer lists and actionable insights

File Requirements

The skill works with e-commerce transaction data containing:

  • user_id: Customer identification code (用户码)
  • order_date: Purchase date (消费日期)
  • quantity: Order quantity (数量)
  • unit_price: Item unit price (单价)
  • product_info: Product details (optional)

Output Files Generated

  • customer_segments.csv: Complete customer segmentation data
  • vip_customers_list.csv: Ranked VIP customer list for marketing
  • segment_summary_statistics.csv: Detailed statistics by segment
  • customer_segmentation_dashboard.png: Visual analytics dashboard
  • data_validation_report.txt: Data quality and analysis validation

Dependencies

  • pandas, numpy for data processing
  • scikit-learn for K-means clustering
  • matplotlib, seaborn for visualization (with Chinese font support)
  • Standard Python libraries for file operations

Best Practices

  • Ensure date fields are in consistent format (YYYY-MM-DD recommended)
  • Remove or handle missing values before analysis
  • Use sufficient data volume (1000+ orders recommended for reliable clustering)
  • Consider business context when interpreting segment results
  • Validate results with domain knowledge when possible

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/rfm-customer-segmentation-mmbizjqy/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/rfm-customer-segmentation-mmbizjqy' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/rfm-customer-segmentation-mmbizjqy/download' --output '.skill-downloads/rfm-customer-segmentation-mmbizjqy/SKILL.md.part' && mv '.skill-downloads/rfm-customer-segmentation-mmbizjqy/SKILL.md.part' '.skill-downloads/rfm-customer-segmentation-mmbizjqy/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Read, Write, Bash, Glob

Original excerpt: Dependencies
  • pandas, numpy for data processing
  • scikit-learn for K-means clustering
  • matplotlib, seaborn for visualization (with Chinese font support)
  • Standard Python libraries for file operations

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/rfm-customer-segmentation-mmbizjqy/SKILL.md' && test -s '.skill-downloads/rfm-customer-segmentation-mmbizjqy/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/rfm-customer-segmentation' && cp -R '.skill-downloads/rfm-customer-segmentation-mmbizjqy' '.claude/skills/rfm-customer-segmentation'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/rfm-customer-segmentation-mmbizjqy'

openskills read 'rfm-customer-segmentation-mmbizjqy'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/rfm-customer-segmentation-mmbizjqy/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills