agentleFS
afelipegafelipeg/Anthropic-Skills-for-enterprise-marketing-os/skills/audience-segmentation-brief/SKILL.md

audience-segmentation-brief

Skill1 starsChanged 7 months agoMITView on GitHub

Builds audience segmentation briefs from customer, behavioral, demographic, transactional, CRM, media, or market data. Supports RFM segmentation, CLV estimation (BG/NBD + Gamma-Gamma methodology from PyMC-Marketing), K-Means behavioral clustering, and Consumer Identity Graph resolution for 1st/2nd/3rd party data. Use when defining audiences, personas, segments, targeting logic, activation groups, lookalikes, suppression lists, CRM cohorts, or media audience strategies. Also trigger when someone says "who should we target?", "build audience segments", "define personas", "identify high-value customers", "create lookalike seeds", or "connect our data sources". Even casual phrasing like "who are our best customers?", "who's at risk of churning?", or "how do we activate this data?" should activate this skill.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When data comes from multiple sources, resolve identities first.

    line 83
  2. Distinctive:

    When you have non-transactional behavioral data (page views, app events, content consumption), use K-Means to discover natural behavioral …

    line 92

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Audience Segmentation Brief

Convert available customer and market data into actionable audience segments for media, CRM, creative, measurement, and business decisions. Treat segmentation as logistics classification: every audience has a destination, route, message, value potential, and activation method.

How This Skill Orchestrates

  1. Web search (Claude — MANDATORY): Search Kantar Worldpanel for category penetration/frequency, industry CLV benchmarks, platform audience sizes by country
  2. Script execution (scripts/segmentation_engine.py): RFM scoring + CLV estimation (BG/NBD + Gamma-Gamma heuristic) + K-Means clustering + Consumer Identity Graph resolution. Runs multiple methods based on data availability
  3. Reference lookup (references/segmentation_methodology.md): RFM framework (11 segments), PyMC-Marketing CLV methodology, K-Means guide, Identity Graph architecture (7 match key types), 1st/2nd/3rd party data strategy, LATAM/Mexico specifics (LFPDPPP, WhatsApp addressability, phone-first matching)
  4. Upstream context (Claude): Pull channel allocation from media-routing-planner, scope from scope-audit, CRM platform from crm-journey-architect
  5. Visual output (Visualizer): Segment distribution chart + CLV tier pyramid + Identity Graph match rate + activation matrix

Models used (all justified):

ModelWhen to useStack layer
RFMTransaction data available (always start here)Measurement — clustering
CLV (BG/NBD + Gamma-Gamma)Value-based segmentation needed; script uses heuristic, production uses PyMC-MarketingMeasurement — CLV
K-MeansBehavioral data (events, clicks, content) beyond transactionsMeasurement — clustering
Identity GraphMulti-source data (CRM + app + website + 2P/3P)Interpretation — entity resolution
Proxy segmentationNo data available — infer from demographics/geoInterpretation — LLM inference

For full Bayesian CLV, the reference provides PyMC-Marketing code (BetaGeoModel + GammaGammaModel). The script's built-in CLV is a heuristic approximation — use PyMC for production.

Quick Reference

ResourcePurposeUsage
scripts/segmentation_engine.pyRFM scorer (11 segments), CLV estimator (5 tiers), K-Means (configurable K), Identity Graph builder (deterministic multi-key matching), proxy segmentation fallbackpython segmentation_engine.py --input config.json --output segments.json
scripts/segment_overlap_checker.pyDetects overlapping segments using Jaccard similarity. Flags critical/high/medium overlaps with consolidation recommendationspython segment_overlap_checker.py --input segments.json --output overlaps.json
scripts/addressability_checker.pyValidates what % of each segment is addressable per channel (email/SMS/WhatsApp/push/paid), considering consent status and data availabilitypython addressability_checker.py --segments segs.json --contacts contacts.json
references/segmentation_methodology.mdRFM framework + scoring table, CLV methodology (BG/NBD + GG with PyMC code), K-Means feature guide, Identity Graph architecture (match key hierarchy, confidence scoring), 1P/2P/3P data strategy by maturity level, activation patterns by segment, LATAM specificsRead for methodology and activation patterns
references/consent_and_addressability.mdConsent status logic (6 states), regulatory framework (LFPDPPP Mexico, GDPR, CCPA, LGPD Brazil), addressability rates by channel and country (LATAM-specific), cross-channel consent matrixRead for compliance and activation feasibility
references/suppression_guidelines.md11 suppression types with duration rules, suppression logic by segment, platform-specific suppression (SFMC/AJO/paid), re-entry cooldown rules, frequency caps by channel, deliverability protection thresholdsRead for suppression strategy and list hygiene

How to Use the Script

import sys
sys.path.insert(0, "<skill-path>/scripts")
from segmentation_engine import SegmentationEngine

config = {
    "client_name": "AcmeAuto MX",
    "objective": "Identify high-value customers for loyalty program + lookalike seeding",
    "methods": ["rfm", "clv", "identity_graph"],
    "clv_months": 12,
    "transactions": [
        {"customer_id": "C001", "date": "2026-01-15", "amount": 850},
        {"customer_id": "C001", "date": "2026-03-20", "amount": 120},
        {"customer_id": "C002", "date": "2025-11-10", "amount": 45000},
        # ... more transactions
    ],
    "data_sources": [
        {"source_name": "Salesforce CRM", "source_type": "1p",
         "records": [{"id": "C001", "email": "john@example.com", "phone": "+525512345678", "crm_id": "SF-001"}]},
        {"source_name": "Website CDP", "source_type": "1p",
         "records": [{"id": "W001", "email": "john@example.com", "device_id": "abc123"}]},
        {"source_name": "Retail partner", "source_type": "2p",
         "records": [{"id": "R001", "phone": "+525512345678", "crm_id": ""}]},
    ],
}

engine = SegmentationEngine(config)
result = engine.segment()
# result.segments, result.rfm_distribution, result.clv_tiers, result.identity_graph

Process

Step 1 — Define the Business Decision

What decision does this segmentation support? "Who to target for loyalty" ≠ "Who to exclude from prospecting" ≠ "Who to winback."

Step 2 — Identify Available Data

Inventory all data sources: CRM (1P), website/app (1P), transactions (1P), retail partner (2P), DMP/DSP (3P). Note consent status per source.

Step 3 — Build Identity Graph (if multi-source)

When data comes from multiple sources, resolve identities first. Run the Identity Graph builder to match records across sources using email → CRM ID → phone → device ID hierarchy. This creates a unified audience foundation.

Step 4 — Run RFM Segmentation (if transactions available)

Score customers on Recency, Frequency, Monetary. Produces 11 actionable segments from "Champions" to "Lost." This is the foundation — always run RFM if transaction data exists.

Step 5 — Estimate CLV (if value-based segmentation needed)

Layer CLV on top of RFM to identify not just who's active, but who's most valuable over time. Uses BG/NBD + Gamma-Gamma methodology. For production, use PyMC-Marketing (see reference).

Step 6 — Run K-Means (if behavioral data available)

When you have non-transactional behavioral data (page views, app events, content consumption), use K-Means to discover natural behavioral clusters.

Step 7 — Define Activation Method per Segment

Map each segment to its activation channel: CRM journey, paid media audience, lookalike seed, retargeting list, suppression list, sales handoff.

Step 8 — Define Suppression Logic

Champions → suppress from prospecting (waste). Lost → suppress from CRM after final winback attempt. High-CLV → suppress from discount campaigns (protect margin).

Step 9 — Define Measurement per Segment

Track CVR and LTV per segment separately. Run incrementality tests on high-value segments. Use holdout groups for CRM journeys.

Output Format

Produce in TWO forms: inline visual dashboard (Visualizer) and structured markdown brief.

Visual Dashboard (Primary)

Render as inline HTML widget:

  • Header with client, objective, methods used, total customers
  • RFM segment distribution — horizontal stacked bar showing segment sizes, color-coded by priority (Champions = green, Lost = gray)
  • CLV tier pyramid — if CLV was run, show 5-tier pyramid with count and avg CLV per tier
  • Identity Graph metrics — if graph was built, show: total identities, match rate %, sources matched, confidence distribution
  • Activation matrix — table mapping each segment to media use, CRM use, creative implication
  • Data gaps — flagged items
  • sendPrompt() buttons: "Design CRM journey for [segment]" → crm-journey-architect, "Build media plan targeting [segments]" → media-routing-planner

Markdown Brief (Secondary)

## 👥 AUDIENCE SEGMENTATION BRIEF — [Client]

### Segmentation objective
[Business decision this supports]

### Methods used
[RFM + CLV + K-Means + Identity Graph — which were run and why]

### Identity graph summary
| Metric | Value |
[Total records, identities, match rate, sources, confidence]

### Data sources
| Source | Type (1P/2P/3P) | Fields | Reliability |

### Segments
| Segment | Method | Size | Avg value | CLV tier | Priority | Activation |
[One row per segment, ranked by priority]

### CLV tier distribution
| Tier | Count | Avg CLV | Action |

### Activation brief
| Segment | Media use | CRM use | Creative | Measurement |

### Suppression logic
[Which segments to exclude from which channels and why]

### Data gaps
[Missing fields, consent issues, addressability limits]

### Recommendation
[What to activate first, what to test, what data to collect next]

Examples

Example 1 — E-commerce RFM + CLV: User provides 6 months of transaction data for an e-commerce client in Mexico. → RFM produces 8 segments (Champions 12%, At Risk 18%, Lost 22%). CLV shows Platinum tier (top 20%) = 65% of revenue. Activation: Champions → lookalike seed + loyalty. At Risk → winback journey (SFMC). Lost → suppress from paid.

Example 2 — Identity Graph + segmentation: User provides CRM data + website CDP + retail partner data. → Identity Graph merges 45K records into 28K identities (62% cross-source match). RFM on unified data produces cleaner segments. Phone-based matching drives 70% of matches (Mexico market — phone > email for matching).

Example 3 — No data (proxy): User: "We're launching a new product for 25-35 women in Mexico City interested in skincare." → Proxy segmentation: High intent (skincare search behavior), Category buyers (beauty e-commerce), Broad awareness (25-35F metro). Data gap flagged — recommend pixel installation + CRM collection to enable RFM within 90 days.

Skill Chaining

DirectionSkillConnection
Upstreamscope-auditValidates segmentation work is in SOW
Upstreammedia-routing-plannerDefines which audiences need activating
Downstreamcrm-journey-architectSegment definitions → journey entry criteria
Downstreammedia-routing-plannerAudience sizes → budget allocation per segment
Downstreamcreative-supply-plannerSegment count → creative variant needs
Downstreammeasurement-incrementalitySegments → holdout/test group design
Downstreamexecutive-growth-memoSegment insights → leadership narrative

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.