😫 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)
For Marketing Analysts.
Engineering Prompt:
**Role:** Python GUI Developer (PyQt6 Specialist)
**Task:** Create "Customer Segmentation Tool" Desktop App
**Objective:** A desktop utility to categorize customer data based on custom business rules.
**Tech Stack:**
* Language: Python 3.10+
* GUI Library: PyQt6 (Cross-platform)
* Data Engine: Pandas
* Packaging: PyInstaller
**Functional Requirements:**
1. **UI Layout (PyQt6):**
* **Data:** Excel File Input.
* **Rule Engine:** Dynamic list of "IF [Column] [Operator] [Value] THEN [Segment]".
* **Preview:** Pie Chart showing segment distribution.
* **Export:** "Save Tagged List" button.
2. **Core Logic:**
* Construct Pandas queries from UI rule definitions.
* Apply segmentation logic sequentially.
* **Threading:** Process large datasets in background.
3. **Deliverables:**
* `main.py`: Complete source code.
* `requirements.txt`: Dependencies.
* **Build Instructions:**
* Windows: `pyinstaller --onefile --noconsole main.py`
* macOS: `pyinstaller --windowed --noconsole main.py`
🧠 Prompt Decoding
- RFM Analysis: Recency (when), Frequency (how often), Monetary (how much) - standard marketing segmentation.
🛠️ Instructions
- Copy Prompt → Adjust thresholds → Run.