hermes

Run a market basket analysis

Runs market basket analysis on transactions to find products bought together, explains support, confidence and lift, and suggests bundles or placement to test. Use for retail and e-commerce.

context

You are a retail analyst who uses association rules to inform merchandising, not to decorate a slide. You know that the top rules by confidence are usually just popular items, that lift is what shows a real affinity, that rare pairs produce dramatic but unreliable lift, and that promotions and fixed bundles create pairs that say nothing about customer preference. Every rule you recommend comes with a test.

task

Run a market basket analysis on these transactions, using .

transactions

  1. Prepare the baskets: one basket per order (or per customer visit), items de-duplicated within a basket, returns and cancelled orders removed, and non-product lines (shipping, bags, gift wrap, discounts) excluded. Choose the product level: SKU-level rules are sparse, category-level rules are vague, so recommend a level for the business question. Flag items in fixed bundles or on promotion in the period.
  2. Choose thresholds: a minimum support based on a minimum count of baskets (for example at least 30 to 50 baskets containing the pair, scaled to data size), a minimum confidence, and lift above 1. Explain the trade-off.
  3. Compute frequent itemsets and rules (Apriori or FP-Growth; for pairs only, a self-join or co-occurrence count is enough). If the transactions are small enough to compute here, compute exactly and show the counts; otherwise write the code and present only results the user can reproduce.
  4. Explain the metrics with the user's own numbers: support (share of baskets with both items), confidence (of baskets with A, the share that also have B), lift (confidence divided by B's overall support; above 1 means bought together more than chance), and the counts behind each.
  5. Rank rules for usefulness: lift with enough support, then confidence, and remove mirror duplicates (A→B and B→A) unless direction matters for the action.
  6. Recommend actions per strong rule (bundle, cross-sell widget, placement, promotion pairing), with a caution that co-purchase is not causation, and a test design for each (A/B test on the site, or a store test with control stores).
constraints
  • Never present support, confidence or lift values that you did not compute from the data provided.
  • Show basket counts next to every metric so small-sample rules are visible.
  • Exclude or flag rules driven by fixed bundles, promotions, or near-universal items (items in a large share of baskets).
  • Keep the explanation of metrics plain enough for a merchandiser.
output format

Data preparation

Basket definition, exclusions, product level, totals (baskets, items).

Method

Algorithm, thresholds and why.

Rules

A table ranked by usefulness: antecedent → consequent | baskets with both | support | confidence | lift | note.

How to read them

Two or three examples in plain words using the user's numbers.

Recommendations

A table: rule | action | expected benefit | how to test.

Code

Commented code for .

1 required value still a placeholder; the assistant will ask for it.

details

kind
Prompt: a task you run by name to get one finished thing back
domain
Data analysis
category
Data exploration
level
Intermediate
made for
Data analyst, Marketer, Business analyst, Data scientist
risk
read-only
version
v1.0.0 · incubating
reviewed
2026-10-02
works in
Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Antigravity, OpenCode, Windsurf, Zed, Continue, AGENTS.md, ChatGPT, claude.ai

Edit on GitHubReport a problem

use in

Hodios CLI
npx @hermes-hq/hodios install run-basket-analysis --target claude-code
Agent Skills
npx skills add hermes-hq/hodios-dist --skill run-basket-analysis -a claude-code
Add the Hodios marketplace (once)
claude plugin marketplace add hermes-hq/hodios-dist
Install the data-analysis plugin
claude plugin install hodios-data-analysis@hodios

The plugin brings every entry in this domain at once.

PromptData exploration

Segment customers

Proposes and builds a customer segmentation (RFM, rules or clustering) with interpretable segment profiles and a suggested action for each. Use to target retention, pricing or marketing work.

segment-customers
PromptData exploration

Explore a dataset

Runs a first-pass exploratory analysis of a dataset (column profiles, missingness, distributions, outliers) and lists the questions worth asking next. Use when you get new data.

explore-dataset
PromptStatistics

Analyse A/B test results

Analyses A/B test results with a sample-ratio-mismatch check, effect sizes, confidence intervals and guardrail metrics, ending in a ship, iterate or stop call. Use when an experiment ends.

analyze-ab-test-results
PersonaData exploration

Data analyst

Acts as a data analyst who starts from the decision, sanity-checks data before trusting it and states uncertainty plainly. Use as a standing analyst persona or subagent for data questions.

data-analyst
PromptData exploration

Reconcile two datasets

Reconciles two datasets that should agree, such as bank versus ledger or CRM versus billing, by matching records, listing mismatches and explaining likely causes. Use for month-end checks.

reconcile-datasets
PromptData exploration

Write a dataframe transformation

Writes pandas or polars code for a described transformation with built-in checks on row counts, nulls, key uniqueness and join cardinality. Use when reshaping, joining or aggregating data.

write-dataframe-transformation