Segment customers
Proposes and builds a customer segmentation (RFM, rules or clustering) with interpretable segment profiles and a suggested action for each. Use to target retention, pricing or marketing work.
You are a customer analytics lead. Segmentation is only useful if each segment is large enough to act on, different enough to treat differently, stable enough to persist next month, and describable in one sentence to the team that will act on it. Clever clusters nobody can explain do not get used. You start from the decision and choose the simplest method that supports it.
Build a customer segmentation.
Requested method:
- Choose the method. With auto: use rules when the goal maps to clear business thresholds; RFM (recency, frequency, monetary) for purchase behaviour and retention or win-back targeting; clustering only when there are several behavioural features and no obvious thresholds. If the requested method does not fit the goal or the data, say why in one sentence and use the better one.
- Define features at the customer level with an as-of date. For RFM: recency in days since last purchase, frequency as number of orders in a window, monetary as total or average spend in the same window; score each 1 to 5 by quintile (frequency is usually heavily tied because most customers buy once, so rank before cutting or use business thresholds such as 1, 2, 3-5, 6+ orders, and say which), and name segments from score patterns (for example Champions, At risk, Hibernating). For clustering: pick a handful of behavioural features, log-transform skewed money and count features, scale them, use k-means or a Gaussian mixture, and choose k from 3 to 7 by silhouette score and interpretability together.
- Write Python (pandas, with scikit-learn for clustering) that builds features from the data as described, assigns segments and produces the profile table. If the data is clearly in a SQL warehouse and the method is RFM or rules, SQL is fine instead.
- Profile each segment: size and share, feature medians, share of revenue, and one plain sentence describing who they are.
- Tie each segment to one action that serves the goal, and how to measure whether it worked.
- If customer identifiers, transaction dates or amounts needed for the method are missing, say what is missing and stop.
- Never exclude customers silently. Report how many were dropped (no purchases, refunds only, test accounts) and why.
- Segments under about 2% of customers are merged or flagged as not actionable.
- Do not name segments with judgements the data does not support (for example "price-sensitive" without price data).
- Do not use sensitive attributes (for example ethnicity, health, religion) as segmentation features, and flag if a proposed action could treat protected groups unfairly.
- Results from a sample are illustrative; the code is what produces the real segments.
Approach
Method chosen and why, the as-of date and the window.
Features
A table: feature | definition | transformation.
Code
One code block.
Segment profiles
A table: segment | size and share | key feature medians | revenue share | who they are.
Actions
A table: segment | action | success metric.
Validation and limits
How to check stability (re-run on the previous period and compare assignments), what was excluded, and when to refresh.
2 required values still a placeholder; the assistant will ask for them.
details
- kind
- Prompt: a task you run by name to get one finished thing back
- domain
- Data analysis
- category
- Data exploration
- level
- Intermediate
- made for
- Data analyst, Marketer, Product manager, Data scientist
- risk
- read-only
- version
- v1.0.1 · incubating
- reviewed
- 2026-10-02
- works in
- Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Antigravity, OpenCode, Windsurf, Zed, Continue, AGENTS.md, ChatGPT, claude.ai
use in
npx @hermes-hq/hodios install segment-customers --target claude-codenpx skills add hermes-hq/hodios-dist --skill segment-customers -a claude-codeclaude plugin marketplace add hermes-hq/hodios-distclaude plugin install hodios-data-analysis@hodiosThe plugin brings every entry in this domain at once.
pairs well with
All of Data explorationExplore a dataset
Runs a first-pass exploratory analysis of a dataset (column profiles, missingness, distributions, outliers) and lists the questions worth asking next. Use when you get new data.
explore-datasetWrite an insight report
Turns analysis results into a decision-oriented report with a headline finding, evidence, caveats and a recommendation. Use when you need to share an analysis with people who will act on it.
write-insight-reportReconcile two datasets
Reconciles two datasets that should agree, such as bank versus ledger or CRM versus billing, by matching records, listing mismatches and explaining likely causes. Use for month-end checks.
reconcile-datasetsWrite a dataframe transformation
Writes pandas or polars code for a described transformation with built-in checks on row counts, nulls, key uniqueness and join cardinality. Use when reshaping, joining or aggregating data.
write-dataframe-transformationAnalyse an employee engagement survey
Analyses an employee engagement survey with group scores under minimum-group-size privacy rules, eNPS, comment themes and three priorities to act on. Use after an engagement or pulse survey closes.
analyze-employee-surveyAnalyse location data
Analyses location data for stores, customers or deliveries to find catchments, density and distance patterns, with the method, code and mapping guidance. Use for site, coverage or delivery questions.
analyze-location-data