๐ซ The Pain Point
You have 10,000 customers and need to segment them by purchase frequency. VIP (>10 orders), Regular (3-10), New (1-2), Inactive (0 in 6 months). Doing this manually is error-prone.
๐ Agentic Solution
A Rule-Based Classifier that categorizes based on your business logic.
Key Features:
- Custom Rules: Define your own thresholds.
- Multiple Criteria: Combine amount, frequency, recency.
- RFM Analysis: Built-in Recency-Frequency-Monetary scoring.
โ๏ธ Phase 1: Commander (Quick Fix)
For quick classification.
Prompt:
โI have an Excel
customers.xlsxwith columns โCustomer_IDโ, โOrder_Countโ, โTotal_Spentโ, โLast_Order_Dateโ. Write a Python script using Pandas to:
- Classify:
- VIP: Order_Count > 10 AND Total_Spent > 10M
- Regular: Order_Count 3-10
- New: Order_Count 1-2
- Inactive: Last_Order > 6 months ago
- Add: New column โSegmentโ.
- Output: Save with segment counts summary.
Print distribution of segments.โ
Result: Segmented customer list for marketing.
๐๏ธ Phase 2: Architect (Permanent Tool)
Engineering Prompt:
**Role:** Python Tool Developer
**Task:** Create a "Customer Segmentation Tool".
**Requirements:**
1. **GUI:**
* Select Excel file.
* Rule builder: Column, Operator, Value.
* Multiple rules with AND/OR.
* Preview segment distribution.
* "Apply" button.
2. **Logic:**
* Parse rules into Pandas queries.
* Handle date comparisons.
* Show segment statistics.
3. **Deliverables:**
* `customer_classifier.py`
* `run.bat`, `run.sh`
* `requirements.txt`
๐ง Prompt Decoding
- RFM Analysis: Recency (when), Frequency (how often), Monetary (how much) - standard marketing segmentation.
๐ ๏ธ Instructions
- Copy Prompt โ Adjust thresholds โ Run.