Fruit shop owner-operator - have a coding agent build the daily repricing tool - wholesale moves daily, retail follows with a red line
Build me a single-file HTML daily repricing tool for a fruit shop owner, used
on a phone before opening. Fruit is repriced daily - every morning I set
today's prices for dozens of items, currently by feel.
Daily entry per item (only fill what changed):
- Item name, yesterday's price, today's wholesale cost (from the purchase
invoice), unit (per lb / per piece / per box)
- Yesterday's sell-through: sold out / most of it / plenty left - pick one
- The item's role: traffic driver / regular / margin item (set once in
settings, not daily)
Calculation logic (fixed in code, each explained on screen in one plain
sentence):
- Reference price = today's cost / (1 - target margin). Three roles, three
target margins, all in settings; no number is hardcoded
- Raise red line: when the reference price exceeds yesterday's price by more
than the max single-day increase (settings, default 10%), do not surface
the new price. Surface the red-line price plus one prompt: "cost is moving
fast on this one - check substitutes or order lighter." Matching wholesale
in one jump scares regulars off; this suppression is deliberate
- Plenty left yesterday: the reference price slides down - but with a floor
(min-margin line, in settings). At the floor with stock still sitting,
stop cutting and prompt "order less tomorrow" - markdowns cannot rescue
over-ordered fruit
- Traffic drivers never auto-raise: rising cost eats their target margin
first; below the min-margin line the only prompt is "time to switch the
traffic driver," never a price increase
Output (one screen):
- Today's price sheet: item / yesterday / today's suggestion / moved or not
- A separate "think again today" block: items that tripped the raise line or
hit the markdown floor, one-line reason each
- An "export today's changes" button: plain text, changed items only
(item / new price), handed straight to whoever swaps the shelf tags
Hard requirements:
- Single file, no build step, no CDN of any kind, opens directly in a phone
browser
- Data lives in localStorage and never leaves the device; no accounts, no
cloud sync
- Every day's history (date / cost / price / sell-through) is kept
automatically with a 7-day view - pricing judgment is built by looking
back, not by guessing fresh every morning
Why it is written this way
Fruit pricing is not standard retail: wholesale moves daily, sometimes twice, and retail must follow. Most owners run on two modes - copy the wholesale increase onto the tag, or hold the price and eat the squeeze. The first mode scares regulars away in a spike week ("it was eight bucks last week"); the second donates margin in a falling week. The tool converts "should we follow" into arithmetic (target margin) and "by how much" into a red line (max daily move) - feel steps down, rules step up.
The traffic driver never auto-raising is the most counterintuitive and most important rule in the spec. Discounted bananas exist to bring people through the door; the margin gained by adding fifty cents is far smaller than the attached sales lost when traffic dips a tenth. When cost spikes past the min-margin line, the right move is switching the traffic driver (whatever is cheap this season), not repricing the bananas - locking the tool into "suggest a switch, never a raise" welds that logic into code.
"Markdowns cannot rescue over-ordered fruit" is the brake against markdown dependency: auto-cutting the price of slow stock looks sensible, but if it still sits at the floor, the problem was the order, not the price - keep cutting and you train customers to wait for the discount. Past the floor the tool stops cutting and points back at tomorrow's order quantity.
History-keeping looks like a nice-to-extra but is the actual core of pricing skill: seven days of cost-price-sell-through teaches which items are elastic (two dollars up and they stop moving) and which are not - faster than any theory. That is why it is default-on, never an option; optional logs never get turned on.
Variables
| Variable | Notes |
|---|---|
| Target margins by role | Traffic drivers can run low single digits; margin items set per category. Fill by feel in week one, recalibrate after |
| Max single-day increase | Default 10%; price-sensitive neighborhoods tighten to 8% |
| Min-margin line | The floor that switches the prompt from "cut price" to "cut order" - a stop-loss, not a price |