Build an expense splitter
Who paid what, who owes whom, and a settle-up that balances to the cent.
The interface is a list of who paid what. The hard part is "settle up", where the numbers have to balance.
Left alone, an agent gets that slightly wrong. It stores money as floats, makes too many transfers, and drops a remainder so someone owes a phantom penny. This plan is built to get you a settle-up your friends trust.
The spec and the cuts
- One HTML file under 50KB. localStorage keeps the group so a refresh doesn't wipe the dinner.
- One group at a time. Add people, add expenses (who paid, how much, who it's for), see who owes whom.
- Cut: accounts (share a link or a screenshot), trip history, currency conversion and notifications.
The prompts
Tick what you want and the prompts below change to match. Paste them into Claude Code (or Cursor, or any agent) one at a time, in order. Prompt 2 checks the settle-up math, fixes what it finds and adds no features.
The copy buttons grab the current version.
1 · Build it
2 · The settle-up math pass
3 · The summary, then ship it
4 · Get human eyes on it before the group uses it
Where agents go wrong
- Floating-point money. Agents store
19.99and add floats, and0.1 + 0.2isn't0.3in JavaScript. Keep integer cents and format only for display. - N² transfers. The naive settle-up has everyone pay everyone they owe, which for eight people means dozens of tiny Venmos. Use a greedy minimum-transactions settle: net each person to one balance, then keep matching the biggest debtor with the biggest creditor. Four people should almost never need more than three transfers.
- The dropped remainder. $10.00 split three ways is 333 cents each, one cent short. Assign leftover cents in a fixed order (say, to the first payers) so every expense sums to exactly what was paid.
- Who's in the split. "Pizza for everyone" and "cocktails for the three who drank" are different math. Each expense needs its own participant list.
Why prompt 4 is in the plan
You know what each expense was meant to cover, so wrong totals look right to you. Prompt 4 connects your agent to my MCP server, which shares the live page. Send the link to one or two people who'll be paying. They pin notes on the number that looks off, no login needed, and catch it before the group chat does.