shopify-admin-rfm-customer-segmentation

Read-only mode: Scores customers based on Recency, Frequency, and Monetary value and segments them into actionable groups (e.g., Champions, Loyal, At-risk, Churned).

Last repository push
GitHub Stars
205
Forks
23
Issues / PRs
2

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "shopify-admin-rfm-customer-segmentation" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-9f4144f839d6944e1f4f4ed287876c80a75a6b43d79b64f32e715478b8e81ba6. Verify the upstream source and version against https://github.com/40RTY-ai/shopify-admin-skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Read-only mode: Scores customers based on Recency, Frequency, and Monetary value and segments them into actionable groups (e.g., Champions, Loyal, At-risk, Churned).

0 Downloads

Introduction source: third_party · 40RTY-ai · 0.0.1 Reference

SkillPi interpretation

Tasks
Read-only: scores every customer on Recency, Frequency, and Monetary value to segment them into actionable groups (Champions, Loyal, At-Risk, Lost).
Inputs and outputs
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`
Software, accounts and paid services
Authenticated Shopify CLI session: `shopify store auth --store <domain> --scopes read_orders,read_customers` API scopes: `read_orders`, `read_customers`
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: shopify-admin-rfm-customer-segmentation
role: customer-ops
description: "Read-only: scores every customer on Recency, Frequency, and Monetary value to segment them into actionable groups (Champions, Loyal, At-Risk, Lost)."
toolkit: shopify-admin, shopify-admin-execution
api_version: "2025-01"
graphql_operations:
  - customers:query
  - orders:query
status: stable
compatibility: Claude Code, Cursor, Codex, Gemini CLI

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. If tag_customers: true, will add tags via customerUpdate mutation — use dry_run: true first.

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

  1. 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

  2. Aggregate per customer:

    • Recency = days since last order
    • Frequency = total number of orders in window
    • Monetary = total spend in window
  3. 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])
  4. Map (R, F, M) score combination to named segment using the definitions above

  5. 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

# orders:query — validated against api_version 2025-01
query OrdersForRFM($query: String!, $after: String) {
  orders(first: 250, after: $after, query: $query) {
    edges {
      node {
        id
        createdAt
        totalPriceSet { shopMoney { amount currencyCode } }
        customer {
          id
          email
          firstName
          lastName
          numberOfOrders
        }
      }
    }
    pageInfo { hasNextPage endCursor }
  }
}
# customers:query — validated against api_version 2025-01
query CustomerDetails($query: String, $after: String) {
  customers(first: 250, after: $after, query: $query) {
    edges {
      node {
        id
        email
        firstName
        lastName
        numberOfOrders
        totalSpentV2 { amount currencyCode }
        tags
        createdAt
      }
    }
    pageInfo { hasNextPage endCursor }
  }
}

Session Tracking

Claude MUST emit the following output at each stage. This is mandatory.

On start, emit:

╔══════════════════════════════════════════════╗
║  SKILL: RFM Customer Segmentation           ║
║  Store: <store domain>                       ║
║  Started: <YYYY-MM-DD HH:MM UTC>             ║
╚══════════════════════════════════════════════╝

After each step, emit:

[N/TOTAL] <QUERY|MUTATION>  <OperationName>
          → Params: <brief summary of key inputs>
          → Result: <count or outcome>

On completion, emit:

For format: human (default):

══════════════════════════════════════════════
RFM SEGMENTATION REPORT  (<days_back> days)
  Customers scored:     <n>
  ─────────────────────────────
  Champions:            <n> (<pct>%)  Avg spend: $<n>
  Loyal Customers:      <n> (<pct>%)  Avg spend: $<n>
  Potential Loyalists:  <n> (<pct>%)  Avg spend: $<n>
  At Risk:              <n> (<pct>%)  Avg spend: $<n>
  Hibernating:          <n> (<pct>%)  Avg spend: $<n>
  Lost:                 <n> (<pct>%)  Avg spend: $<n>

  Top Champions:
    <name> (<email>)  R:<n> F:<n> M:<n>  Spend: $<n>
  Top At-Risk (win-back candidates):
    <name> (<email>)  Last order: <date>  Lifetime: $<n>
  Output: rfm_segments_<date>.csv
══════════════════════════════════════════════

For format: json, emit:

{
  "skill": "rfm-customer-segmentation",
  "store": "<domain>",
  "period_days": 365,
  "customers_scored": 0,
  "segments": {
    "champions": { "count": 0, "pct": 0, "avg_spend": 0 },
    "loyal": { "count": 0, "pct": 0, "avg_spend": 0 },
    "at_risk": { "count": 0, "pct": 0, "avg_spend": 0 },
    "lost": { "count": 0, "pct": 0, "avg_spend": 0 }
  },
  "output_file": "rfm_segments_<date>.csv"
}

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: 365 for most stores to capture seasonal buying patterns. Use days_back: 180 for 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-back skill.
  • Export Lost segment to an exclusion list to stop wasting ad spend on them.
  • Cross-reference with customer-cohort-analysis for cohort-level RFM trends over time.
  • Use with customer-spend-tier-tagger to auto-tag customers based on RFM segment.

Version history

  1. v1.1.0 GitHub ↗
    Original release notes

    ## 🤖 New category: Agentic Commerce Readiness The fix-it side of the [**agentiq.report**](https://agentiq.report) audit. The audit tells operators *where* AI shopping agents (ChatGPT, Gemini, Perplexity, agentic checkout) can't find, read, or recommend their store. This release adds **10 skills that remediate those findings** via the native Shopify Admin GraphQL toolkit — closing the loop: **audit finds the gap → run the matching skill → re-audit confirms.** Every skill declares the audit **signals** it fixes (`audit_signals` frontmatter), so a finding in the report maps directly to the skill that resolves it. ### Skills - **`agentic-readiness-audit`** — flagship, read-only store-side scorecard that routes each gap to its fix skill - **`agentic-product-jsonld-backfill`** — barcode/GTIN, vendor, product type for complete Product JSON-LD - **`agentic-image-alt-text`** — descriptive alt text on product media - **`agentic-description-enrichment`** — fact-rich descriptions for AI quoting - **`agentic-metafields-setup`** — define + populate agentic metafields for filtering - **`agentic-product-taxonomy`** — Shopify Standard Product Taxonomy categories - **`agentic-crawler-access`** — allow GPTBot/ClaudeBot/PerplexityBot… in `robots.txt.liquid` - **`agentic-llms-txt`** — publish a curated `/llms.txt` for AI assistants - **`agentic-organization-schema`** — Organization JSON-LD (sameAs, contactPoint) into the theme - **`agentic-policy-readability`** — machine-readable shipping/returns policies Plus a weekly **`agentic-readiness-monitor`** routine that re-audits and alerts on regressions. ### Stats **116 skills across 11 categories** (was 106/10), **21 routines** (was 20). All GraphQL validated against the live Admin 2025-01 schema; `pnpm validate:index` passes (116 skills, 64 operations). ### Notes Theme-editing and policy skills default to `dry_run`/`audit` mode, write inside managed `# BEGIN/END` blocks, and recommend duplicating the theme first.

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • 提供完整的 RFM 客户分群能力,解决电商运营中的高价值客户识别、流失预警、精准营销等核心痛点
  • 支持 Champions、Loyal、At-Risk、Lost 等可操作群组划分,具备明确的业务落地价值
Trigger Precision95/100

Highlights

  • description 清晰描述 RFM 评分与分群功能,frontmatter 与顶层一致且完整
  • 触发词精准覆盖核心能力边界,无歧义或重叠风险
Structure and Standards95/100

Highlights

  • 文档结构完整,涵盖从前置条件到输出格式的端到端流程
  • 提供详细的参数说明、步骤划分、Session Tracking 输出模板及错误处理策略
Execution Reliability95/100

Highlights

  • GraphQL 操作已验证 API version 2025-01,参数设计合理
  • 覆盖 API 限流、匿名订单等异常场景,并提供重试与跳过策略
  • 对写操作(tag_customers)提供 dry_run 安全建议
Evidence Verifiability (mean of the first four)95/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Authenticated Shopify CLI session: `shopify store auth --store <domain> --scopes read_orders,read_customers` API scopes: `read_orders`, `read_customers`

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.