← 返回 Skills 市场
170
总下载
1
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install customer-segment
功能描述
金融客户分群分析 Skill。当用户上传银行客户数据表格(CSV/Excel)时自动触发,完成客户分层、特征提取和可视化输出。触发场景包括:(1)用户说"分析客户"或"客户分群";(2)上传了包含客户交易、资产、行为等字段的数据文件;(3)需要输出客户分层结果、可视化图表或分群报告。
使用说明 (SKILL.md)
Customer Segmentation Skill
金融客户分群分析:将客户按资产、交易行为、活跃度等维度进行分层,输出可操作的分群结果与可视化。
工作流程
Step 1 — 数据加载与清洗
读取用户上传的 CSV 或 Excel 文件,自动识别列名。
优先保留字段:
customer_id/客户ID— 客户唯一标识age/年龄gender/性别balance/资产余额txn_amount/交易金额txn_count/交易次数last_date/最近交易日期product_count/持有产品数branch/网点
缺失值处理:
- 数值型:用中位数填充
- 类别型:用众数填充
- 超过 30% 缺失的列:删除该列并提示用户
import pandas as pd
df = pd.read_csv(file_path)
df.columns = df.columns.str.strip().str.lower()
Step 2 — 特征工程
构建 RFM + 扩展特征:
| 特征 | 说明 |
|---|---|
| Recency | 距今天数(越小越活跃) |
| Frequency | 交易频率(指定周期内交易次数) |
| Monetary | 交易金额(指定周期内总金额) |
| Tenure | 客户持有时长(月) |
| Product_Depth | 持有产品数量 |
| Age | 客户年龄 |
数据标准化:使用 StandardScaler(Z-score)归一化所有数值型特征。
Step 3 — 聚类分析
使用 K-Means 算法,自动确定 K 值(肘部法则 Elbow Method,SSE 拐点)。
from sklearn.cluster import KMeans
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
X_scaled = scaler.fit_transform(features)
# 肘部法则找最优K
sse = {}
for k in range(2, 10):
km = KMeans(n_clusters=k, random_state=42, n_init=10)
km.fit(X_scaled)
sse[k] = km.inertia_
optimal_k = min(sse, key=sse.get) # 简单取SSE最小的k
也可根据业务需求固定 K=5(高/中高/中/中低/低价值客户)。
Step 4 — 分群画像
输出每个簇的核心统计量:
簇 0(高价值客户):平均资产 85万,平均交易频次 28次/月,性别分布男62%
簇 1(潜力客户):平均资产 32万,年轻化趋势明显
...
推荐标签体系(五类):
- 🌟 高价值客户(VIP)
- ⬆️ 潜力客户
- 🟢 稳定客户
- 🔄 活跃交易客户
- ⚠️ 沉睡/流失预警客户
Step 5 — 可视化
生成以下图表(保存为 PNG):
- 客户资产分布直方图 — 各层级资产分布对比
- 雷达图 — 各分群特征对比
- 热力图 — 分群特征均值矩阵
- 散点图 — 以资产×交易频次为坐标的客户分布
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('Agg')
plt.rcParams['font.sans-serif'] = ['WenQuanYi Micro Hei', 'SimHei']
fig, axes = plt.subplots(1, 2, figsize=(14, 5))
# 资产分布
axes[0].hist([g['balance'] for _, g in df.groupby('cluster')], bins=30, label=[f'C{i}' for i in range(k)])
axes[0].set_title('Customer Balance Distribution by Cluster')
# 热力图
import seaborn as sns
sns.heatmap(cluster_means.T, annot=True, fmt='.1f', ax=axes[1])
axes[1].set_title('Cluster Feature Heatmap')
plt.tight_layout()
plt.savefig(output_path, dpi=150)
Step 6 — 输出结果
输出内容:
- 分群结果表(含客户ID、所属簇、分群标签)→
segmentation_results.csv - 分群特征统计 →
cluster_summary.csv - 可视化图表 →
segmentation_charts.png - 分析摘要(Markdown格式)→
segmentation_report.md
详细聚类和参数文档见:
- RFM 模型说明:参考
references/rfm-guide.md - 聚类参数说明:参考
references/clustering-guide.md
安全使用建议
This skill appears to do what it claims: local customer segmentation and charts. Before installing/running it: (1) review the script (scripts/segment.py) yourself — it will read and write files including customer IDs; (2) ensure the runtime has required Python packages (pandas, numpy, scikit-learn, matplotlib, seaborn); (3) confirm Excel support if you expect .xlsx inputs (script currently uses read_csv); (4) enforce privacy/compliance: consider removing or hashing PII (customer_id) or running in a controlled environment, and secure the output directory; (5) if you want to avoid automatic execution on uploads, adjust agent trigger rules or require explicit user confirmation. If you want, I can list the exact python package versions to install or point out the exact lines that write PII to outputs.
功能分析
Type: OpenClaw Skill
Name: customer-segment
Version: 1.0.2
The skill bundle is a legitimate tool for financial customer segmentation using K-Means clustering. The Python script (scripts/segment.py) and instructions (SKILL.md) focus entirely on data processing, feature engineering, and visualization of user-provided datasets. No evidence of data exfiltration, unauthorized execution, or malicious intent was found.
能力评估
Purpose & Capability
Name/description (customer segmentation) match the included SKILL.md, references, and the Python script which implements RFM feature engineering, K-Means clustering, labeling and chart/report output. There are no environment variables, binaries, or network endpoints requested that are unrelated to the stated purpose.
Instruction Scope
Instructions and script operate on uploaded CSV/Excel customer data and produce CSV/PNG/MD outputs (expected). Two points to note: (1) the script primarily reads CSV (pd.read_csv) while SKILL.md promises CSV/Excel support — Excel (.xlsx) handling is not implemented unless the agent wraps read_excel separately; (2) the skill processes sensitive banking data and does not enforce or automate de-identification or access controls — output files include customer IDs and raw metrics, so users should ensure privacy/compliance and secure storage/retention.
Install Mechanism
No install spec (instruction-only skill) — lowest install risk. However, the included Python script requires common data-science packages (pandas, numpy, scikit-learn, matplotlib, seaborn). The skill does not declare or install these dependencies; the runtime environment must provide them. No network downloads or unusual install actions are present.
Credentials
The skill requests no environment variables, credentials, or config paths — appropriate for an offline data-processing task. There are no apparent attempts to access unrelated secrets or systems.
Persistence & Privilege
always is false and the skill is user-invocable (normal). The SKILL.md describes automatic triggering when a user uploads a customer data file — combined with the agent's ability to autonomously invoke skills, this can cause automatic execution on user-provided sensitive data. This is expected behavior for a file-processing skill but worth confirming in your deployment policy.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install customer-segment - 安装完成后,直接呼叫该 Skill 的名称或使用
/customer-segment触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.2
- 修正英文描述细节,使 Skill 简介更为简明,聚焦于“金融客户分群分析”。
- 其余功能、流程、输出内容均保持一致,无实际功能更新或文件变更。
v1.0.1
- Skill描述由“银行客户分群分析”更新为更广义的“金融客户分群分析”。
- 其余流程与功能无变化,仅文档描述中“银行客户”调整为“金融客户”以覆盖更广泛的应用场景。
v1.0.0
- Initial release of the customer segmentation skill for banking customers.
- Automatically analyzes uploaded customer data (CSV/Excel): clustering, feature extraction, and visualization.
- Supports triggers: user requests for customer analysis, or relevant file uploads.
- Performs data cleaning, feature engineering (RFM +扩展特征), and K-Means clustering with automatic or fixed K.
- Outputs: segmented customer table, cluster statistics, visualization charts, and summary report.
元数据
常见问题
customer-segment 是什么?
金融客户分群分析 Skill。当用户上传银行客户数据表格(CSV/Excel)时自动触发,完成客户分层、特征提取和可视化输出。触发场景包括:(1)用户说"分析客户"或"客户分群";(2)上传了包含客户交易、资产、行为等字段的数据文件;(3)需要输出客户分层结果、可视化图表或分群报告。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 170 次。
如何安装 customer-segment?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install customer-segment」即可一键安装,无需额外配置。
customer-segment 是免费的吗?
是的,customer-segment 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
customer-segment 支持哪些平台?
customer-segment 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 customer-segment?
由 yukirang(@yukirang)开发并维护,当前版本 v1.0.2。
推荐 Skills