40rty-ai/shopify-admin-skills/shopify-admin-rfm-customer-segmentation
Claude Code and agent skill by 40rty-ai/shopify-admin-skills
- community
Checking that the SKILL.md file is still in the repository.
Read-only: scores every customer on Recency, Frequency, and Monetary value to segment them into actionable groups (Champions, Loyal, At-Risk, Lost).
Install
npx vskill@latest install 40rty-ai/shopify-admin-skills/shopify-admin-rfm-customer-segmentationSKILL.md
The same SKILL.md was published earlier as 40rty-ai/shopify-admin-skills/shopify-admin-rfm-customer-segmentation.
Purpose
Performs full RFM (Recency, Frequency, Monetary) analysis across the entire customer base. Each customer is scored 1-5 on three dimensions — how recently they purchased, how often they purchase, and how much they spend — then classified into actionable segments: Champions, Loyal Customers, Potential Loyalists, At-Risk, Hibernating, and Lost. Read-only — no mutations.
Prerequisites
- Authenticated Shopify CLI session:
shopify store auth --store <domain> --scopes read_orders,read_customers - API scopes:
read_orders,read_customers
Parameters
| Parameter | Type | Required | Default | Description | |
|---|---|---|---|---|---|
| store | string | yes | — | Store domain (e.g., mystore.myshopify.com) | |
| days_back | integer | no | 365 | Lookback window for order history | |
| segments | integer | no | 5 | Number of quintile buckets per dimension (3 or 5) | |
| min_orders | integer | no | 1 | Minimum orders for a customer to be scored | |
| tag_customers | boolean | no | false | If true, add RFM segment tag to customer (requires write_customers scope) | |
| format | string | no | human | Output format: human or json |
Safety
ℹ️ Read-only by default. Iftag_customers: true, will add tags via customerUpdate mutation — usedry_run: truefirst.
RFM Segment Definitions
| Segment | R Score | F Score | M Score | Description | |
|---|---|---|---|---|---|
| Champions | 5 | 5 | 5 | Best customers — recent, frequent, high spend | |
| Loyal Customers | 3-5 | 4-5 | 4-5 | Consistent buyers with strong spend | |
| Potential Loyalists | 4-5 | 2-3 | 2-3 | Recent buyers who could become loyal | |
| New Customers | 5 | 1 | 1-2 | Just made first purchase | |
| Promising | 4 | 1-2 | 1-2 | Recent but low frequency — nurture them | |
| Need Attention | 3 | 3 | 3 | Average across all dimensions — slipping | |
| About to Sleep | 2-3 | 2 | 2 | Below average recency and frequency | |
| At Risk | 1-2 | 4-5 | 4-5 | Were great customers, haven't bought recently | |
| Hibernating | 1-2 | 1-2 | 1-3 | Low on all dimensions — nearly lost | |
| Lost | 1 | 1-2 | 1-5 | Haven't bought in a very long time |
Workflow Steps
- OPERATION:
orders— query
Inputs: query: "created_at:>='<NOW - days_back days>'", first: 250, select createdAt, totalPriceSet, customer { id, email, firstName, lastName, numberOfOrders }, pagination cursor Expected output: All orders in window with customer linkage; paginate until complete
- Aggregate per customer:
- Recency = days since last order
- Frequency = total number of orders in window
- Monetary = total spend in window
- Score each dimension 1-5 using quintile bucketing:
- Sort all customers by each metric
- Divide into N equal-sized groups (quintiles)
- Assign scores (5 = best for recency [most recent], frequency [most frequent], monetary [highest spend])
- Map (R, F, M) score combination to named segment using the definitions above
- OPERATION:
customers— query (enrichment)
Inputs: Customer IDs from each segment for contact details Expected output: Email, name, tags for top customers in each segment
GraphQL Operations
Session Tracking
Claude MUST emit the following output at each stage. This is mandatory.
On start, emit:
After each step, emit:
On completion, emit:
For format: human (default):
For format: json, emit:
Output Format
CSV file rfm_segments_<YYYY-MM-DD>.csv with columns: customer_id, email, first_name, last_name, recency_days, frequency, monetary, r_score, f_score, m_score, rfm_segment
Error Handling
| Error | Cause | Recovery | |
|---|---|---|---|
THROTTLED | API rate limit exceeded | Wait 2 seconds, retry up to 3 times | |
| Guest orders | Orders without customer | Skip — cannot attribute to RFM profile | |
| Single-order customers | New or one-time buyers | Include with F=1; they'll naturally score low on frequency |
Best Practices
- Use
days_back: 365for most stores to capture seasonal buying patterns. Usedays_back: 180for fast-fashion or consumables. - Champions and Loyal segments are ideal targets for exclusive offers and early access campaigns.
- At-Risk customers should receive win-back campaigns immediately — use with
customer-win-backskill. - Export Lost segment to an exclusion list to stop wasting ad spend on them.
- Cross-reference with
customer-cohort-analysisfor cohort-level RFM trends over time. - Use with
customer-spend-tier-taggerto auto-tag customers based on RFM segment.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/customer-ops/shopify-admin-rfm-customer-segmentation/SKILL.md
Popularity
- Repository stars
- 151
- Repository forks
- 12
- 7-day trend score
- 25
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/40rty-ai/shopify-admin-skills/shopify-admin-rfm-customer-segmentation)